style(13-03): apply Prettier formatting across repo
Mechanical reformat — no logic changes. 398 files changed, 19125 insertions(+), 16457 deletions(-). Prettier 3.8.4 with .prettierrc (singleQuote:true, semi:true, tabWidth:2, trailingComma:all, printWidth:100). Isolated per D-13-08 for reviewability.
This commit is contained in:
@@ -26,11 +26,11 @@ tech-stack:
|
||||
added: []
|
||||
patterns:
|
||||
- "resolveUserId(c): dev-bypass c.get('user') first, fallback to getAuth(c) for OIDC — same pattern as me.ts"
|
||||
- "Enqueue-only write endpoints: no Fastmail call in routes; db.insert(calendarOutbox) is the only side effect"
|
||||
- "Edit-as-move: db.transaction with paired delete+create sharing a groupId (D-04)"
|
||||
- "sync-status: .orderBy(desc(createdAt)).limit(1) to get latest outbox row; userId-scoped (T-03-07)"
|
||||
- "writable-calendars: WHERE userId=currentUser.id OR isShared=1 — authoritative D-03 enforcement (T-03-11)"
|
||||
- "Test mock pattern for db.transaction: factory fn cb receives mock tx with insert; vi.mock hoisted factory captures mutable refs"
|
||||
- 'Enqueue-only write endpoints: no Fastmail call in routes; db.insert(calendarOutbox) is the only side effect'
|
||||
- 'Edit-as-move: db.transaction with paired delete+create sharing a groupId (D-04)'
|
||||
- 'sync-status: .orderBy(desc(createdAt)).limit(1) to get latest outbox row; userId-scoped (T-03-07)'
|
||||
- 'writable-calendars: WHERE userId=currentUser.id OR isShared=1 — authoritative D-03 enforcement (T-03-11)'
|
||||
- 'Test mock pattern for db.transaction: factory fn cb receives mock tx with insert; vi.mock hoisted factory captures mutable refs'
|
||||
- "devAuthBypass mock in tests: vi.mock('../auth/devBypass.js') injects dev user so write tests get authenticated context"
|
||||
|
||||
key-files:
|
||||
@@ -40,15 +40,15 @@ key-files:
|
||||
- apps/api/tests/routes/events.test.ts
|
||||
|
||||
key-decisions:
|
||||
- "resolveUserId helper uses any type to avoid Hono context generic complexity — acceptable for internal helper"
|
||||
- "Two-query ownership check for edit/delete (get event, then check calendar isShared) to maintain simple from().where() chain that test mocks can intercept without innerJoin complexity"
|
||||
- "Writable-calendars response maps to { url, displayName, color, isShared } — the Plan 05 WritableCalendar shape"
|
||||
- 'resolveUserId helper uses any type to avoid Hono context generic complexity — acceptable for internal helper'
|
||||
- 'Two-query ownership check for edit/delete (get event, then check calendar isShared) to maintain simple from().where() chain that test mocks can intercept without innerJoin complexity'
|
||||
- 'Writable-calendars response maps to { url, displayName, color, isShared } — the Plan 05 WritableCalendar shape'
|
||||
- "sync-status returns { uid, status: 'done' } when no outbox row found (nothing pending = settled)"
|
||||
|
||||
patterns-established:
|
||||
- "Enqueue-only write route: validate → check ownership → db.insert(calendarOutbox) → return 202; no broker call"
|
||||
- "D-03 ownership enforcement at two layers: write endpoints AND writable-calendars listing"
|
||||
- "vi.mock devAuthBypass for write-endpoint tests avoids needing ENV manipulation or OIDC infrastructure"
|
||||
- 'Enqueue-only write route: validate → check ownership → db.insert(calendarOutbox) → return 202; no broker call'
|
||||
- 'D-03 ownership enforcement at two layers: write endpoints AND writable-calendars listing'
|
||||
- 'vi.mock devAuthBypass for write-endpoint tests avoids needing ENV manipulation or OIDC infrastructure'
|
||||
|
||||
requirements-completed: [CAL-04, CAL-05, CAL-06, CAL-07]
|
||||
|
||||
@@ -98,6 +98,7 @@ completed: 2026-06-05
|
||||
### Auto-fixed Issues
|
||||
|
||||
**1. [Rule 1 - Bug] TypeScript error on resolveUserId helper**
|
||||
|
||||
- **Found during:** Task 1 (implementation) — tsc --noEmit reported TS2493/TS2339 on complex Hono context type inference
|
||||
- **Issue:** The helper function tried to infer the Hono context type from `eventsRouter.get` parameters, which failed due to tuple type length mismatch
|
||||
- **Fix:** Changed helper parameter to `any` with inline cast; added clarifying comment
|
||||
@@ -139,5 +140,6 @@ No new network endpoints or auth paths beyond what is in the plan's threat model
|
||||
- Plan 05 (EventForm + client.ts): POST /create, PATCH /:uid/edit, DELETE /:uid endpoints are live; GET /writable-calendars provides the picker data
|
||||
|
||||
---
|
||||
*Phase: 03-event-write-back-pwa-install*
|
||||
*Completed: 2026-06-05*
|
||||
|
||||
_Phase: 03-event-write-back-pwa-install_
|
||||
_Completed: 2026-06-05_
|
||||
|
||||
Reference in New Issue
Block a user