95 lines
2.1 KiB
Rust
95 lines
2.1 KiB
Rust
use libertas_core::models::{Album, AlbumPermission};
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Serialize)]
|
|
pub struct MediaResponse {
|
|
pub id: uuid::Uuid,
|
|
pub storage_path: String,
|
|
pub original_filename: String,
|
|
pub mime_type: String,
|
|
pub hash: String,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct ListMediaParams {
|
|
pub sort_by: Option<String>,
|
|
pub order: Option<String>,
|
|
// You can add future filters here, e.g.:
|
|
// pub mime_type: Option<String>,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct CreateAlbumRequest {
|
|
pub name: String,
|
|
pub description: Option<String>,
|
|
pub is_public: Option<bool>,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct AddMediaToAlbumRequest {
|
|
pub media_ids: Vec<Uuid>,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct ShareAlbumRequest {
|
|
pub target_user_id: Uuid,
|
|
pub permission: AlbumPermission,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
pub struct AlbumResponse {
|
|
pub id: Uuid,
|
|
pub owner_id: Uuid,
|
|
pub name: String,
|
|
pub description: Option<String>,
|
|
pub is_public: bool,
|
|
pub created_at: chrono::DateTime<chrono::Utc>,
|
|
pub updated_at: chrono::DateTime<chrono::Utc>,
|
|
}
|
|
|
|
impl From<Album> for AlbumResponse {
|
|
fn from(album: Album) -> Self {
|
|
Self {
|
|
id: album.id,
|
|
owner_id: album.owner_id,
|
|
name: album.name,
|
|
description: album.description,
|
|
is_public: album.is_public,
|
|
created_at: album.created_at,
|
|
updated_at: album.updated_at,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct UpdateAlbumRequest {
|
|
pub name: Option<String>,
|
|
pub description: Option<Option<String>>,
|
|
pub is_public: Option<bool>,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct RegisterRequest {
|
|
pub username: String,
|
|
pub email: String,
|
|
pub password: String,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct LoginRequest {
|
|
pub username_or_email: String,
|
|
pub password: String,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
pub struct LoginResponse {
|
|
pub token: String,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
pub struct UserResponse {
|
|
pub id: Uuid,
|
|
pub username: String,
|
|
pub email: String,
|
|
} |