Model workspaces, users, and organizations
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
use super::id::{IdError, validate_id};
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
pub struct UserId(String);
|
||||
|
||||
impl UserId {
|
||||
pub const MAX_BYTES: usize = 128;
|
||||
|
||||
pub fn new(value: impl Into<String>) -> Result<Self, IdError> {
|
||||
let value = value.into();
|
||||
validate_id(&value, Self::MAX_BYTES, IdError::User)?;
|
||||
Ok(Self(value))
|
||||
}
|
||||
|
||||
pub fn as_str(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct User {
|
||||
pub id: UserId,
|
||||
pub display_name: String,
|
||||
}
|
||||
Reference in New Issue
Block a user