(problemId: string)
| 412 | } |
| 413 | } |
| 414 | export async function getAllMCQsForProblem(problemId: string) { |
| 415 | const value = await cache.get("getAllMCQsForProblem", [problemId.toString()]); |
| 416 | if (value) { |
| 417 | return value; |
| 418 | } |
| 419 | try { |
| 420 | const mcqs = await db.mCQQuestion.findMany({ |
| 421 | where: { |
| 422 | problemId, |
| 423 | }, |
| 424 | }); |
| 425 | await cache.set("getAllMCQsForProblem", [problemId.toString()], mcqs); |
| 426 | return mcqs; |
| 427 | } catch (e) { |
| 428 | return []; |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | export async function createQuizScore(data: { userId: string; score: number; problemId: string }) { |
| 433 | const submission = await db.quizScore.create({ |
no test coverage detected