feat: mark list items as bought on tap and record boughtAt

Tapping an item in the list toggles it via a new
PATCH /lists/:listId/items/:itemId endpoint. Marking an item as bought
stores boughtAt (for future stats) and clearing it back to pending
resets the timestamp. The web app updates optimistically and each row is
now a real button with aria-pressed.
This commit is contained in:
Jose Selesan
2026-10-16 10:44:23 -03:00
parent 6aa86a3b68
commit c4f6b8bc85
11 changed files with 315 additions and 31 deletions

View File

@@ -110,15 +110,16 @@ model ShoppingList {
}
model ListItem {
id String @id @default(cuid())
shoppingListId String @map("shopping_list_id")
id String @id @default(cuid())
shoppingListId String @map("shopping_list_id")
name String
completed Boolean @default(false)
quantity String? @map("quantity")
notes String? @map("notes")
order Int @default(0) @map("order")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
completed Boolean @default(false)
boughtAt DateTime? @map("bought_at")
quantity String? @map("quantity")
notes String? @map("notes")
order Int @default(0) @map("order")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
shoppingList ShoppingList @relation(fields: [shoppingListId], references: [id], onDelete: Cascade)