enh
This commit is contained in:
parent
b4a1874e55
commit
77e2d92d71
2 changed files with 5 additions and 4 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import { router, publicProcedure, protectedProcedure } from '../trpc-index';
|
import { router, publicProcedure, protectedProcedure } from '../trpc-index';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
import { db } from '../../db/db_index';
|
import { db } from '../../db/db_index';
|
||||||
import { vendorSnippets, deliverySlotInfo, productInfo, orders, orderItems, users, orderStatus } from '../../db/schema';
|
import { vendorSnippets, deliverySlotInfo, productInfo, orders, orderItems, users, orderStatus } from '../../db/schema';
|
||||||
import { eq, and, inArray, isNotNull, gt, sql, asc, ne } from 'drizzle-orm';
|
import { eq, and, inArray, isNotNull, gt, sql, asc, ne } from 'drizzle-orm';
|
||||||
|
|
@ -336,11 +337,11 @@ export const vendorSnippetsRouter = router({
|
||||||
|
|
||||||
getUpcomingSlots: publicProcedure
|
getUpcomingSlots: publicProcedure
|
||||||
.query(async () => {
|
.query(async () => {
|
||||||
const now = new Date();
|
const threeHoursAgo = dayjs().subtract(3, 'hour').toDate();
|
||||||
const slots = await db.query.deliverySlotInfo.findMany({
|
const slots = await db.query.deliverySlotInfo.findMany({
|
||||||
where: and(
|
where: and(
|
||||||
eq(deliverySlotInfo.isActive, true),
|
eq(deliverySlotInfo.isActive, true),
|
||||||
gt(deliverySlotInfo.deliveryTime, now)
|
gt(deliverySlotInfo.deliveryTime, threeHoursAgo)
|
||||||
),
|
),
|
||||||
orderBy: asc(deliverySlotInfo.deliveryTime),
|
orderBy: asc(deliverySlotInfo.deliveryTime),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,8 @@ const isDevMode = Constants.executionEnvironment !== "standalone";
|
||||||
// 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.14:4000';
|
// const BASE_API_URL = 'http://192.168.1.14: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.103:4000';
|
// let BASE_API_URL = 'http://192.168.100.103:4000';
|
||||||
// let BASE_API_URL = 'http://192.168.29.219:4000';
|
// let BASE_API_URL = 'http://192.168.29.219:4000';
|
||||||
|
|
||||||
// if(isDevMode) {
|
// if(isDevMode) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue