Complete architectural refactoring from simple MVC to Clean Architecture/DDD pattern: Domain Layer: - Add entities (Post, BaseEntity) with business logic - Add value objects (Title, Content, Slug) with validation - Add repository interfaces (PostRepository) - Add domain exceptions Application Layer: - Add use cases (CreatePost, GetPost, UpdatePost, DeletePost, ListPosts, PublishPost) - Add DTOs for data transfer - Add TransactionManager interface Infrastructure Layer: - Add SQLAlchemy models and async database connection - Add SQLAlchemyPostRepository implementation - Add Dishka DI container with providers - Add error handlers and middleware Presentation Layer: - Add FastAPI routes with Dishka integration - Add Pydantic schemas - Add dependency injection using FromDishka[T] Other Changes: - Remove old flat structure (api/, common/, core/, modules/) - Add hatchling build system for package scripts - Add blog CLI command - Update AGENTS.md with new architecture docs - All 48 tests passing, mypy clean, ruff clean
35 lines
773 B
Python
35 lines
773 B
Python
"""Domain layer exports."""
|
|
|
|
from app.domain.entities import BaseEntity, Post
|
|
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__ = [
|
|
# Entities
|
|
"BaseEntity",
|
|
"Post",
|
|
# Value Objects
|
|
"ValueObject",
|
|
"Title",
|
|
"Content",
|
|
"Slug",
|
|
# Repositories
|
|
"Repository",
|
|
"PostRepository",
|
|
# Exceptions
|
|
"DomainException",
|
|
"ValidationException",
|
|
"NotFoundException",
|
|
"AlreadyExistsException",
|
|
"UnauthorizedException",
|
|
"ForbiddenException",
|
|
]
|