feat(intake): record the background-removal intent and the original path (#281)

Adds the two columns the background-removal feature (#281) is built on: item_drafts.remove_background (boolean, not null, default true) records the submitter's per-submission intent, and item_images.original_image_path (nullable text, no default) records where a cut-out photo came from so it can be restored. The default on remove_background is load-bearing — any row written by a path that does not mention the column behaves like the new default, so no backfill is needed. original_image_path stays null until a photo has actually been cut out, which doubles as the answer to "can this be restored?" rather than needing a separate flag. Also updates the Drizzle mirror in src/db-drizzle/schema.ts by hand (the local dev database was not running to re-pull from) and adds the integration test backgroundRemoval.integration.test.ts, including the exported seedSubmission helper that Task 3 will reuse.

Closes #281

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-03 12:15:38 -05:00
co-authored by Claude Opus 5
parent 1c265840a9
commit 534e3d6228
3 changed files with 91 additions and 0 deletions
+2
View File
@@ -29,6 +29,7 @@ export const itemImages = pgTable("item_images", {
itemId: integer("item_id").notNull(),
imagePath: text("image_path").notNull(),
sortOrder: integer("sort_order").default(0).notNull(),
originalImagePath: text("original_image_path"),
createdAt: timestamp("created_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
}, (table) => [
foreignKey({
@@ -233,6 +234,7 @@ export const itemDrafts = pgTable("item_drafts", {
itemId: integer("item_id").notNull(),
uploadLinkId: integer("upload_link_id"),
submitterNote: text("submitter_note"),
removeBackground: boolean("remove_background").default(true).notNull(),
state: text().default('queued').notNull(),
attempts: integer().default(0).notNull(),
model: text(),