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) {
|
if (ctx.http.me.role === Role.CUSTOMER) {
|
||||||
const schedules = await this.prisma.schedule.findMany({
|
const schedules = await this.prisma.schedule.findMany({
|
||||||
...query,
|
...query,
|
||||||
where: {
|
orderBy: args.orderBy ?? undefined,
|
||||||
customerId: ctx.http.me.id,
|
skip: args.skip ?? undefined,
|
||||||
},
|
take: args.take ?? undefined,
|
||||||
|
where: args.filter ?? undefined,
|
||||||
})
|
})
|
||||||
return schedules
|
return schedules
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user