(problemId: string)
| 356 | } |
| 357 | |
| 358 | export async function getAllMCQQuestion(problemId: string) { |
| 359 | const value = await cache.get("getAllMCQQuestion", [problemId.toString()]); |
| 360 | if (value) { |
| 361 | return value; |
| 362 | } |
| 363 | try { |
| 364 | const mcqs = await db.mCQQuestion.findMany({ |
| 365 | where: { |
| 366 | problemId, |
| 367 | }, |
| 368 | }); |
| 369 | await cache.set("getAllMCQQuestion", [problemId.toString()], mcqs); |
| 370 | return mcqs; |
| 371 | } catch (e) { |
| 372 | return []; |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | export async function createMCQ(data: Omit<MCQQuestion, "id">) { |
| 377 | try { |