refactor: simplify schedule filtering logic in ScheduleSchema

- Replace complex where clause with a direct reference to args.filter for schedule retrieval.
- This change enhances code readability and maintainability by streamlining the filtering process.
This commit is contained in:
2024-12-01 14:29:39 +07:00
parent 37330e7ab1
commit 111acacf2d

View File

@@ -278,21 +278,7 @@ export class ScheduleSchema extends PothosSchema {
skip: args.skip ?? undefined,
take: args.take ?? undefined,
orderBy: args.orderBy ?? undefined,
where: {
AND: [
{
OR: [
{ managedService: { service: { centerId: center.id } } },
{
managedService: {
service: { center: { centerMentors: { some: { mentorId: ctx.http.me.id } } } },
},
},
],
},
{ managedService: { service: { centerId: center.id } } },
],
},
where: args.filter ?? undefined,
})
},
}),