use crate::models::{AlbumPermission, Media, MediaMetadata}; pub struct UploadMediaData<'a> { pub owner_id: uuid::Uuid, pub filename: String, pub mime_type: String, pub stream: Box> + Send + Unpin + 'a>, } pub struct CreateUserData<'a> { pub username: &'a str, pub email: &'a str, pub password: &'a str, } pub struct LoginUserData<'a> { pub username_or_email: &'a str, pub password: &'a str, } pub struct CreateAlbumData<'a> { pub owner_id: uuid::Uuid, pub name: &'a str, pub description: Option<&'a str>, pub is_public: bool, } pub struct UpdateAlbumData<'a> { pub name: Option<&'a str>, pub description: Option>, pub is_public: Option, } pub struct AddMediaToAlbumData { pub album_id: uuid::Uuid, pub media_ids: Vec, } pub struct ShareAlbumData { pub album_id: uuid::Uuid, pub target_user_id: uuid::Uuid, pub permission: AlbumPermission, } #[derive(Debug, Clone)] pub enum SortOrder { Asc, Desc, } #[derive(Debug, Clone)] pub struct SortParams { pub sort_by: String, pub sort_order: SortOrder, } #[derive(Debug, Clone, Default)] pub struct FilterParams { pub mime_type: Option, pub metadata_filters: Option>, pub conditions: Option>, // In the future, we can add fields like: // pub date_range: Option<(chrono::DateTime, chrono::DateTime)>, } #[derive(Debug, Clone, Copy)] pub struct PaginationParams { pub page: u32, pub limit: u32, } #[derive(Debug, Clone)] pub struct ListMediaOptions { pub sort: Option, pub filter: Option, pub pagination: Option, } #[derive(Debug, Clone)] pub struct MetadataFilter { pub tag_name: String, pub tag_value: String, } #[derive(Debug, Clone)] pub struct FilterCondition { pub field: String, pub operator: FilterOperator, pub value: String, } #[derive(Debug, Clone, PartialEq)] pub enum FilterOperator { Eq, Neq, Like, Gt, Lt, Gte, Lte, } pub struct MediaImportBundle { pub media_model: Media, pub metadata_models: Vec, pub file_size: i64, } #[derive(Debug, Clone)] pub struct PaginatedResponse { pub data: Vec, pub page: u32, pub limit: u32, pub total_items: i64, pub total_pages: u32, pub has_next_page: bool, pub has_prev_page: bool, } impl PaginatedResponse { pub fn new(data: Vec, page: u32, limit: u32, total_items: i64) -> Self { let total_pages = if limit == 0 { 0 } else { (total_items as f64 / limit as f64).ceil() as u32 }; let has_next_page = page < total_pages; let has_prev_page = page > 1; Self { data, page, limit, total_items, total_pages, has_next_page, has_prev_page, } } } #[derive(serde::Deserialize)] pub struct RemoveMediaFromAlbumRequest { pub media_ids: Vec, }