From 951d61f3acf975fccdfaef2889251b05a527fc4b Mon Sep 17 00:00:00 2001 From: Ly Tuan Kiet Date: Tue, 3 Dec 2024 21:10:14 +0700 Subject: [PATCH] feat: improve schedule querying with flexible filtering and pagination - Updated ScheduleSchema to enhance the querying logic for schedules by allowing dynamic filtering, ordering, and pagination. - Replaced static customerId filtering with flexible arguments for filtering, ordering, skipping, and taking results. - This change increases the versatility of schedule retrieval based on user-defined criteria. --- src/Schedule/schedule.schema.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Schedule/schedule.schema.ts b/src/Schedule/schedule.schema.ts index bad1c82..4896b5c 100644 --- a/src/Schedule/schedule.schema.ts +++ b/src/Schedule/schedule.schema.ts @@ -266,9 +266,10 @@ export class ScheduleSchema extends PothosSchema { if (ctx.http.me.role === Role.CUSTOMER) { const schedules = await this.prisma.schedule.findMany({ ...query, - where: { - customerId: ctx.http.me.id, - }, + orderBy: args.orderBy ?? undefined, + skip: args.skip ?? undefined, + take: args.take ?? undefined, + where: args.filter ?? undefined, }) return schedules }