diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 08f59a2..c367e74 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -3537,6 +3537,7 @@ dependencies = [ "quote", "regex", "syn", + "url", ] [[package]] diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 91ce1e9..e6cd1b2 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -30,7 +30,11 @@ sqlx = { version = "0.8.5", features = [ "runtime-tokio-rustls", ] } tokio = { version = "1.45.0", features = ["full"] } -utoipa = { version = "5.4.0", features = ["actix_extras"] } +utoipa = { version = "5.4.0", features = [ + "actix_extras", + "non_strict_integers", + "url", +] } utoipa-redoc = { version = "6.0.0", features = ["actix-web"] } server.path = "server" diff --git a/backend/feature/auth/src/adapter/delivery/user_response_dto.rs b/backend/feature/auth/src/adapter/delivery/user_response_dto.rs index f040f2d..00e0b18 100644 --- a/backend/feature/auth/src/adapter/delivery/user_response_dto.rs +++ b/backend/feature/auth/src/adapter/delivery/user_response_dto.rs @@ -7,6 +7,8 @@ use crate::domain::entity::user::User; pub struct UserResponseDto { pub id: i32, pub displayed_name: String, + + #[schema(format = Email)] pub email: String, } diff --git a/backend/feature/post/src/adapter/delivery/color_request_dto.rs b/backend/feature/post/src/adapter/delivery/color_request_dto.rs index f6838a3..bd15888 100644 --- a/backend/feature/post/src/adapter/delivery/color_request_dto.rs +++ b/backend/feature/post/src/adapter/delivery/color_request_dto.rs @@ -5,16 +5,9 @@ use crate::domain::entity::color::Color; #[derive(Deserialize, ToSchema)] pub struct ColorRequestDto { - #[schema(maximum = 255)] pub red: u8, - - #[schema(maximum = 255)] pub green: u8, - - #[schema(maximum = 255)] pub blue: u8, - - #[schema(maximum = 255)] pub alpha: u8, } diff --git a/backend/feature/post/src/adapter/delivery/color_response_dto.rs b/backend/feature/post/src/adapter/delivery/color_response_dto.rs index 7e64681..274f95a 100644 --- a/backend/feature/post/src/adapter/delivery/color_response_dto.rs +++ b/backend/feature/post/src/adapter/delivery/color_response_dto.rs @@ -5,16 +5,9 @@ use crate::domain::entity::color::Color; #[derive(Serialize, ToSchema)] pub struct ColorResponseDto { - #[schema(maximum = 255)] pub red: u8, - - #[schema(maximum = 255)] pub green: u8, - - #[schema(maximum = 255)] pub blue: u8, - - #[schema(maximum = 255)] pub alpha: u8, } diff --git a/backend/feature/post/src/adapter/delivery/create_post_request_dto.rs b/backend/feature/post/src/adapter/delivery/create_post_request_dto.rs index 053b6a6..c242d0a 100644 --- a/backend/feature/post/src/adapter/delivery/create_post_request_dto.rs +++ b/backend/feature/post/src/adapter/delivery/create_post_request_dto.rs @@ -8,10 +8,12 @@ use crate::domain::entity::{post::Post, post_info::PostInfo}; pub struct CreatePostRequestDto { pub title: String, pub description: String, - pub preview_image_url: String, pub content: String, pub label_ids: Vec, + #[schema(format = Uri)] + pub preview_image_url: String, + #[schema(required, format = DateTime)] pub published_time: Option, } diff --git a/backend/feature/post/src/adapter/delivery/post_info_response_dto.rs b/backend/feature/post/src/adapter/delivery/post_info_response_dto.rs index 176b9c3..1a5e94e 100644 --- a/backend/feature/post/src/adapter/delivery/post_info_response_dto.rs +++ b/backend/feature/post/src/adapter/delivery/post_info_response_dto.rs @@ -10,9 +10,11 @@ pub struct PostInfoResponseDto { pub id: i32, pub title: String, pub description: String, - pub preview_image_url: String, pub labels: Vec, + #[schema(format = Uri)] + pub preview_image_url: String, + #[schema(format = DateTime)] pub published_time: Option, } diff --git a/backend/feature/post/src/adapter/delivery/update_post_request_dto.rs b/backend/feature/post/src/adapter/delivery/update_post_request_dto.rs index 7ae2128..29f96a7 100644 --- a/backend/feature/post/src/adapter/delivery/update_post_request_dto.rs +++ b/backend/feature/post/src/adapter/delivery/update_post_request_dto.rs @@ -8,10 +8,12 @@ use crate::domain::entity::{post::Post, post_info::PostInfo}; pub struct UpdatePostRequestDto { pub title: String, pub description: String, - pub preview_image_url: String, pub content: String, pub label_ids: Vec, + #[schema(format = Uri)] + pub preview_image_url: String, + #[schema(required, format = DateTime)] pub published_time: Option, }