use crate::dto::{AFAccessLevel, AFRole}; use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use sqlx::FromRow; use uuid::Uuid; /// Represent the row of the af_workspace table #[derive(Debug, Clone, FromRow, Serialize, Deserialize)] pub struct AFWorkspaceRow { pub workspace_id: Uuid, pub database_storage_id: Option, pub owner_uid: Option, pub created_at: Option>, pub workspace_type: i32, pub deleted_at: Option>, pub workspace_name: Option, } /// Represent the row of the af_user table #[derive(Debug, FromRow, Deserialize, Serialize, Clone)] pub struct AFUserRow { pub uid: i64, pub uuid: Option, pub email: Option, pub password: Option, pub name: Option, pub metadata: Option, pub encryption_sign: Option, pub deleted_at: Option>, pub updated_at: Option>, pub created_at: Option>, } /// Represent the row of the af_user_profile_view #[derive(Debug, FromRow, Deserialize, Serialize)] pub struct AFUserProfileRow { pub uid: Option, pub uuid: Option, pub email: Option, pub password: Option, pub name: Option, pub metadata: Option, pub encryption_sign: Option, pub deleted_at: Option>, pub updated_at: Option>, pub created_at: Option>, pub latest_workspace_id: Option, } #[derive(FromRow, Serialize, Deserialize)] pub struct AFWorkspaceMemberPermRow { pub uid: i64, pub role: AFRole, pub workspace_id: Uuid, } #[derive(FromRow, Serialize, Deserialize)] pub struct AFWorkspaceMemberRow { pub uid: i64, pub name: String, pub email: String, pub role: AFRole, } #[derive(FromRow)] pub struct AFCollabMemerAccessLevelRow { pub uid: i64, pub oid: String, pub access_level: AFAccessLevel, } #[derive(FromRow, Clone, Debug, Serialize, Deserialize)] pub struct AFCollabMemberRow { pub uid: i64, pub oid: String, pub permission_id: i64, } #[derive(FromRow, Serialize, Deserialize)] pub struct AFBlobMetadataRow { pub workspace_id: Uuid, pub file_id: String, pub file_type: String, pub file_size: i64, pub modified_at: DateTime, } #[derive(Debug, Deserialize, Serialize, Clone)] pub struct AFUserNotification { pub payload: Option, } #[derive(FromRow, Debug, Clone)] pub struct AFPermissionRow { pub id: i32, pub name: String, pub access_level: AFAccessLevel, pub description: Option, } #[derive(FromRow, Serialize, Deserialize)] pub struct AFSnapshotRow { pub sid: i64, pub oid: String, pub blob: Vec, pub len: Option, pub encrypt: Option, pub deleted_at: Option>, pub created_at: DateTime, pub workspace_id: Uuid, }