Skip to content

Commit 9a505a4

Browse files
authored
refactor: add entity variant to identifiers enum (#17)
1 parent 91f6e90 commit 9a505a4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/types/core/identifier.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub enum Identifier {
77
User(String),
88
Merchant(String),
99
UserAuth(String),
10+
Entity(String),
1011
}
1112

1213
impl Identifier {
@@ -15,6 +16,7 @@ impl Identifier {
1516
Self::User(id) => (String::from("User"), id.clone()),
1617
Self::Merchant(id) => (String::from("Merchant"), id.clone()),
1718
Self::UserAuth(id) => (String::from("UserAuth"), id.clone()),
19+
Self::Entity(id) => (String::from("Entity"), id.clone()),
1820
}
1921
}
2022
}
@@ -25,6 +27,7 @@ impl core::fmt::Display for Identifier {
2527
Self::User(s) => f.write_str(&format!("User_{}", s)),
2628
Self::Merchant(s) => f.write_str(&format!("Merchant_{}", s)),
2729
Self::UserAuth(s) => f.write_str(&format!("UserAuth_{}", s)),
30+
Self::Entity(s) => f.write_str(&format!("Entity_{}", s)),
2831
}
2932
}
3033
}
@@ -39,6 +42,7 @@ impl TryFrom<(String, String)> for Identifier {
3942
("User", kid) => Ok(Self::User(kid)),
4043
("Merchant", kid) => Ok(Self::Merchant(kid)),
4144
("UserAuth", kid) => Ok(Self::UserAuth(kid)),
45+
("Entity", kid) => Ok(Self::Entity(kid)),
4246
(_, _) => Err(error_stack::Report::from(
4347
errors::ParsingError::ParsingFailed(String::from("Failed to parse Identifier")),
4448
)),

0 commit comments

Comments
 (0)