From 8405f24a40951e4e175c3f8163ce1405e96e5a5f Mon Sep 17 00:00:00 2001 From: Shaun Hamilton Date: Tue, 12 Aug 2025 08:36:39 +0200 Subject: [PATCH] chore(api): add collections related to exam creator (#61773) --- api/prisma/schema.prisma | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/api/prisma/schema.prisma b/api/prisma/schema.prisma index 823f31abb6b..86206e7365b 100644 --- a/api/prisma/schema.prisma +++ b/api/prisma/schema.prisma @@ -188,6 +188,22 @@ model ExamEnvironmentExam { examAttempts ExamEnvironmentExamAttempt[] } +/// A copy of `ExamEnvironmentExam` used as a staging collection for updates to the curriculum. +/// +/// This collection schema must be kept in sync with `ExamEnvironmentExam`. +model ExamEnvironmentTempExam { + /// Globally unique exam id + id String @id @default(auto()) @map("_id") @db.ObjectId + /// All questions for a given exam + questionSets ExamEnvironmentQuestionSet[] + /// Configuration for exam metadata + config ExamEnvironmentConfig + /// ObjectIds for required challenges/blocks to take the exam + prerequisites String[] @db.ObjectId + /// If `deprecated`, the exam should no longer be considered for users + deprecated Boolean +} + /// A grouping of one or more questions of a given type type ExamEnvironmentQuestionSet { /// Unique question type id @@ -546,3 +562,30 @@ enum ExamEnvironmentExamModerationStatus { /// Attempt has yet to be moderated Pending } + +/// Exam Creator application collection to store authZ users. +/// +/// Currently, this is manually created in order to grant access to the application. +model ExamCreatorUser { + id String @id @default(auto()) @map("_id") @db.ObjectId + email String + /// Unique id from GitHub for an account. + /// + /// Currently, this is unused. Consider removing. + github_id Int? + name String + picture String? + + ExamCreatorSession ExamCreatorSession[] +} + +/// Exam Creator application collection to store auth sessions. +model ExamCreatorSession { + id String @id @default(auto()) @map("_id") @db.ObjectId + user_id String @db.ObjectId + session_id String + /// Expiration date for record. + expires_at DateTime + + ExamCreatorUser ExamCreatorUser @relation(fields: [user_id], references: [id]) +}