feat(08-01): add status column to threadCandidates and wire through backend

- Schema: status TEXT NOT NULL DEFAULT 'researching' on thread_candidates
- Zod: candidateStatusSchema enum (researching/ordered/arrived) added to createCandidateSchema
- Service: getThreadWithCandidates selects status, createCandidate sets status, updateCandidate accepts status
- Client hooks: CandidateWithCategory and CandidateResponse types include status field
- Migration generated and applied

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 14:09:18 +01:00
parent 9342085dd1
commit ca1c2a2e57
8 changed files with 512 additions and 19 deletions

View File

@@ -72,6 +72,7 @@ export function getThreadWithCandidates(db: Db = prodDb, threadId: number) {
notes: threadCandidates.notes,
productUrl: threadCandidates.productUrl,
imageFilename: threadCandidates.imageFilename,
status: threadCandidates.status,
createdAt: threadCandidates.createdAt,
updatedAt: threadCandidates.updatedAt,
categoryName: categories.name,
@@ -149,6 +150,7 @@ export function createCandidate(
notes: data.notes ?? null,
productUrl: data.productUrl ?? null,
imageFilename: data.imageFilename ?? null,
status: data.status ?? "researching",
})
.returning()
.get();
@@ -165,6 +167,7 @@ export function updateCandidate(
notes: string;
productUrl: string;
imageFilename: string;
status: "researching" | "ordered" | "arrived";
}>,
) {
const existing = db