feat: add XMP writer plugin and enhance media upload configuration
This commit is contained in:
@@ -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),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user