fix(admin): resolve notification and cash-close 500s

This commit is contained in:
Deploy
2026-08-25 22:16:08 +02:00
parent ed031f8a94
commit ae42bae61e
13 changed files with 22 additions and 23 deletions

View File

@@ -547,7 +547,6 @@ export async function registerOrdersRoutes(
FROM orders_orders o
LEFT JOIN identity_users u ON u.id = o.user_id
WHERE o.state = 'AWAITING_PAYMENT'
AND o.deleted_at IS NULL
ORDER BY o.created_at ASC
LIMIT 20`,
);

View File

@@ -698,15 +698,15 @@ export async function registerPosRoutes(app: FastifyInstance, deps: PosRouteDeps
[id],
),
pool.query<{ method_code: string; method_name: string; total: string; count: string }>(
`SELECT pm.code AS method_code, pm.name AS method_name,
`SELECT pm.code AS method_code, pm.label AS method_name,
COALESCE(SUM(pt.amount_cents), 0)::bigint AS total,
COUNT(*)::int AS count
FROM payments_transactions pt
JOIN orders_orders o ON o.id = pt.order_id
LEFT JOIN pos_payment_methods pm ON pm.id = pt.provider_event_id
LEFT JOIN pos_payment_methods pm ON pm.id::text = pt.provider_event_id
AND pm.store_id = o.store_id
WHERE o.cash_session_id = $1 AND o.source = 'pos' AND pt.status = 'succeeded'
GROUP BY pm.code, pm.name`,
GROUP BY pm.code, pm.label`,
[id],
),
pool.query<{ items_count: string; unique_products: string }>(
@@ -770,15 +770,15 @@ export async function registerPosRoutes(app: FastifyInstance, deps: PosRouteDeps
[id],
),
pool.query<{ method_code: string; method_name: string; total: string; count: string }>(
`SELECT pm.code AS method_code, pm.name AS method_name,
`SELECT pm.code AS method_code, pm.label AS method_name,
COALESCE(SUM(pt.amount_cents), 0)::bigint AS total,
COUNT(*)::int AS count
FROM payments_transactions pt
JOIN orders_orders o ON o.id = pt.order_id
LEFT JOIN pos_payment_methods pm ON pm.id = pt.provider_event_id
LEFT JOIN pos_payment_methods pm ON pm.id::text = pt.provider_event_id
AND pm.store_id = o.store_id
WHERE o.cash_session_id = $1 AND o.source = 'pos' AND pt.status = 'succeeded'
GROUP BY pm.code, pm.name`,
GROUP BY pm.code, pm.label`,
[id],
),
pool.query<{ items_count: string; unique_products: string }>(