refactor: move business logic out of presentation — ReadAssetFile, checksum, auth checks, MetadataValue conversions

This commit is contained in:
2026-05-31 06:10:07 +02:00
parent 0f003a3bd6
commit 34b231a8f6
18 changed files with 256 additions and 43 deletions

View File

@@ -10,6 +10,7 @@ use std::sync::Arc;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct GetAssetQuery {
pub asset_id: SystemId,
pub user_id: SystemId,
}
pub struct GetAssetHandler {
@@ -38,6 +39,10 @@ impl GetAssetHandler {
.await?
.ok_or_else(|| DomainError::NotFound(format!("Asset {} not found", query.asset_id)))?;
if asset.owner_user_id != query.user_id {
return Err(DomainError::Forbidden("Access denied".to_string()));
}
let layers = self.metadata_repo.find_by_asset(&asset.asset_id).await?;
let resolved = resolve_metadata(&layers);