Compare commits
No commits in common. "6bcf0805930fbf934ca59489ed9c281cbd832c42" and "1dca7a34548c9f8d386f4bf07fdd7d68b244ec03" have entirely different histories.
6bcf080593
...
1dca7a3454
7 changed files with 28 additions and 24 deletions
|
|
@ -73,11 +73,6 @@ 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,6 +61,20 @@ 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,9 +134,8 @@ const placeOrderUtil = async (params: {
|
|||
CONST_KEYS.flashDeliveryCharge,
|
||||
]);
|
||||
|
||||
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 minOrderValue = constants[CONST_KEYS.minRegularOrderValue] ?? 0;
|
||||
const deliveryCharge = constants[CONST_KEYS.deliveryCharge] ?? 0;
|
||||
|
||||
const orderGroupId = `${Date.now()}-${userId}`;
|
||||
|
||||
|
|
@ -519,8 +518,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,
|
||||
|
|
@ -683,8 +682,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,
|
||||
|
|
|
|||
|
|
@ -48,11 +48,7 @@ export const slotsRouter = router({
|
|||
const allSlots = await getAllSlotsFromCache();
|
||||
const currentTime = new Date();
|
||||
const validSlots = allSlots
|
||||
.filter((slot) => {
|
||||
return dayjs(slot.freezeTime).isAfter(currentTime) &&
|
||||
dayjs(slot.deliveryTime).isAfter(currentTime) &&
|
||||
!slot.isCapacityFull;
|
||||
})
|
||||
.filter((slot) => dayjs(slot.freezeTime).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.1.6:4000';
|
||||
// const BASE_API_URL = 'http://192.168.100.105: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';
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue