diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-10-11 22:40:03 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-10-11 22:40:03 -0400 |
| commit | 812f1cafe3f8a68bf45b677fade7417c30d92eac (patch) | |
| tree | e2633472a31bd86bf08bcc16ddb4296df89064b4 /src/invite/id.rs | |
| parent | a0abed5ea08b2fc5b9ac4abdade1199f62cd5da7 (diff) | |
Create APIs for inviting users.
Diffstat (limited to 'src/invite/id.rs')
| -rw-r--r-- | src/invite/id.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/invite/id.rs b/src/invite/id.rs new file mode 100644 index 0000000..bd53f1f --- /dev/null +++ b/src/invite/id.rs @@ -0,0 +1,24 @@ +use crate::id::Id as BaseId; + +// Stable identifier for an invite Prefixed with `I`. +#[derive(Clone, Debug, Eq, PartialEq, sqlx::Type, serde::Deserialize, serde::Serialize)] +#[sqlx(transparent)] +pub struct Id(BaseId); + +impl From<BaseId> for Id { + fn from(id: BaseId) -> Self { + Self(id) + } +} + +impl Id { + pub fn generate() -> Self { + BaseId::generate("I") + } +} + +impl std::fmt::Display for Id { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.fmt(f) + } +} |
