diff --git a/prd.json b/prd.json index 51065f0..5e9e67d 100644 --- a/prd.json +++ b/prd.json @@ -104,8 +104,8 @@ "Typecheck passes" ], "priority": 6, - "passes": false, - "notes": "" + "passes": true, + "notes": "Completed: projects.list (filters by clientId + includeArchived via drizzle and()), projects.listAll (id+name only), projects.get (returns null if not found), projects.create (UUID + status='active' + createdAt), projects.update (partial set object), projects.delete (nulls tasks.projectId then deletes project)" }, { "id": "US-007", diff --git a/progress.txt b/progress.txt index 58e4f00..134747d 100644 --- a/progress.txt +++ b/progress.txt @@ -51,6 +51,24 @@ - The `writingMode: 'vertical-rl'` + `transform: 'rotate(180deg)'` CSS pattern creates bottom-to-top text for vertical affordance labels --- +## 2026-02-19 - US-006 +- What was implemented: + - Full `projectsRouter` replacing stubs in `src/main/router/index.ts` + - Added `and` to drizzle-orm imports + - `projects.list`: uses `and()` with optional conditions for `clientId` filter and archived filter (defaults to active only) + - `projects.listAll`: returns only `{ id, name }` columns for dropdown use + - `projects.get`: `.all()` then `result[0] ?? null` pattern for nullable single-record lookup + - `projects.create`: inserts with UUID, status='active', createdAt=Date.now() + - `projects.update`: partial set object — only sets defined fields + - `projects.delete`: nulls `tasks.projectId` for all tasks in the project, then deletes the project +- Files changed: `src/main/router/index.ts`, `prd.json`, `progress.txt` +- **Learnings for future iterations:** + - `and(...conditions)` from drizzle-orm accepts `(SQL | undefined)[]` — pass `undefined` for optional conditions and drizzle filters them out automatically + - For nullable single-record queries: use `.all()` and `result[0] ?? null` (strict mode forbids `.get()` direct null return without this pattern) + - `and()` returns `SQL | undefined` which `.where()` accepts directly (no extra wrapping needed) + +--- + ## 2026-02-19 - US-005 - What was implemented: - Full clients tRPC router replacing stubs in `src/main/router/index.ts`