Update quiz.schema.ts
This commit is contained in:
@@ -211,22 +211,13 @@ export class QuizSchema extends PothosSchema {
|
|||||||
if (!centerMentor) {
|
if (!centerMentor) {
|
||||||
throw new Error('Center mentor not found')
|
throw new Error('Center mentor not found')
|
||||||
}
|
}
|
||||||
if (args.scheduleId) {
|
return await this.prisma.quiz.findMany({
|
||||||
const schedule = await this.prisma.schedule.findUnique({
|
...query,
|
||||||
where: { id: args.scheduleId },
|
where: {
|
||||||
})
|
serviceId: args.serviceId,
|
||||||
if (!schedule) {
|
centerMentorId: centerMentor.mentorId,
|
||||||
throw new Error('Schedule not found')
|
},
|
||||||
}
|
})
|
||||||
return await this.prisma.quiz.findMany({
|
|
||||||
...query,
|
|
||||||
where: {
|
|
||||||
serviceId: args.serviceId,
|
|
||||||
centerMentorId: centerMentor.mentorId,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
throw new Error('Schedule ID is required')
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user