- 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
36 lines
846 B
Python
36 lines
846 B
Python
"""Domain layer exports.
|
|
|
|
This module re-exports all domain layer components including
|
|
entities, value objects, repositories, and exceptions.
|
|
"""
|
|
|
|
from app.domain.entities import BaseEntity, Post, PostLike
|
|
from app.domain.exceptions import (
|
|
AlreadyExistsException,
|
|
DomainException,
|
|
ForbiddenException,
|
|
NotFoundException,
|
|
UnauthorizedException,
|
|
ValidationException,
|
|
)
|
|
from app.domain.repositories import PostRepository, Repository
|
|
from app.domain.value_objects import Content, Slug, Title, ValueObject
|
|
|
|
__all__ = [
|
|
"BaseEntity",
|
|
"Post",
|
|
"PostLike",
|
|
"ValueObject",
|
|
"Title",
|
|
"Content",
|
|
"Slug",
|
|
"Repository",
|
|
"PostRepository",
|
|
"DomainException",
|
|
"ValidationException",
|
|
"NotFoundException",
|
|
"AlreadyExistsException",
|
|
"UnauthorizedException",
|
|
"ForbiddenException",
|
|
]
|