refactor: 重构 schemas 结构,统一枚举定义
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# Backend Schemas Restructure Design
|
||||
|
||||
**Goal:** Restructure `backend/src/schemas` into clear domain/shared/enums modules while keeping API contracts in `backend/src/v1/*/schemas.py`.
|
||||
|
||||
**Architecture:** Move reusable validation models and enums into `schemas/domain`, `schemas/shared`, and `schemas/enums.py`. Keep versioned request/response contracts in `v1/*/schemas.py` and update imports to explicit module paths. Remove legacy aggregate exports and duplicate/empty schema directories.
|
||||
|
||||
**Tech Stack:** Python 3.13, Pydantic v2, Ruff, Pytest.
|
||||
|
||||
---
|
||||
|
||||
## Approved decisions
|
||||
|
||||
- Use one-shot hard cut.
|
||||
- Keep API contracts in `backend/src/v1/*/schemas.py`.
|
||||
- Keep `schemas` as reusable constraints only.
|
||||
- Remove implicit root re-export usage.
|
||||
|
||||
## Target structure
|
||||
|
||||
- `backend/src/schemas/enums.py`
|
||||
- `backend/src/schemas/domain/*.py`
|
||||
- `backend/src/schemas/shared/*.py`
|
||||
- `backend/src/v1/*/schemas.py` (unchanged naming and ownership)
|
||||
|
||||
## Validation gates
|
||||
|
||||
- `uv run ruff check ...`
|
||||
- `uv run pytest ...` for impacted suites
|
||||
- `./infra/scripts/dev-migrate.sh migrate`
|
||||
Reference in New Issue
Block a user