feat: enhance media management with EXIF data extraction, metadata filtering, and storage path generation
refactor: update configuration handling to use environment variables and improve code organization
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use libertas_core::models::{Album, AlbumPermission};
|
||||
use libertas_core::{models::{Album, AlbumPermission, MediaMetadata}};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
@@ -15,9 +15,9 @@ pub struct MediaResponse {
|
||||
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>,
|
||||
}
|
||||
pub mime_type: Option<String>,
|
||||
#[serde(default)]
|
||||
pub metadata: Vec<String>,}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct CreateAlbumRequest {
|
||||
@@ -92,4 +92,32 @@ pub struct UserResponse {
|
||||
pub id: Uuid,
|
||||
pub username: String,
|
||||
pub email: String,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct MediaMetadataResponse {
|
||||
pub source: String,
|
||||
pub tag_name: String,
|
||||
pub tag_value: String,
|
||||
}
|
||||
|
||||
impl From<MediaMetadata> for MediaMetadataResponse {
|
||||
fn from(metadata: MediaMetadata) -> Self {
|
||||
Self {
|
||||
source: metadata.source.as_str().to_string(),
|
||||
tag_name: metadata.tag_name,
|
||||
tag_value: metadata.tag_value,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct MediaDetailsResponse {
|
||||
pub id: uuid::Uuid,
|
||||
pub storage_path: String,
|
||||
pub original_filename: String,
|
||||
pub mime_type: String,
|
||||
pub hash: String,
|
||||
pub metadata: Vec<MediaMetadataResponse>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user