BLOG-78 refactor: simplify get_image_by_id implementation in ImageRepositoryImpl
All checks were successful
PR Title Check / pr-title-check (pull_request) Successful in 13s
Frontend CI / build (push) Successful in 1m8s

This commit is contained in:
SquidSpirit 2025-07-27 12:52:50 +08:00
parent 5a30642b8f
commit aaf43f21bd

View File

@ -42,8 +42,11 @@ impl ImageRepository for ImageRepositoryImpl {
async fn get_image_by_id(&self, id: i32) -> Result<Image, ImageError> { async fn get_image_by_id(&self, id: i32) -> Result<Image, ImageError> {
let image_mapper = self.image_db_service.get_image_info_by_id(id).await?; let image_mapper = self.image_db_service.get_image_info_by_id(id).await?;
let mut image = image_mapper.to_entity(); let data = self.image_storage.read_data(id)?;
image.data = self.image_storage.read_data(id)?; Ok(Image {
Ok(image) id: image_mapper.id,
mime_type: image_mapper.mime_type,
data,
})
} }
} }