feat(intake): wowplatter/v1 intake carries est_market_value (DealGod target from PRICEGOD)
PRICEGOD's overlay quick-add posts the DealGod target/median; store it on inventory.est_market_value so the value lens lights up on staged stock. Verified: intake w/ est_market_value=45.53 → staged row.
This commit is contained in:
parent
03be6bb67f
commit
56eab72c9c
@ -60,6 +60,7 @@ class IntakeIn(BaseModel):
|
||||
sleeve: str | None = None
|
||||
notes: str | None = None
|
||||
price: float | None = None
|
||||
est_market_value: float | None = None # DealGod target/median, carried from the PRICEGOD overlay
|
||||
sku: str | None = None
|
||||
kind: str = "vinyl"
|
||||
|
||||
@ -85,17 +86,18 @@ async def inventory_intake(body: IntakeIn, ident=Depends(require_token), db=Depe
|
||||
sku = body.sku or _new_sku()
|
||||
await db.execute(text("""
|
||||
INSERT INTO inventory (sku, store_id, kind, release_id, identifier, title, price,
|
||||
condition, sleeve_cond, weight_g, notes, staged, status)
|
||||
condition, sleeve_cond, weight_g, notes, est_market_value, staged, status)
|
||||
VALUES (:sku, :sid, :kind, :rid, :ident, :title, :price,
|
||||
:cond, :sleeve, :wt, :notes, true, 'staged')
|
||||
:cond, :sleeve, :wt, :notes, :emv, true, 'staged')
|
||||
ON CONFLICT (sku) DO UPDATE SET
|
||||
release_id = EXCLUDED.release_id, title = EXCLUDED.title, price = EXCLUDED.price,
|
||||
condition = EXCLUDED.condition, sleeve_cond = EXCLUDED.sleeve_cond,
|
||||
notes = EXCLUDED.notes, updated_at = now()
|
||||
notes = EXCLUDED.notes, est_market_value = EXCLUDED.est_market_value, updated_at = now()
|
||||
"""), {
|
||||
"sku": sku, "sid": ident["store_id"], "kind": body.kind, "rid": body.release_id,
|
||||
"ident": body.identifier, "title": title, "price": body.price,
|
||||
"cond": body.condition, "sleeve": body.sleeve, "wt": weight, "notes": body.notes,
|
||||
"emv": body.est_market_value,
|
||||
})
|
||||
await db.commit()
|
||||
return {"ok": True, "sku": sku, "staged": True,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user