use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct App { pub id: String, pub name: String, pub repo_url: String, pub branch: String, pub port: i64, pub webhook_secret: String, pub memory_limit: String, pub cpu_limit: String, pub created_at: String, pub updated_at: String, /// Encrypted git token for cloning private repos. Never serialised to API responses. #[serde(skip_serializing)] pub git_token: Option, } #[derive(Debug, Deserialize)] pub struct CreateApp { pub name: String, pub repo_url: Option, pub branch: Option, pub port: i64, pub memory_limit: Option, pub cpu_limit: Option, pub git_token: Option, } #[derive(Debug, Deserialize)] pub struct UpdateApp { pub repo_url: Option, pub branch: Option, pub port: Option, pub memory_limit: Option, pub cpu_limit: Option, pub git_token: Option, } #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct Deploy { pub id: String, pub app_id: String, pub sha: Option, pub status: String, pub log: String, pub triggered_by: String, pub started_at: Option, pub finished_at: Option, pub created_at: String, } #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct EnvVar { pub app_id: String, pub key: String, pub value: String, } #[derive(Debug, Deserialize)] pub struct SetEnvVar { pub key: String, pub value: String, } #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct User { pub id: String, pub username: String, pub password_hash: String, pub is_admin: i64, pub created_at: String, } #[derive(Debug, Deserialize)] pub struct CreateUser { pub username: String, pub password: String, pub is_admin: Option, } #[derive(Debug, Deserialize)] pub struct UpdateUser { pub password: Option, pub is_admin: Option, } #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct SshKey { pub id: String, pub user_id: String, pub label: String, pub public_key: String, pub created_at: String, } #[derive(Debug, Deserialize)] pub struct CreateSshKey { pub label: String, pub public_key: String, } #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct ApiKey { pub id: String, pub user_id: String, pub label: String, pub created_at: String, // key_hash is intentionally not exposed in serialised output } #[derive(Debug, Deserialize)] pub struct CreateApiKey { pub label: String, } #[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)] pub struct Database { pub app_id: String, pub pg_user: String, pub pg_password: String, pub created_at: String, }