BLOG-142 Move label to a new feature #143
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "BLOG-142_move_label_to_new_feature"
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
Package Changes
No response
Screenshots
No response
Reference
Resolves #142.
Checklist
/improve
PR Code Suggestions ✨
Avoid cloning and return full entity
The
label_entity
is cloned before being passed to thecreate_label_use_case
, andthen the ID is manually assigned to the original entity. Consider having the
create_label_use_case
return the completeLabel
entity with the generated ID. Thisapproach avoids unnecessary cloning and simplifies the logic.
backend/feature/label/src/adapter/delivery/label_controller.rs [62-69]
Suggestion importance[1-10]: 8
__
Why: The suggestion proposes a better design by having the
create_label_use_case
return the completeLabel
entity, which avoids unnecessary cloning and simplifies the logic in the controller. This would require changes in theCreateLabelUseCase
trait and its implementation.Return updated entity from use case
The
label_entity
is cloned before theupdate_label_use_case
is executed. If the usecase modifies the entity (e.g., updates a timestamp), these changes will not be
reflected in the
LabelResponseDto
as it's built from the pre-modification entity.The use case should return the updated entity to ensure the response is consistent
with the database state.
backend/feature/label/src/adapter/delivery/label_controller.rs [77-82]
Suggestion importance[1-10]: 8
__
Why: This suggestion improves data consistency by ensuring the
update_label_use_case
returns the potentially modifiedLabel
entity. This prevents theLabelResponseDto
from being created with an outdated entity and avoids unnecessary cloning.Correct error message for unauthorized access
The error message for
LabelError::Unauthorized
incorrectly refers to "post". Thismessage should be updated to reflect the context of a "label" to provide accurate
feedback to users or for logging purposes.
backend/feature/label/src/application/error/label_error.rs [15]
Suggestion importance[1-10]: 7
__
Why: The error message
Unauthorized access to post
is incorrect in the context of alabel
feature. Correcting it toUnauthorized access to label
improves the accuracy and clarity of error reporting.Addressed in
72e944af7b
.BLOG-142 Move `label` to a new featureto BLOG-142 Move label to a new feature