feat(journal): add per-user mood journal module (task 86)
Ship journal entries with mood tracking, insights, and Recharts charts. Adds v1 API endpoints per ADR 0005 and migration 0020_journal_entries.
This commit is contained in:
@@ -152,6 +152,32 @@ components:
|
||||
pinned: { type: boolean, default: false }
|
||||
remindAt: { type: string, format: date-time, nullable: true }
|
||||
|
||||
JournalEntry:
|
||||
type: object
|
||||
properties:
|
||||
id: { type: string, format: uuid }
|
||||
householdId: { type: string, format: uuid }
|
||||
userId: { type: string, format: uuid }
|
||||
recordedAt: { type: string, format: date-time }
|
||||
title: { type: string, nullable: true }
|
||||
body: { type: string }
|
||||
moods: { type: array, items: { type: string } }
|
||||
stress: { type: integer, minimum: 1, maximum: 10, nullable: true }
|
||||
pillsTaken: { type: boolean, nullable: true }
|
||||
createdAt: { type: string, format: date-time }
|
||||
updatedAt: { type: string, format: date-time }
|
||||
|
||||
JournalEntryInput:
|
||||
type: object
|
||||
required: [recordedAt]
|
||||
properties:
|
||||
recordedAt: { type: string, format: date-time }
|
||||
title: { type: string, nullable: true }
|
||||
body: { type: string, default: "" }
|
||||
moods: { type: array, items: { type: string }, default: [] }
|
||||
stress: { type: integer, minimum: 1, maximum: 10, nullable: true }
|
||||
pillsTaken: { type: boolean, nullable: true }
|
||||
|
||||
GardenContainer:
|
||||
type: object
|
||||
properties:
|
||||
@@ -820,10 +846,74 @@ paths:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/OkResponse" }
|
||||
|
||||
/api/v1/journal/entries:
|
||||
get:
|
||||
summary: List journal entries for the authenticated user
|
||||
tags: [Journal]
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items: { $ref: "#/components/schemas/JournalEntry" }
|
||||
post:
|
||||
summary: Create journal entry
|
||||
tags: [Journal]
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/JournalEntryInput" }
|
||||
responses:
|
||||
"201":
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/JournalEntry" }
|
||||
|
||||
/api/v1/journal/entries/{id}:
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema: { type: string, format: uuid }
|
||||
get:
|
||||
summary: Get journal entry
|
||||
tags: [Journal]
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/JournalEntry" }
|
||||
patch:
|
||||
summary: Update journal entry
|
||||
tags: [Journal]
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/JournalEntryInput"
|
||||
description: All fields optional
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/JournalEntry" }
|
||||
delete:
|
||||
summary: Delete journal entry
|
||||
tags: [Journal]
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/OkResponse" }
|
||||
|
||||
tags:
|
||||
- name: Calendars
|
||||
- name: Events
|
||||
- name: Lists
|
||||
- name: Notes
|
||||
- name: Journal
|
||||
- name: Garden
|
||||
- name: Bangs
|
||||
|
||||
@@ -33,11 +33,11 @@ P1 personal journaling with mood/stress/pills tracking and stats, without blocki
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- [ ] ADR 0005 accepted.
|
||||
- [ ] Create entry with only date/time.
|
||||
- [ ] Index, detail, mood tracker, and insights views work.
|
||||
- [ ] Journal API endpoints documented and callable with token auth.
|
||||
- [ ] E2E happy path green.
|
||||
- [x] ADR 0005 accepted.
|
||||
- [x] Create entry with only date/time.
|
||||
- [x] Index, detail, mood tracker, and insights views work.
|
||||
- [x] Journal API endpoints documented and callable with token auth.
|
||||
- [x] E2E happy path green (`tests/e2e/journal.spec.ts` — run locally with dev DB).
|
||||
|
||||
## Notes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user