From dabdbb74ea290eb09496522d1310bf07289b7961 Mon Sep 17 00:00:00 2001 From: shafi54 <108669266+shafi-aviz@users.noreply.github.com> Date: Sat, 7 Feb 2026 00:10:47 +0530 Subject: [PATCH] enh --- apps/backend/src/lib/post-order-handler.ts | 1 + apps/backend/src/stores/store-initializer.ts | 31 +++++--------------- apps/backend/src/trpc/user-apis/order.ts | 7 +++-- packages/ui/index.ts | 4 +-- 4 files changed, 15 insertions(+), 28 deletions(-) diff --git a/apps/backend/src/lib/post-order-handler.ts b/apps/backend/src/lib/post-order-handler.ts index bd42a86..bdcc218 100644 --- a/apps/backend/src/lib/post-order-handler.ts +++ b/apps/backend/src/lib/post-order-handler.ts @@ -15,6 +15,7 @@ const formatDateTime = (dateStr: string | null | undefined): string => { return new Date(dateStr).toLocaleString('en-IN', { dateStyle: 'medium', timeStyle: 'short', + timeZone: 'Asia/Kolkata', }); }; diff --git a/apps/backend/src/stores/store-initializer.ts b/apps/backend/src/stores/store-initializer.ts index 81052dc..19210c0 100644 --- a/apps/backend/src/stores/store-initializer.ts +++ b/apps/backend/src/stores/store-initializer.ts @@ -19,29 +19,14 @@ export const initializeAllStores = async (): Promise => { try { console.log('Starting application stores initialization...'); - // Initialize role manager - await roleManager.fetchRoles(); - console.log('Role manager initialized successfully'); - - // Compute and store constants in Redis - await computeConstants(); - console.log('Const store initialized successfully'); - - // Initialize product store in Redis - await initializeProducts(); - console.log('Product store initialized successfully'); - - // Initialize product tag store in Redis - await initializeProductTagStore(); - console.log('Product tag store initialized successfully'); - - // Initialize slot store in Redis - await initializeSlotStore(); - console.log('Slot store initialized successfully'); - - // Initialize banner store in Redis - await initializeBannerStore(); - console.log('Banner store initialized successfully'); + await Promise.all([ + roleManager.fetchRoles(), + computeConstants(), + initializeProducts(), + initializeProductTagStore(), + initializeSlotStore(), + initializeBannerStore(), + ]); console.log('All application stores initialized successfully'); } catch (error) { diff --git a/apps/backend/src/trpc/user-apis/order.ts b/apps/backend/src/trpc/user-apis/order.ts index 06ab9b1..75db4b0 100644 --- a/apps/backend/src/trpc/user-apis/order.ts +++ b/apps/backend/src/trpc/user-apis/order.ts @@ -210,7 +210,7 @@ const placeOrderUtil = async (params: { let isFirstOrder = true; for (const [slotId, items] of ordersBySlot) { - const orderTotal = items.reduce( + const subOrderTotal = items.reduce( (sum, item) => { const itemPrice = params.isFlash ? parseFloat((item.product.flashPrice || item.product.price).toString()) @@ -219,9 +219,10 @@ const placeOrderUtil = async (params: { }, 0 ); + const subOrderTotalWithDelivery = subOrderTotal + expectedDeliveryCharge; - const orderGroupProportion = orderTotal / totalAmount; - const orderTotalAmount = isFirstOrder ? totalWithDelivery : totalAmount; + const orderGroupProportion = subOrderTotal / totalAmount; + const orderTotalAmount = isFirstOrder ? subOrderTotalWithDelivery : subOrderTotal; const { finalOrderTotal: finalOrderAmount } = applyDiscountToOrder( orderTotalAmount, diff --git a/packages/ui/index.ts b/packages/ui/index.ts index 97b5828..f27dff5 100755 --- a/packages/ui/index.ts +++ b/packages/ui/index.ts @@ -63,8 +63,8 @@ const isDevMode = Constants.executionEnvironment !== "standalone"; // const BASE_API_URL = API_URL; // const BASE_API_URL = 'http://10.0.2.2:4000'; // const BASE_API_URL = 'http://192.168.100.101:4000'; -// const BASE_API_URL = 'http://192.168.1.3:4000'; -let BASE_API_URL = "https://mf.freshyo.in"; +const BASE_API_URL = 'http://192.168.1.3:4000'; +// let BASE_API_URL = "https://mf.freshyo.in"; // let BASE_API_URL = 'http://192.168.100.104:4000'; // let BASE_API_URL = 'http://192.168.29.176:4000';