Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/services/orders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export async function createOrder({ paymentMethodNonce, cart = [], customer = {}
...(typeof p.price === 'string' ? {price: Number(p.price)} : {})
}));

let promo: Promo, promoUses: number;
let promo: Promo;
if(promoId) {
[promo] = (await sql<Promo[]>`
SELECT *
Expand All @@ -197,8 +197,8 @@ export async function createOrder({ paymentMethodNonce, cart = [], customer = {}
...(typeof p.flatDiscount === 'string' ? {flatDiscount: Number(p.flatDiscount)} : {})
}));

[promoUses] = (await sql`
SELECT count(id) as promoUses
const [promoUses] = (await sql<{promoUses: number}[]>`
SELECT count(id) as promo_uses
FROM orders
WHERE promo_id = ${promoId}
`).map(pu => (pu.promoUses));
Expand Down
Loading