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,5 +1,5 @@
|
||||
use axum::{extract::{FromRequestParts, Query}, http::request::Parts};
|
||||
use libertas_core::{error::CoreError, schema::{FilterParams, ListMediaOptions, SortOrder, SortParams}};
|
||||
use libertas_core::{error::CoreError, schema::{FilterParams, ListMediaOptions, MetadataFilter, SortOrder, SortParams}};
|
||||
|
||||
use crate::{error::ApiError, schema::ListMediaParams, state::AppState};
|
||||
|
||||
@@ -18,8 +18,25 @@ impl From<ListMediaParams> for ListMediaOptions {
|
||||
}
|
||||
});
|
||||
|
||||
let metadata_filters = if params.metadata.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(
|
||||
params.metadata
|
||||
.into_iter()
|
||||
.filter_map(|s| {
|
||||
s.split_once(":").map(|(key, value)| MetadataFilter {
|
||||
tag_name: key.to_string(),
|
||||
tag_value: value.to_string(),
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
)
|
||||
};
|
||||
|
||||
let filter = Some(FilterParams {
|
||||
// e.g., mime_type: params.mime_type
|
||||
mime_type: params.mime_type,
|
||||
metadata_filters,
|
||||
});
|
||||
|
||||
ListMediaOptions { sort, filter }
|
||||
|
||||
Reference in New Issue
Block a user