Model workspaces, users, and organizations

This commit is contained in:
2026-11-30 18:19:05 +08:00
parent deb535c256
commit 365be3870e
6 changed files with 162 additions and 64 deletions
+24
View File
@@ -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,
}