orders: cast cadence order_count to int — BigInt broke every recurring merchant
ci / lint-test (push) Successful in 43s
ci / lint-test (push) Successful in 43s
order_merchant_cadence.order_count is a count(*), so BIGINT, and JSON.stringify throws on it: 'Do not know how to serialize a BigInt', a 500 carrying no SQL. It fires only where a cadence EXISTS, so the failure hid behind the merchant_entity_id fault and reappeared the moment that was fixed — St. Ali (40 orders, 14-day cadence) still 500'd while Amazon opened fine.
This commit is contained in:
@@ -399,7 +399,13 @@ export async function getOrderDetail(entityKey: string): Promise<OrderDetail | n
|
||||
ctx.content_class,
|
||||
COALESCE(me2.canonical_name, ctx.counterparty, o.platform) AS display_name,
|
||||
rec.cadence_days,
|
||||
rec.order_count
|
||||
-- ::int is mandatory. order_merchant_cadence.order_count is a
|
||||
-- count(*), so BIGINT, and JSON.stringify throws outright on a
|
||||
-- BigInt — "Do not know how to serialize a BigInt", a 500 with no
|
||||
-- SQL in it. It only fires on merchants that HAVE a cadence, so
|
||||
-- most orders open fine and the recurring ones die; testing one
|
||||
-- arbitrary order will not find it.
|
||||
rec.order_count::int AS order_count
|
||||
FROM entities e
|
||||
JOIN entity_orders o ON o.entity_id = e.id
|
||||
LEFT JOIN entities m ON m.id = o.merchant_entity_id
|
||||
|
||||
Reference in New Issue
Block a user