BLOG-125 Get post by sementic ID #134
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "BLOG-125_semantic_post_id"
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
Backend
String and interger can be pass as
id
toGET
/post/{id}
For the posts existed, the default
semantic_id
for them will be_id
. (e.g._1
,_2
)Semantic ID should follow the rules:
It shouldn't be an integer
It should match the pattern:
^[0-9a-zA-Z_\-]+$
i
i
ii
ii
ii
Frontend
Package Changes
Screenshots
Reference
Resolves #125.
Checklist
/improve
PR Code Suggestions ✨
Correct HTTP status codes for errors
The API handlers return
500 Internal Server Error
forPostError::NotFound
andPostError::InvalidSemanticId
. This is incorrect and misleading for client-sideerrors.
PostError::NotFound
should return404 Not Found
, andPostError::InvalidSemanticId
should return400 Bad Request
. Ensure consistent andappropriate HTTP status codes across all handlers.
backend/feature/post/src/framework/web/create_label_handler.rs [37-40]
Suggestion importance[1-10]: 10
__
Why: Returning
500 Internal Server Error
forPostError::NotFound
andPostError::InvalidSemanticId
is incorrect.404 Not Found
and400 Bad Request
are the appropriate HTTP status codes, respectively, for these client-side errors, which is crucial for correct API behavior.Align struct name with trait
The struct
GetPostIdBySemanticIdUseCaseImpl
is named inconsistently with its traitGetPostBySemanticIdUseCase
and its actual functionality, which is to retrieve thefull post, not just its ID. Rename the struct to
GetPostBySemanticIdUseCaseImpl
toaccurately reflect its purpose.
backend/feature/post/src/application/use_case/get_post_by_sementic_id_use_case.rs [18]
Suggestion importance[1-10]: 8
__
Why: The struct
GetPostIdBySemanticIdUseCaseImpl
is inconsistently named with its traitGetPostBySemanticIdUseCase
and its actual functionality, which retrieves the full post, not just its ID. Renaming it toGetPostBySemanticIdUseCaseImpl
improves clarity and consistency.Correct typo in module name
The module name
get_post_by_sementic_id_use_case
contains a typo. It should beget_post_by_semantic_id_use_case
for correct spelling and consistency. This alsorequires renaming the corresponding file
backend/feature/post/src/application/use_case/get_post_by_sementic_id_use_case.rs
.backend/feature/post/src/application/use_case.rs [6]
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies a typo in the module name
get_post_by_sementic_id_use_case
, which should beget_post_by_semantic_id_use_case
. This improves code consistency and readability, and the suggestion correctly notes the need to rename the corresponding file.Addressed in
c0fe4585ba
.Addressed in
9862850d28
.WIP: Get post by sementic IDto Get post by sementic IDGet post by sementic IDto BLOG-125 Get post by sementic ID