BLOG-94 refactor: change image ID from Option<i32> to i32 in Image struct and related mappers
All checks were successful
Frontend CI / build (push) Successful in 1m12s

This commit is contained in:
SquidSpirit 2025-08-01 12:49:36 +08:00
parent e8f7f96677
commit 8f8857ee8e
4 changed files with 4 additions and 4 deletions

View File

@ -8,7 +8,7 @@ pub struct ImageRequestDto {
impl ImageRequestDto {
pub fn into_entity(self) -> Image {
Image {
id: None,
id: -1,
mime_type: self.mime_type,
data: self.data,
}

View File

@ -1,7 +1,7 @@
use crate::domain::entity::image::Image;
pub struct ImageDbMapper {
pub id: Option<i32>,
pub id: i32,
pub mime_type: String,
}

View File

@ -1,5 +1,5 @@
pub struct Image {
pub id: Option<i32>,
pub id: i32,
pub mime_type: String,
pub data: Vec<u8>,
}

View File

@ -54,7 +54,7 @@ impl ImageDbService for ImageDbServiceImpl {
match image_record {
Ok(record) => match record {
Some(record) => Ok(ImageDbMapper {
id: Some(record.id),
id: record.id,
mime_type: record.mime_type,
}),
None => Err(ImageError::NotFound),