258 lines
7.2 KiB
Rust
258 lines
7.2 KiB
Rust
//! Shared model types for the admin UI.
|
|
//!
|
|
//! These are client-side DTOs (Data Transfer Objects) for API responses.
|
|
//! They are separate from the database models in `chattyness_db`.
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
// =============================================================================
|
|
// User Models
|
|
// =============================================================================
|
|
|
|
/// User summary for list display.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct UserSummary {
|
|
pub id: String,
|
|
pub username: String,
|
|
pub display_name: String,
|
|
pub email: Option<String>,
|
|
pub status: String,
|
|
pub created_at: String,
|
|
}
|
|
|
|
/// User detail from API.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct UserDetail {
|
|
pub id: String,
|
|
pub username: String,
|
|
pub display_name: String,
|
|
pub email: Option<String>,
|
|
pub status: String,
|
|
pub server_role: Option<String>,
|
|
pub created_at: String,
|
|
pub updated_at: String,
|
|
}
|
|
|
|
/// Response for user creation.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct CreateUserResponse {
|
|
pub id: String,
|
|
pub username: String,
|
|
pub temporary_password: String,
|
|
}
|
|
|
|
/// Response for password reset.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct PasswordResetResponse {
|
|
pub user_id: String,
|
|
pub temporary_password: String,
|
|
}
|
|
|
|
// =============================================================================
|
|
// Staff Models
|
|
// =============================================================================
|
|
|
|
/// Staff member for list display.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct StaffMemberSummary {
|
|
pub user_id: String,
|
|
pub username: String,
|
|
pub display_name: String,
|
|
pub email: Option<String>,
|
|
pub role: String,
|
|
pub appointed_at: String,
|
|
}
|
|
|
|
// =============================================================================
|
|
// Realm Models
|
|
// =============================================================================
|
|
|
|
/// Realm summary for list display.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct RealmSummary {
|
|
pub id: String,
|
|
pub slug: String,
|
|
pub name: String,
|
|
pub tagline: Option<String>,
|
|
pub privacy: String,
|
|
pub is_nsfw: bool,
|
|
pub owner_id: String,
|
|
pub owner_username: String,
|
|
pub member_count: i64,
|
|
pub current_user_count: i64,
|
|
pub created_at: String,
|
|
}
|
|
|
|
/// Realm detail from API.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct RealmDetail {
|
|
pub id: String,
|
|
pub slug: String,
|
|
pub name: String,
|
|
pub tagline: Option<String>,
|
|
pub description: Option<String>,
|
|
pub privacy: String,
|
|
pub is_nsfw: bool,
|
|
pub allow_guest_access: bool,
|
|
pub max_users: i32,
|
|
pub theme_color: Option<String>,
|
|
pub owner_id: String,
|
|
pub owner_username: String,
|
|
pub owner_display_name: String,
|
|
pub member_count: i64,
|
|
pub current_user_count: i64,
|
|
pub created_at: String,
|
|
pub updated_at: String,
|
|
}
|
|
|
|
/// Response for realm creation.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct CreateRealmResponse {
|
|
pub realm_id: String,
|
|
pub slug: String,
|
|
pub owner_id: String,
|
|
pub owner_temporary_password: Option<String>,
|
|
}
|
|
|
|
// =============================================================================
|
|
// Scene Models
|
|
// =============================================================================
|
|
|
|
/// Scene summary for list display.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct SceneSummary {
|
|
pub id: Uuid,
|
|
pub name: String,
|
|
pub slug: String,
|
|
pub sort_order: i32,
|
|
pub is_entry_point: bool,
|
|
pub is_hidden: bool,
|
|
pub background_color: Option<String>,
|
|
pub background_image_path: Option<String>,
|
|
}
|
|
|
|
/// Scene detail from API.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct SceneDetail {
|
|
pub id: Uuid,
|
|
pub realm_id: Uuid,
|
|
pub name: String,
|
|
pub slug: String,
|
|
pub description: Option<String>,
|
|
pub background_image_path: Option<String>,
|
|
pub background_color: Option<String>,
|
|
pub bounds_wkt: String,
|
|
pub dimension_mode: String,
|
|
pub sort_order: i32,
|
|
pub is_entry_point: bool,
|
|
pub is_hidden: bool,
|
|
pub created_at: String,
|
|
pub updated_at: String,
|
|
}
|
|
|
|
/// Response for image dimensions.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct ImageDimensionsResponse {
|
|
pub width: u32,
|
|
pub height: u32,
|
|
}
|
|
|
|
// =============================================================================
|
|
// Dashboard Models
|
|
// =============================================================================
|
|
|
|
/// Dashboard stats from server.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct DashboardStats {
|
|
pub total_users: i64,
|
|
pub active_users: i64,
|
|
pub total_realms: i64,
|
|
pub online_users: i64,
|
|
pub staff_count: i64,
|
|
}
|
|
|
|
// =============================================================================
|
|
// Server Config Models
|
|
// =============================================================================
|
|
|
|
/// Server configuration from API.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct ServerConfig {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub description: Option<String>,
|
|
pub welcome_message: Option<String>,
|
|
pub max_users_per_channel: i32,
|
|
pub message_rate_limit: i32,
|
|
pub message_rate_window_seconds: i32,
|
|
pub allow_guest_access: bool,
|
|
pub allow_user_uploads: bool,
|
|
pub require_email_verification: bool,
|
|
pub created_at: String,
|
|
pub updated_at: String,
|
|
}
|
|
|
|
// =============================================================================
|
|
// Common Response Types
|
|
// =============================================================================
|
|
|
|
/// Generic error response from API.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct ErrorResponse {
|
|
pub error: String,
|
|
}
|
|
|
|
/// Generic success response.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct SuccessResponse {
|
|
pub success: bool,
|
|
}
|
|
|
|
// =============================================================================
|
|
// Prop Models
|
|
// =============================================================================
|
|
|
|
/// Prop summary for list display.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct PropSummary {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub slug: String,
|
|
pub asset_path: String,
|
|
pub default_layer: Option<String>,
|
|
pub is_active: bool,
|
|
pub created_at: String,
|
|
}
|
|
|
|
/// Prop detail from API.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct PropDetail {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub slug: String,
|
|
pub description: Option<String>,
|
|
pub tags: Vec<String>,
|
|
pub asset_path: String,
|
|
pub thumbnail_path: Option<String>,
|
|
pub default_layer: Option<String>,
|
|
/// Grid position (0-8): top row 0,1,2 / middle 3,4,5 / bottom 6,7,8
|
|
pub default_position: Option<i16>,
|
|
pub is_unique: bool,
|
|
pub is_transferable: bool,
|
|
pub is_portable: bool,
|
|
pub is_active: bool,
|
|
pub available_from: Option<String>,
|
|
pub available_until: Option<String>,
|
|
pub created_at: String,
|
|
pub updated_at: String,
|
|
}
|
|
|
|
/// Response for prop creation.
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct CreatePropResponse {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub slug: String,
|
|
pub asset_path: String,
|
|
}
|