7.7 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | requirements | must_haves | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 04-database-planning-fixes | 01 | execute | 1 |
|
true |
|
|
Purpose: DB-01 (threads table exists) and the backend half of PLAN-01 (thread creation works with category). Without this, the planning tab crashes on any thread operation. Output: Working database schema, updated API that accepts categoryId on thread creation, and thread list returns category info.
<execution_context> @/home/jean-luc-makiola/.claude/get-shit-done/workflows/execute-plan.md @/home/jean-luc-makiola/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/ROADMAP.md @.planning/phases/04-database-planning-fixes/04-CONTEXT.mdFrom src/db/schema.ts (threads table -- needs categoryId added):
export const threads = sqliteTable("threads", {
id: integer("id").primaryKey({ autoIncrement: true }),
name: text("name").notNull(),
status: text("status").notNull().default("active"),
resolvedCandidateId: integer("resolved_candidate_id"),
// MISSING: categoryId column
createdAt: integer("created_at", { mode: "timestamp" }).notNull().$defaultFn(() => new Date()),
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull().$defaultFn(() => new Date()),
});
From src/shared/schemas.ts (createThreadSchema -- needs categoryId):
export const createThreadSchema = z.object({
name: z.string().min(1, "Thread name is required"),
// MISSING: categoryId
});
From src/client/hooks/useThreads.ts (ThreadListItem -- needs category fields):
interface ThreadListItem {
id: number;
name: string;
status: "active" | "resolved";
resolvedCandidateId: number | null;
createdAt: string;
updatedAt: string;
candidateCount: number;
minPriceCents: number | null;
maxPriceCents: number | null;
// MISSING: categoryId, categoryName, categoryEmoji
}
-
In
src/shared/schemas.ts, updatecreateThreadSchemato require categoryId:export const createThreadSchema = z.object({ name: z.string().min(1, "Thread name is required"), categoryId: z.number().int().positive(), });Also update
updateThreadSchemato allow optional categoryId:export const updateThreadSchema = z.object({ name: z.string().min(1).optional(), categoryId: z.number().int().positive().optional(), }); -
In
tests/helpers/db.ts, update the threads CREATE TABLE to includecategory_id:CREATE TABLE threads ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, status TEXT NOT NULL DEFAULT 'active', resolved_candidate_id INTEGER, category_id INTEGER NOT NULL REFERENCES categories(id), created_at INTEGER NOT NULL DEFAULT (unixepoch()), updated_at INTEGER NOT NULL DEFAULT (unixepoch()) ) -
Run
bun run db:generateto generate the migration for adding category_id to threads. -
Run
bun run db:pushto apply the migration. cd /home/jean-luc-makiola/Development/projects/GearBox && bun run db:push 2>&1 | tail -5 threads table in schema.ts has categoryId with FK to categories, createThreadSchema requires categoryId, test helper CREATE TABLE matches, db:push succeeds
-
In
src/server/routes/threads.ts:- The route handlers already pass
datathrough from Zod validation, so createThread and updateThread should work with the updated schemas. Verify the PUT handler passes categoryId if present.
- The route handlers already pass
-
In
src/client/hooks/useThreads.ts:- Add
categoryId: number,categoryName: string,categoryEmoji: stringto theThreadListIteminterface. - Update
useCreateThreadmutationFn type to{ name: string; categoryId: number }.
- Add
-
Run existing tests to confirm nothing breaks. cd /home/jean-luc-makiola/Development/projects/GearBox && bun test 2>&1 | tail -20 Thread creation accepts categoryId, getAllThreads returns category name and emoji for each thread, existing tests pass, useCreateThread hook sends categoryId
<success_criteria>
- threads table exists in database with category_id column
- POST /api/threads requires { name, categoryId } and creates a thread
- GET /api/threads returns threads with categoryName and categoryEmoji
- All existing tests pass </success_criteria>