enh
This commit is contained in:
parent
1dca7a3454
commit
6c2b7f9bfd
8 changed files with 4100 additions and 28 deletions
|
|
@ -73,6 +73,11 @@ export default function SlotForm({
|
|||
return;
|
||||
}
|
||||
|
||||
if (values.freezeTime > values.deliveryTime) {
|
||||
Alert.alert('Error', 'Freeze time must be before or equal to delivery time');
|
||||
return;
|
||||
}
|
||||
|
||||
const slotData = {
|
||||
deliveryTime: values.deliveryTime.toISOString(),
|
||||
freezeTime: values.freezeTime.toISOString(),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
ENV_MODE=PROD
|
||||
# DATABASE_URL=postgresql://postgres:meatfarmer_master_password@57.128.212.174:7447/meatfarmer #technocracy
|
||||
DATABASE_URL=postgres://postgres:meatfarmer_master_password@5.223.55.14:7447/meatfarmer #hetzner
|
||||
DATABASE_URL=postgresql://postgres:meatfarmer_master_password@57.128.212.174:7447/meatfarmer #technocracy
|
||||
# DATABASE_URL=postgres://postgres:meatfarmer_master_password@5.223.55.14:7447/meatfarmer #hetzner
|
||||
PHONE_PE_BASE_URL=https://api-preprod.phonepe.com/
|
||||
PHONE_PE_CLIENT_ID=TEST-M23F2IGP34ZAR_25090
|
||||
PHONE_PE_CLIENT_VERSION=1
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -61,20 +61,6 @@ export async function initializeSlotStore(): Promise<void> {
|
|||
orderBy: asc(deliverySlotInfo.deliveryTime),
|
||||
});
|
||||
|
||||
const allSlots = await db.query.deliverySlotInfo.findMany({
|
||||
where: and(
|
||||
eq(deliverySlotInfo.isActive, true),
|
||||
gt(deliverySlotInfo.deliveryTime, now), // Only future slots
|
||||
)
|
||||
})
|
||||
|
||||
console.log(allSlots)
|
||||
|
||||
slots.forEach(slot => {
|
||||
console.log({id: slot.id, delivery: dayjs(slot.deliveryTime).format('MM-DD-YY hh:mm:ss a')})
|
||||
})
|
||||
|
||||
|
||||
// Transform data for storage
|
||||
const slotsWithProducts = await Promise.all(
|
||||
slots.map(async (slot) => ({
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ const applyDiscountToOrder = (
|
|||
const discount = Math.min(
|
||||
(orderTotal *
|
||||
parseFloat(appliedCoupon.discountPercent.toString())) /
|
||||
100,
|
||||
100,
|
||||
appliedCoupon.maxValue
|
||||
? parseFloat(appliedCoupon.maxValue.toString()) * proportion
|
||||
: Infinity
|
||||
|
|
@ -134,8 +134,9 @@ const placeOrderUtil = async (params: {
|
|||
CONST_KEYS.flashDeliveryCharge,
|
||||
]);
|
||||
|
||||
const minOrderValue = constants[CONST_KEYS.minRegularOrderValue] ?? 0;
|
||||
const deliveryCharge = constants[CONST_KEYS.deliveryCharge] ?? 0;
|
||||
const isFlashDelivery = params.isFlash;
|
||||
const minOrderValue = (isFlashDelivery ? constants[CONST_KEYS.flashFreeDeliveryThreshold] : constants[CONST_KEYS.minRegularOrderValue]) || 0;
|
||||
const deliveryCharge = (isFlashDelivery ? constants[CONST_KEYS.flashDeliveryCharge] : constants[CONST_KEYS.deliveryCharge]) || 0;
|
||||
|
||||
const orderGroupId = `${Date.now()}-${userId}`;
|
||||
|
||||
|
|
@ -426,7 +427,7 @@ export const orderRouter = router({
|
|||
slotId: null as any, // Type override for flash delivery
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
return await placeOrderUtil({
|
||||
userId,
|
||||
selectedItems: processedItems,
|
||||
|
|
@ -518,8 +519,8 @@ export const orderRouter = router({
|
|||
|
||||
const signedImages = item.product.images
|
||||
? await generateSignedUrlsFromS3Urls(
|
||||
item.product.images as string[]
|
||||
)
|
||||
item.product.images as string[]
|
||||
)
|
||||
: [];
|
||||
return {
|
||||
productName: item.product.name,
|
||||
|
|
@ -682,8 +683,8 @@ export const orderRouter = router({
|
|||
order.orderItems.map(async (item) => {
|
||||
const signedImages = item.product.images
|
||||
? await generateSignedUrlsFromS3Urls(
|
||||
item.product.images as string[]
|
||||
)
|
||||
item.product.images as string[]
|
||||
)
|
||||
: [];
|
||||
return {
|
||||
productName: item.product.name,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import dayjs from 'dayjs';
|
|||
// Helper method to get formatted slot data by ID
|
||||
async function getSlotData(slotId: number) {
|
||||
const slot = await getSlotByIdFromCache(slotId);
|
||||
|
||||
|
||||
if (!slot) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -48,7 +48,11 @@ export const slotsRouter = router({
|
|||
const allSlots = await getAllSlotsFromCache();
|
||||
const currentTime = new Date();
|
||||
const validSlots = allSlots
|
||||
.filter((slot) => dayjs(slot.freezeTime).isAfter(currentTime) && !slot.isCapacityFull)
|
||||
.filter((slot) => {
|
||||
return dayjs(slot.freezeTime).isAfter(currentTime) &&
|
||||
dayjs(slot.deliveryTime).isAfter(currentTime) &&
|
||||
!slot.isCapacityFull;
|
||||
})
|
||||
.sort((a, b) => dayjs(a.deliveryTime).valueOf() - dayjs(b.deliveryTime).valueOf());
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ 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.100.105:4000';
|
||||
// const BASE_API_URL = 'http://192.168.1.6: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';
|
||||
|
|
|
|||
4076
session-ses_380a.md
Normal file
4076
session-ses_380a.md
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue