feat: add FastAPI, Entity base class, and health check endpoint
This commit is contained in:
@@ -1,27 +1,18 @@
|
||||
# Plan: UserId Value Object
|
||||
# Plan: Add FastAPI to the Project
|
||||
|
||||
## Status: COMPLETED
|
||||
## Goal
|
||||
Add FastAPI as the web framework with a minimal health check endpoint.
|
||||
|
||||
## Objective
|
||||
Create a UserId value object in the marketplace domain with an immutable UUID value.
|
||||
## Changes
|
||||
|
||||
## Decisions Made
|
||||
- **Location**: `domain/marketplace/user_id.py`
|
||||
- **Class style**: `@dataclass(frozen=True)` for immutability
|
||||
- **Tests**: Yes
|
||||
### 1. Dependencies
|
||||
- Add `fastapi` and `uvicorn[standard]` to `pyproject.toml` under `[project.dependencies]`
|
||||
- Install dependencies into the virtual environment
|
||||
|
||||
## Value Object Structure
|
||||
```python
|
||||
@dataclass(frozen=True)
|
||||
class UserId:
|
||||
value: UUID
|
||||
```
|
||||
### 2. Application Entry Point
|
||||
- Create `main.py` with a FastAPI app instance
|
||||
- Add a health check endpoint (`GET /`) that returns `{"status": "ok"}`
|
||||
|
||||
## Files Created
|
||||
- `domain/marketplace/user_id.py`
|
||||
- `tests/test_user_id.py`
|
||||
|
||||
## Test Results
|
||||
- `test_user_id_creation` - PASSED
|
||||
- `test_user_id_is_immutable` - PASSED
|
||||
- `test_user_id_equality` - PASSED
|
||||
## Verification
|
||||
- `pytest tests/` — all tests pass
|
||||
- `uvicorn main:app --reload` — server starts and health endpoint responds
|
||||
Reference in New Issue
Block a user