feat: add file serving endpoint GET /assets/:id/file

This commit is contained in:
2026-05-31 05:59:19 +02:00
parent 3a18fd1d3f
commit 0f003a3bd6
4 changed files with 52 additions and 5 deletions

View File

@@ -64,7 +64,7 @@ pub async fn build_app(config: &Config) -> Result<Router> {
// File storage for ingest
let storage_path = std::env::var("STORAGE_PATH").unwrap_or_else(|_| "./data/media".to_string());
let file_storage = Arc::new(LocalFileStorage::new(&storage_path));
let file_storage: Arc<LocalFileStorage> = Arc::new(LocalFileStorage::new(&storage_path));
// Album handlers
let create_album_handler = Arc::new(CreateAlbumHandler::new(album_repo.clone()));
@@ -78,7 +78,7 @@ pub async fn build_app(config: &Config) -> Result<Router> {
quota_repo,
ledger_repo,
asset_repo.clone(),
file_storage,
file_storage.clone(),
event_publisher.clone(),
));
let get_asset_handler = Arc::new(GetAssetHandler::new(
@@ -90,7 +90,7 @@ pub async fn build_app(config: &Config) -> Result<Router> {
metadata_repo.clone(),
));
let update_metadata_handler = Arc::new(UpdateMetadataHandler::new(
asset_repo,
asset_repo.clone(),
metadata_repo,
event_publisher,
));
@@ -115,6 +115,8 @@ pub async fn build_app(config: &Config) -> Result<Router> {
update_metadata_handler,
register_volume_handler,
register_library_path_handler,
file_storage,
asset_repo,
);
let cors = CorsLayer::new()