BLOG-104 Implement CRUD functionality for Posts #108
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "BLOG-104_post_create_and_update_routes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
This pull request introduces the core functionality for creating and updating posts, completing the backend CRUD operations for the
post
feature. It includes new API endpoints, database schema changes, and corresponding updates across the entire application stack from the database layer to the frontend.Backend API
POST /post
: To create a new post.PUT /post/{id}
: To update an existing post.CreatePostUseCase
andUpdatePostUseCase
.Database
"order"
column in thepost_label
table.API Schema & Documentation
utoipa
OpenAPI documentation with more specific formats for data types:#[schema(format = Uri)]
for URLs likepreview_image_url
.#[schema(format = Email)]
for user emails.#[schema(format = DateTime)]
for timestamps.published_time
field to use the RFC3339 string format instead of a numeric timestamp, improving API clarity and interoperability.Frontend
PostInfoResponseDto
in the frontend to correctly parse the newDateTime
(ISO string) format forpublished_time
.Refactoring
get_full_post
to a more descriptiveget_post_by_id
across the post feature module for better code clarity.Package Changes
Screenshots
No response
Reference
Resolves #104
Checklist
/improve
PR Code Suggestions ✨
Align API schema with data type
The
published_time
field is marked asrequired
in the OpenAPI schema, but its Rusttype
Option
indicates it's optional. This creates an inconsistency in the APIcontract. To resolve this, either remove
#[schema(required)]
if the field can beomitted, or change the type to
String
if it must always be provided by the client.backend/feature/post/src/adapter/delivery/create_post_request_dto.rs [17-18]
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies an inconsistency where the
published_time
field is marked asrequired
in the OpenAPI schema but is anOption<String>
in Rust. This can lead to misleading API documentation and incorrect client expectations.BLOG-104_post_create_and_update_routesto BLOG-104 Implement CRUD functionality for PostsA
null
published_time represents as unpublished, which should be explicit.