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.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user