use chrono::NaiveDateTime; use serde::{Deserialize, Serialize}; use uuid::Uuid; #[derive(Debug)] #[cfg_attr(feature = "server", derive(sqlx::FromRow))] pub struct Workspace { pub id: Uuid, pub title: String, pub description: Option, pub created_at: NaiveDateTime, } #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[cfg_attr(feature = "server", derive(sqlx::Type))] #[cfg_attr( feature = "server", sqlx(type_name = "role", rename_all = "snake_case") )] #[serde(rename_all = "snake_case")] pub enum Role { User, WorkspaceAdmin, } #[derive(Debug)] #[cfg_attr(feature = "server", derive(sqlx::FromRow))] pub struct User { pub id: Uuid, pub username: String, pub workspace_id: Option, pub role: Role, pub created_at: NaiveDateTime, } #[derive(Debug)] #[cfg_attr(feature = "server", derive(sqlx::FromRow))] pub struct Session { pub user_id: Uuid, pub cookie: String, pub expires_at: NaiveDateTime, } #[derive(Debug)] #[cfg_attr(feature = "server", derive(sqlx::FromRow))] pub struct File { pub id: Uuid, pub name: String, pub filename: String, pub owner_id: Uuid, pub workspace_id: Option, pub size: i64, pub created_at: NaiveDateTime, pub is_public: bool, pub owner: String, } #[derive(Debug)] #[cfg_attr(feature = "server", derive(sqlx::FromRow))] pub struct AuthPolicy { pub id: Uuid, pub name: String, pub filename: String, pub workspace_id: Uuid, }