refactor: clean up album and auth handlers by removing unused structs and imports
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
use libertas_core::models::{Album, AlbumPermission};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct MediaResponse {
|
||||
@@ -15,4 +17,79 @@ pub struct ListMediaParams {
|
||||
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,
|
||||
}
|
||||
Reference in New Issue
Block a user