feat(10-01): add pros/cons columns through backend

- Add pros/cons nullable TEXT columns to threadCandidates schema
- Generate and apply Drizzle migration (0004_soft_synch.sql)
- Mirror pros/cons columns in test helper CREATE TABLE
- createCandidate: pass pros/cons to values() object
- updateCandidate: add pros/cons to Partial type
- getThreadWithCandidates: include pros/cons in select projection
- createCandidateSchema: add optional pros/cons string fields
This commit is contained in:
2026-03-16 21:32:38 +01:00
parent 719f7082da
commit 7a64a1887d
4 changed files with 12 additions and 0 deletions

View File

@@ -73,6 +73,8 @@ export function getThreadWithCandidates(db: Db = prodDb, threadId: number) {
productUrl: threadCandidates.productUrl,
imageFilename: threadCandidates.imageFilename,
status: threadCandidates.status,
pros: threadCandidates.pros,
cons: threadCandidates.cons,
createdAt: threadCandidates.createdAt,
updatedAt: threadCandidates.updatedAt,
categoryName: categories.name,
@@ -151,6 +153,8 @@ export function createCandidate(
productUrl: data.productUrl ?? null,
imageFilename: data.imageFilename ?? null,
status: data.status ?? "researching",
pros: data.pros ?? null,
cons: data.cons ?? null,
})
.returning()
.get();
@@ -168,6 +172,8 @@ export function updateCandidate(
productUrl: string;
imageFilename: string;
status: "researching" | "ordered" | "arrived";
pros: string;
cons: string;
}>,
) {
const existing = db