From cce1d25cea452b64b7cfddd6df2e03a45efe05cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Bu=CC=88chele?= Date: Mon, 29 Jul 2024 18:05:41 +0100 Subject: [PATCH] use device time --- src/routes/kultCash.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/routes/kultCash.ts b/src/routes/kultCash.ts index 194719d..c1e0e31 100644 --- a/src/routes/kultCash.ts +++ b/src/routes/kultCash.ts @@ -194,10 +194,16 @@ app.post('/log', async (c) => { ); } - const orderCreate = + const orderCreate: Prisma.OrderCreateInput | undefined = order != null ? { payment: mapPayment(order.paymentMethod), + createdAt: deviceTime, + device: { + connect: { + id: deviceId, + }, + }, items: { createMany: { data: order.cartItems @@ -258,10 +264,7 @@ app.post('/log', async (c) => { if (!cardTransaction && orderCreate) { // manually create order, because it's not part of a card transaction await prismaClient.order.create({ - data: { - ...orderCreate, - deviceId, - }, + data: orderCreate, }); }