BLOG-78 Backend image upload and download #84

Merged
squid merged 6 commits from BLOG-78_image_management into main 2025-07-27 13:10:47 +08:00
Showing only changes of commit aaf43f21bd - Show all commits

View File

@ -42,8 +42,11 @@ impl ImageRepository for ImageRepositoryImpl {
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 mut image = image_mapper.to_entity();
image.data = self.image_storage.read_data(id)?;
Ok(image)
let data = self.image_storage.read_data(id)?;
Ok(Image {
id: image_mapper.id,
mime_type: image_mapper.mime_type,
data,
})
}
}