use database_entity::{AFBlobMetadata, AFRole}; use serde::{Deserialize, Serialize}; use std::ops::Deref; #[derive(Deserialize, Serialize)] pub struct WorkspaceMembers(pub Vec); #[derive(Deserialize, Serialize)] pub struct WorkspaceMember(pub String); impl Deref for WorkspaceMember { type Target = String; fn deref(&self) -> &Self::Target { &self.0 } } impl From> for WorkspaceMembers { fn from(value: Vec) -> Self { Self(value.into_iter().map(WorkspaceMember).collect()) } } #[derive(Deserialize, Serialize)] pub struct CreateWorkspaceMembers(pub Vec); impl From> for CreateWorkspaceMembers { fn from(value: Vec) -> Self { Self(value) } } #[derive(Deserialize, Serialize)] pub struct CreateWorkspaceMember { pub email: String, pub role: AFRole, } #[derive(Deserialize, Serialize)] pub struct WorkspaceMemberChangeset { pub email: String, pub role: Option, pub name: Option, } impl WorkspaceMemberChangeset { pub fn new(email: String) -> Self { Self { email, role: None, name: None, } } pub fn with_role(mut self, role: AFRole) -> Self { self.role = Some(role); self } pub fn with_name(mut self, name: String) -> Self { self.name = Some(name); self } } #[derive(Deserialize, Serialize)] pub struct WorkspaceSpaceUsage { pub total_capacity: u64, pub consumed_capacity: u64, } #[derive(Serialize, Deserialize)] pub struct WorkspaceBlobMetadata(pub Vec);