BLOG-104 Implement CRUD functionality for Posts #108

Merged
squid merged 5 commits from BLOG-104_post_create_and_update_routes into main 2025-08-02 14:35:27 +08:00
8 changed files with 17 additions and 18 deletions
Showing only changes of commit 451951f22a - Show all commits

1
backend/Cargo.lock generated
View File

@ -3537,6 +3537,7 @@ dependencies = [
"quote",
"regex",
"syn",
"url",
]
[[package]]

View File

@ -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"

View File

@ -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,
}

View File

@ -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,
}

View File

@ -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,
}

View File

@ -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<i32>,
#[schema(format = Uri)]
pub preview_image_url: String,
#[schema(required, format = DateTime)]
pub published_time: Option<String>,
}

View File

@ -10,9 +10,11 @@ pub struct PostInfoResponseDto {
pub id: i32,
pub title: String,
pub description: String,
pub preview_image_url: String,
pub labels: Vec<LabelResponseDto>,
#[schema(format = Uri)]
pub preview_image_url: String,
#[schema(format = DateTime)]
pub published_time: Option<String>,
}

View File

@ -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<i32>,
#[schema(format = Uri)]
pub preview_image_url: String,
#[schema(required, format = DateTime)]
pub published_time: Option<String>,
}