refactor: update configuration handling to use environment variables and improve code organization
77 lines
1.7 KiB
Rust
77 lines
1.7 KiB
Rust
use crate::models::AlbumPermission;
|
|
|
|
pub struct UploadMediaData<'a> {
|
|
pub owner_id: uuid::Uuid,
|
|
pub filename: String,
|
|
pub mime_type: String,
|
|
pub stream:
|
|
Box<dyn futures::Stream<Item = Result<bytes::Bytes, std::io::Error>> + 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<Option<&'a str>>,
|
|
pub is_public: Option<bool>,
|
|
}
|
|
|
|
pub struct AddMediaToAlbumData {
|
|
pub album_id: uuid::Uuid,
|
|
pub media_ids: Vec<uuid::Uuid>,
|
|
}
|
|
|
|
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<String>,
|
|
pub metadata_filters: Option<Vec<MetadataFilter>>,
|
|
// In the future, we can add fields like:
|
|
// pub date_range: Option<(chrono::DateTime<chrono::Utc>, chrono::DateTime<chrono::Utc>)>,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct ListMediaOptions {
|
|
pub sort: Option<SortParams>,
|
|
pub filter: Option<FilterParams>,
|
|
// pub pagination: Option<PaginationParams>,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct MetadataFilter {
|
|
pub tag_name: String,
|
|
pub tag_value: String,
|
|
} |