65 lines
2.1 KiB
Markdown
65 lines
2.1 KiB
Markdown
# Tasks: Database Models
|
|
|
|
## Task 1: Create project structure and configuration
|
|
- [x] Create `apps/api/src/models/__init__.py`
|
|
- [x] Create `apps/api/src/config.py` with pydantic-settings for database URL
|
|
- [x] Create `apps/api/src/database.py` with async engine and session
|
|
|
|
## Task 2: Create base model
|
|
- [x] Create `apps/api/src/models/base.py` with DeclarativeBase
|
|
- [x] Add UUID primary key mixin
|
|
- [x] Add timestamp mixin (created_at, updated_at)
|
|
|
|
## Task 3: Create User model
|
|
- [x] Create `apps/api/src/models/user.py`
|
|
- [x] Define User with all fields from spec
|
|
- [x] Add relationships to Project, SSHKey, UserConfig
|
|
|
|
## Task 4: Create Project model
|
|
- [x] Create `apps/api/src/models/project.py`
|
|
- [x] Define Project with all fields
|
|
- [x] Add relationships to User, GitRepository, SSHKey
|
|
|
|
## Task 5: Create GitRepository model
|
|
- [x] Create `apps/api/src/models/git_repository.py`
|
|
- [x] Define GitRepository with all fields
|
|
- [x] Add relationships to Project, User
|
|
|
|
## Task 6: Create SSHKey model
|
|
- [x] Create `apps/api/src/models/ssh_key.py`
|
|
- [x] Define SSHKey with all fields
|
|
- [x] Add relationships to User, Project
|
|
|
|
## Task 7: Create UserConfig model
|
|
- [x] Create `apps/api/src/models/user_config.py`
|
|
- [x] Define UserConfig with JSONB config field
|
|
- [x] Add relationship to User
|
|
|
|
## Task 8: Initialize Alembic
|
|
- [x] Create Alembic scaffolding equivalent to `alembic init`
|
|
- [x] Configure `alembic/env.py` for async
|
|
- [x] Update `alembic.ini` with correct URL
|
|
|
|
## Task 9: Create initial migration
|
|
- [x] Generate migration creating all tables
|
|
- [x] Verify migration is correct
|
|
|
|
## Task 10: Create seed script
|
|
- [x] Create `apps/api/src/scripts/seed.py`
|
|
- [x] Add test user and sample data payload helper
|
|
- [x] Make script runnable
|
|
|
|
## Task 11: Create tests
|
|
- [x] Create `apps/api/tests/test_models.py`
|
|
- [x] Test model creation and relationships
|
|
- [x] Test async database operations
|
|
|
|
## Task 12: Run quality gates
|
|
- [x] Run `pytest` - all tests pass
|
|
- [x] Run `mypy .` - no type errors
|
|
- [x] Run `ruff check .` - no lint errors
|
|
|
|
## Runtime Verification
|
|
|
|
- [x] Run migrations against a live PostgreSQL instance to verify end-to-end database execution.
|