v0.23.0 — Pantry: structured USED pull logs + move to /api/v1 service layer
Pantry now runs on the v1 API like Inventory/Animals: service layer in src/lib/services/pantry.ts, pure logic + tests in src/lib/pantry/core.ts, thin routes at /api/v1/pantry/* riding the items:* scopes. Pulls write ItemLog type USED with a structured amount (queryable consumption). Bulk-use runs its reads inside the transaction, accumulates repeated pulls, and reports skipped items instead of silently dropping them — the Pull dialog now surfaces those by name. Old /api/pantry routes deleted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
-- AlterEnum
|
||||
ALTER TYPE "ItemLogType" ADD VALUE 'USED';
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "ItemLog" ADD COLUMN "amount" DECIMAL(10,2);
|
||||
@@ -420,6 +420,7 @@ enum ItemLogType {
|
||||
PURCHASED
|
||||
REPAIRED
|
||||
DISPOSED
|
||||
USED // consumable pulled from the pantry; `amount` holds how much
|
||||
}
|
||||
|
||||
model ItemLog {
|
||||
@@ -430,6 +431,7 @@ model ItemLog {
|
||||
date DateTime @default(now())
|
||||
notes String?
|
||||
cost Decimal? @db.Decimal(10, 2)
|
||||
amount Decimal? @db.Decimal(10, 2) // quantity consumed, for USED logs (same unit as the item)
|
||||
actorId String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user