feat: add XMP writer plugin and enhance media upload configuration

This commit is contained in:
2025-11-02 19:22:35 +01:00
parent 13bb9e6b3e
commit 8b98df745c
11 changed files with 217 additions and 31 deletions

View File

@@ -13,5 +13,6 @@ pub fn load_config() -> CoreResult<Config> {
jwt_secret: "super_secret_jwt_key".to_string(),
media_library_path: "media_library".to_string(),
broker_url: "nats://localhost:4222".to_string(),
max_upload_size_mb: Some(100),
})
}

View File

@@ -38,11 +38,13 @@ impl From<Media> for MediaResponse {
}
pub fn media_routes() -> Router<AppState> {
let max_size_mb = 100; // todo: get from config
Router::new()
.route("/", post(upload_media))
.route("/{id}", get(get_media_details).delete(delete_media))
.route("/{id}/file", get(get_media_file))
.layer(DefaultBodyLimit::max(250 * 1024 * 1024))
.layer(DefaultBodyLimit::max(max_size_mb * 1024 * 1024))
}
async fn upload_media(

View File

@@ -226,7 +226,7 @@ impl MediaService for MediaServiceImpl {
.update_storage_used(user.id, -file_size)
.await?;
let job_payload = json!({ "media_id": id });
let job_payload = json!({ "storage_path": media.storage_path });
self.nats_client
.publish("media.deleted".to_string(), job_payload.to_string().into())
.await