feat: add like/unlike toggle on blog posts with per-user tracking
- PostLike domain entity (post_id, liked_by) with BaseEntity integration
- Post entity: add like_count field (default 0) and to_dict serialization
- PostRepository interface: add get_like, add_like, remove_like methods
- TogglePostLikeUseCase: toggle logic (like → unlike, unlike → like)
- PostResponseDTO/PostResponseSchema: add like_count field
- PostLikeORM model with FK to posts and cascade delete
- SQLAlchemyPostRepository: implement like query/add/remove with ORM mapping
- DI provider registration for TogglePostLikeUseCase
- API endpoint POST /api/v1/posts/{id}/like (auth required)
- Unit tests: PostLike entity, Post.like_count, TogglePostLikeUseCase (7 tests)
- API tests: POST /api/v1/posts/{id}/like (4 tests)
- Test model files: FEATURE_LIKES.md, TEST_MODEL.md updated
This commit is contained in:
@@ -22,6 +22,7 @@ adding new tests.
|
||||
| Post Edit via Web | — | — | — | 40% | P1 | ⚠️ Partial |
|
||||
| Post Delete via Web | — | — | — | 40% | P1 | ⚠️ Partial |
|
||||
| i18n Localization | 100% | — | — | — | P1 | ✅ Active |
|
||||
| Post Likes | 100% | — | 100% | — | P1 | ✅ Active |
|
||||
|
||||
Legend: ✅ Covered / ⚠️ Partial / ❌ Missing / — Not Applicable
|
||||
|
||||
@@ -34,6 +35,7 @@ Legend: ✅ Covered / ⚠️ Partial / ❌ Missing / — Not Applicable
|
||||
| Domain Foundation | [FEATURE_DOMAIN_FOUNDATION.md](FEATURE_DOMAIN_FOUNDATION.md) |
|
||||
| Infrastructure & Bootstrap | [FEATURE_INFRASTRUCTURE.md](FEATURE_INFRASTRUCTURE.md) |
|
||||
| i18n Localization | [FEATURE_INFRASTRUCTURE.md](FEATURE_INFRASTRUCTURE.md) |
|
||||
| Post Likes | [FEATURE_LIKES.md](FEATURE_LIKES.md) |
|
||||
|
||||
## Test Naming Convention
|
||||
|
||||
|
||||
Reference in New Issue
Block a user