Files
mctf/pamsave/packages/api/src/models.rs
T
TakuyaYagam1 13f936bee9 chore: import MCTF services
- Added all seven issued service trees without omissions.
- Preserved the supplied runtime configuration, binaries, and assets.
2026-11-29 12:25:29 +03:00

66 lines
1.5 KiB
Rust
Executable File

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<String>,
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<Uuid>,
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<Uuid>,
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,
}