Update quiz.schema.ts

This commit is contained in:
Tyranno
2024-12-09 20:44:39 +07:00
committed by GitHub
parent f1f5918a65
commit 8b40c9ada5

View File

@@ -211,22 +211,13 @@ export class QuizSchema extends PothosSchema {
if (!centerMentor) {
throw new Error('Center mentor not found')
}
if (args.scheduleId) {
const schedule = await this.prisma.schedule.findUnique({
where: { id: args.scheduleId },
})
if (!schedule) {
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')
return await this.prisma.quiz.findMany({
...query,
where: {
serviceId: args.serviceId,
centerMentorId: centerMentor.mentorId,
},
})
}
},
}),