2.5 KiB
2.5 KiB
title, status, type, priority, tags, created_at, updated_at, parent
| title | status | type | priority | tags | created_at | updated_at | parent | |
|---|---|---|---|---|---|---|---|---|
| Backend: Journal entries model, API, and migration | completed | task | normal |
|
2026-03-20T15:15:48Z | 2026-03-20T15:30:47Z | nuzlocke-tracker-mz16 |
Create the backend infrastructure for session journal entries.
Data Model
journal_entries table:
id(UUID, PK)run_id(FK to runs)boss_result_id(FK to boss_results, nullable) — optional link to a boss battletitle(str, required)body(text, required) — raw markdown contentcreated_at,updated_at(timestamps)
Checklist
- Create Alembic migration for
journal_entriestable - Create
JournalEntrySQLAlchemy model with relationships toRunandBossResult - Create Pydantic schemas (
JournalEntryCreate,JournalEntryUpdate,JournalEntryResponse) - Create CRUD operations for journal entries
- Create API endpoints under
/runs/{run_id}/journal:GET /— list entries for a run (ordered by created_at desc)POST /— create entryGET /{entry_id}— get single entryPUT /{entry_id}— update entryDELETE /{entry_id}— delete entry
- Add optional
boss_result_idquery filter to GET list endpoint
Summary of Changes
Implemented backend infrastructure for session journal entries:
Files created:
backend/src/app/alembic/versions/k2f3a4b5c6d7_add_journal_entries_table.py- Migration creatingjournal_entriestable with UUID PK, foreign keys tonuzlocke_runsandboss_results, and timestamp columnsbackend/src/app/models/journal_entry.py- SQLAlchemy model with relationships toNuzlockeRunandBossResultbackend/src/app/schemas/journal_entry.py- Pydantic schemas for create, update, and responsebackend/src/app/api/journal_entries.py- API endpoints for CRUD operations
Files modified:
backend/src/app/models/nuzlocke_run.py- Addedjournal_entriesrelationshipbackend/src/app/models/__init__.py- ExportedJournalEntrybackend/src/app/schemas/__init__.py- Exported journal entry schemasbackend/src/app/api/routes.py- Registered journal entries router
API Endpoints:
GET /runs/{run_id}/journal- List entries (supportsboss_result_idfilter)POST /runs/{run_id}/journal- Create entryGET /runs/{run_id}/journal/{entry_id}- Get single entryPUT /runs/{run_id}/journal/{entry_id}- Update entryDELETE /runs/{run_id}/journal/{entry_id}- Delete entry