enh
This commit is contained in:
parent
9ac19b0a87
commit
dabdbb74ea
4 changed files with 15 additions and 28 deletions
|
|
@ -15,6 +15,7 @@ const formatDateTime = (dateStr: string | null | undefined): string => {
|
||||||
return new Date(dateStr).toLocaleString('en-IN', {
|
return new Date(dateStr).toLocaleString('en-IN', {
|
||||||
dateStyle: 'medium',
|
dateStyle: 'medium',
|
||||||
timeStyle: 'short',
|
timeStyle: 'short',
|
||||||
|
timeZone: 'Asia/Kolkata',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,29 +19,14 @@ export const initializeAllStores = async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
console.log('Starting application stores initialization...');
|
console.log('Starting application stores initialization...');
|
||||||
|
|
||||||
// Initialize role manager
|
await Promise.all([
|
||||||
await roleManager.fetchRoles();
|
roleManager.fetchRoles(),
|
||||||
console.log('Role manager initialized successfully');
|
computeConstants(),
|
||||||
|
initializeProducts(),
|
||||||
// Compute and store constants in Redis
|
initializeProductTagStore(),
|
||||||
await computeConstants();
|
initializeSlotStore(),
|
||||||
console.log('Const store initialized successfully');
|
initializeBannerStore(),
|
||||||
|
]);
|
||||||
// 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');
|
|
||||||
|
|
||||||
console.log('All application stores initialized successfully');
|
console.log('All application stores initialized successfully');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ const placeOrderUtil = async (params: {
|
||||||
let isFirstOrder = true;
|
let isFirstOrder = true;
|
||||||
|
|
||||||
for (const [slotId, items] of ordersBySlot) {
|
for (const [slotId, items] of ordersBySlot) {
|
||||||
const orderTotal = items.reduce(
|
const subOrderTotal = items.reduce(
|
||||||
(sum, item) => {
|
(sum, item) => {
|
||||||
const itemPrice = params.isFlash
|
const itemPrice = params.isFlash
|
||||||
? parseFloat((item.product.flashPrice || item.product.price).toString())
|
? parseFloat((item.product.flashPrice || item.product.price).toString())
|
||||||
|
|
@ -219,9 +219,10 @@ const placeOrderUtil = async (params: {
|
||||||
},
|
},
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
const subOrderTotalWithDelivery = subOrderTotal + expectedDeliveryCharge;
|
||||||
|
|
||||||
const orderGroupProportion = orderTotal / totalAmount;
|
const orderGroupProportion = subOrderTotal / totalAmount;
|
||||||
const orderTotalAmount = isFirstOrder ? totalWithDelivery : totalAmount;
|
const orderTotalAmount = isFirstOrder ? subOrderTotalWithDelivery : subOrderTotal;
|
||||||
|
|
||||||
const { finalOrderTotal: finalOrderAmount } = applyDiscountToOrder(
|
const { finalOrderTotal: finalOrderAmount } = applyDiscountToOrder(
|
||||||
orderTotalAmount,
|
orderTotalAmount,
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,8 @@ const isDevMode = Constants.executionEnvironment !== "standalone";
|
||||||
// const BASE_API_URL = API_URL;
|
// const BASE_API_URL = API_URL;
|
||||||
// const BASE_API_URL = 'http://10.0.2.2:4000';
|
// 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.100.101:4000';
|
||||||
// const BASE_API_URL = 'http://192.168.1.3:4000';
|
const BASE_API_URL = 'http://192.168.1.3:4000';
|
||||||
let BASE_API_URL = "https://mf.freshyo.in";
|
// 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.100.104:4000';
|
||||||
// let BASE_API_URL = 'http://192.168.29.176:4000';
|
// let BASE_API_URL = 'http://192.168.29.176:4000';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue