openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: UniVerse Platform API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: auth description: Authentication - name: users description: User management - name: courses description: Course management - name: activities description: Activities and game builder - name: enrollments description: Student enrollments - name: submissions description: Game submissions and scores - name: leaderboard description: Leaderboards - name: marketplace description: Marketplace listings - name: contributors description: Contributor applications - name: course-sections description: Course content sections - name: dashboard description: Dashboard aggregations - name: universities description: Supported universities catalog - name: word-of-the-day description: Per-course Word of the Day game (Wordle-style) - name: quizpop description: | QuizPop live in-class quiz sessions (Kahoot-style). ### WebSocket event contract (`GET /api/ws`) Authentication: same `connect.sid` cookie as the REST API; the upgrade is rejected (4401) on missing/invalid signature, and (4403) on disallowed Origin. All frames are JSON `{ "event": string, "payload": object }`. Every payload includes `sessionId: number`. Client → server (authz noted): - `join { sessionId }` — any authed user. Faculty=host of the session becomes the host socket; otherwise the user must be enrolled in the activity's course and the session must not be `ended`. A participant row is upserted on the first player join. - `advance { sessionId }` — host only. Moves the session into the next question and starts the server-authoritative timer. - `answer { sessionId, questionId, answerId }` — players only, accepted only while session is `in_question` and the timer (+grace) has not elapsed. Idempotent per (participant, question). - `close_question { sessionId }` — host only. Manual early-close (the auto-close timer also closes on expiry). - `end { sessionId }` — host only. Idempotent; awards UniCoins/XP to the top three on first call. Server → client: - `leaderboard { leaderboard: [{ participantId, name, score, rank }] }` — broadcast on join/answer/close. - `question_started { questionIndex, questionCount, timerSeconds, startedAt, question }` — `question.answers` never reveals correctness. - `answer_ack { isCorrect, pointsAwarded }` — to the answering player only. - `question_results { questionIndex, correctAnswerIds, counts: [{ answerId, count }] }` — broadcast on close. - `no_more_questions {}` — host only, after final question. - `session_ended { leaderboard, rewards: [{ userId, uniCoins, xp }] }` — broadcast on `end`. paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /universities: get: operationId: listUniversities tags: [universities] summary: List supported universities responses: "200": description: List of supported universities content: application/json: schema: type: array items: $ref: "#/components/schemas/University" /auth/register: post: operationId: register tags: [auth] summary: Register a new user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterInput" responses: "201": description: Registered content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "409": description: Email already in use content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/login: post: operationId: login tags: [auth] summary: Login requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginInput" responses: "200": description: Logged in content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "401": description: Invalid credentials content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/logout: post: operationId: logout tags: [auth] summary: Logout responses: "200": description: Logged out content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /auth/me: get: operationId: getMe tags: [auth] summary: Get current user responses: "200": description: Current user content: application/json: schema: $ref: "#/components/schemas/User" "401": description: Not authenticated content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/verify-email: post: operationId: verifyEmail tags: [auth] summary: Verify an email address with the 6-digit code requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/VerifyEmailInput" responses: "200": description: Verified content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" "400": description: Invalid or expired code content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/resend-verification: post: operationId: resendVerification tags: [auth] summary: Resend the verification code to the current user responses: "200": description: Sent (or already verified) content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" "401": description: Not authenticated content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/forgot-password: post: operationId: forgotPassword tags: [auth] summary: Send a password-reset code to an email if it exists requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ForgotPasswordInput" responses: "200": description: Always succeeds (does not reveal whether email exists) content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /auth/reset-password: post: operationId: resetPassword tags: [auth] summary: Reset a password using a 6-digit code requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ResetPasswordInput" responses: "200": description: Password updated content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" "400": description: Invalid or expired code content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /users: get: operationId: listUsers tags: [users] summary: List users (faculty only) parameters: - name: role in: query schema: type: string enum: [student, faculty] responses: "200": description: List of users content: application/json: schema: type: array items: $ref: "#/components/schemas/User" /users/{id}: get: operationId: getUser tags: [users] summary: Get user by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: User content: application/json: schema: $ref: "#/components/schemas/User" /courses: get: operationId: listCourses tags: [courses] summary: List courses responses: "200": description: List of courses content: application/json: schema: type: array items: $ref: "#/components/schemas/Course" post: operationId: createCourse tags: [courses] summary: Create a course (faculty only) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateCourseInput" responses: "201": description: Created course content: application/json: schema: $ref: "#/components/schemas/Course" /courses/{id}: get: operationId: getCourse tags: [courses] summary: Get a course by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Course content: application/json: schema: $ref: "#/components/schemas/Course" put: operationId: updateCourse tags: [courses] summary: Update a course parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateCourseInput" responses: "200": description: Updated course content: application/json: schema: $ref: "#/components/schemas/Course" delete: operationId: deleteCourse tags: [courses] summary: Delete a course parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /courses/{id}/wotd/words: get: operationId: listWotdWords tags: [word-of-the-day] summary: List the course's 5-letter word pool (faculty only) parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Words in the pool content: application/json: schema: type: array items: $ref: "#/components/schemas/WotdWord" post: operationId: addWotdWords tags: [word-of-the-day] summary: Bulk add 5-letter words to the course pool (faculty only) parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AddWotdWordsInput" responses: "200": description: Result summary including the words actually added content: application/json: schema: $ref: "#/components/schemas/AddWotdWordsResult" /wotd/words/{wordId}: put: operationId: updateWotdWord tags: [word-of-the-day] summary: Edit an existing word in the pool (faculty only) parameters: - name: wordId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateWotdWordInput" responses: "200": description: Updated word content: application/json: schema: $ref: "#/components/schemas/WotdWord" delete: operationId: deleteWotdWord tags: [word-of-the-day] summary: Remove a word from the course pool (faculty only) parameters: - name: wordId in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /courses/{id}/wotd/settings: get: operationId: getWotdSettings tags: [word-of-the-day] summary: Get the Word of the Day cadence/settings for a course parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Settings content: application/json: schema: $ref: "#/components/schemas/WotdSettings" put: operationId: updateWotdSettings tags: [word-of-the-day] summary: Update Word of the Day settings (faculty only) parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateWotdSettingsInput" responses: "200": description: Updated settings content: application/json: schema: $ref: "#/components/schemas/WotdSettings" /courses/{id}/wotd/leaderboard: get: operationId: getWotdLeaderboard tags: [word-of-the-day] summary: Word of the Day leaderboard for the active period parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Ranked enrolled students content: application/json: schema: type: array items: $ref: "#/components/schemas/WotdLeaderboardEntry" /courses/{id}/wotd/today: get: operationId: getWotdToday tags: [word-of-the-day] summary: Get today's puzzle state for the calling user parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Today's puzzle (no answer leaked while in progress) content: application/json: schema: $ref: "#/components/schemas/WotdToday" /wotd/attempts/{assignmentId}/guess: post: operationId: submitWotdGuess tags: [word-of-the-day] summary: Submit a guess for a Word of the Day assignment parameters: - name: assignmentId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SubmitWotdGuessInput" responses: "200": description: Updated puzzle state including feedback for all guesses so far content: application/json: schema: $ref: "#/components/schemas/WotdToday" /courses/{id}/students: get: operationId: getCourseStudents tags: [courses] summary: Get students enrolled in a course parameters: - name: id in: path required: true schema: type: integer responses: "200": description: List of students content: application/json: schema: type: array items: $ref: "#/components/schemas/User" /courses/{id}/sections: get: operationId: listCourseSections tags: [course-sections] summary: List sections for a course parameters: - name: id in: path required: true schema: type: integer responses: "200": description: List of course sections content: application/json: schema: type: array items: $ref: "#/components/schemas/CourseSection" post: operationId: createCourseSection tags: [course-sections] summary: Create a course section (faculty only) parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateCourseSectionInput" responses: "201": description: Created section content: application/json: schema: $ref: "#/components/schemas/CourseSection" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /course-sections/{id}: get: operationId: getCourseSection tags: [course-sections] summary: Get a course section by id parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Course section content: application/json: schema: $ref: "#/components/schemas/CourseSection" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" put: operationId: updateCourseSection tags: [course-sections] summary: Update a course section (faculty only) parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateCourseSectionInput" responses: "200": description: Updated section content: application/json: schema: $ref: "#/components/schemas/CourseSection" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: operationId: deleteCourseSection tags: [course-sections] summary: Delete a course section (faculty only) parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /activities: get: operationId: listActivities tags: [activities] summary: List activities parameters: - name: courseId in: query schema: type: integer responses: "200": description: List of activities content: application/json: schema: type: array items: $ref: "#/components/schemas/Activity" post: operationId: createActivity tags: [activities] summary: Create an activity (faculty only) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateActivityInput" responses: "201": description: Created activity content: application/json: schema: $ref: "#/components/schemas/Activity" /activities/{id}: get: operationId: getActivity tags: [activities] summary: Get an activity parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Activity content: application/json: schema: $ref: "#/components/schemas/Activity" put: operationId: updateActivity tags: [activities] summary: Update an activity parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateActivityInput" responses: "200": description: Updated activity content: application/json: schema: $ref: "#/components/schemas/Activity" delete: operationId: deleteActivity tags: [activities] summary: Delete an activity parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /enrollments: get: operationId: listEnrollments tags: [enrollments] summary: List enrollments for current user responses: "200": description: List of enrollments content: application/json: schema: type: array items: $ref: "#/components/schemas/Enrollment" post: operationId: createEnrollment tags: [enrollments] summary: Enroll a student in a course requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateEnrollmentInput" responses: "201": description: Enrollment created content: application/json: schema: $ref: "#/components/schemas/Enrollment" /enrollments/{id}: delete: operationId: deleteEnrollment tags: [enrollments] summary: Remove enrollment parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Removed content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /submissions: get: operationId: listSubmissions tags: [submissions] summary: List submissions for current user parameters: - name: activityId in: query schema: type: integer responses: "200": description: List of submissions content: application/json: schema: type: array items: $ref: "#/components/schemas/Submission" post: operationId: createSubmission tags: [submissions] summary: Submit an activity requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateSubmissionInput" responses: "201": description: Submission created content: application/json: schema: $ref: "#/components/schemas/Submission" /leaderboard: get: operationId: getLeaderboard tags: [leaderboard] summary: Get global leaderboard parameters: - name: courseId in: query schema: type: integer - name: limit in: query schema: type: integer default: 20 responses: "200": description: Leaderboard entries content: application/json: schema: type: array items: $ref: "#/components/schemas/LeaderboardEntry" /marketplace/listings: get: operationId: listMarketplaceListings tags: [marketplace] summary: List marketplace listings parameters: - name: category in: query schema: type: string - name: search in: query schema: type: string responses: "200": description: List of listings content: application/json: schema: type: array items: $ref: "#/components/schemas/MarketplaceListing" post: operationId: createMarketplaceListing tags: [marketplace] summary: Create a marketplace listing requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateMarketplaceListingInput" responses: "201": description: Listing created content: application/json: schema: $ref: "#/components/schemas/MarketplaceListing" /marketplace/listings/{id}: get: operationId: getMarketplaceListing tags: [marketplace] summary: Get a marketplace listing parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Listing content: application/json: schema: $ref: "#/components/schemas/MarketplaceListing" delete: operationId: deleteMarketplaceListing tags: [marketplace] summary: Delete a listing parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /contributors: get: operationId: listContributorApplications tags: [contributors] summary: List contributor applications (faculty only) responses: "200": description: Applications content: application/json: schema: type: array items: $ref: "#/components/schemas/ContributorApplication" post: operationId: createContributorApplication tags: [contributors] summary: Submit a contributor application requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateContributorApplicationInput" responses: "201": description: Application submitted content: application/json: schema: $ref: "#/components/schemas/ContributorApplication" /dashboard/student: get: operationId: getStudentDashboard tags: [dashboard] summary: Get student dashboard summary responses: "200": description: Student dashboard data content: application/json: schema: $ref: "#/components/schemas/StudentDashboard" /dashboard/faculty: get: operationId: getFacultyDashboard tags: [dashboard] summary: Get faculty dashboard summary responses: "200": description: Faculty dashboard data content: application/json: schema: $ref: "#/components/schemas/FacultyDashboard" /quizpop/sessions: post: operationId: startQuizpopSession tags: [quizpop] summary: Faculty - start a new live QuizPop session requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/StartQuizpopSessionInput" responses: "201": description: Session created content: application/json: schema: $ref: "#/components/schemas/QuizpopSession" /quizpop/sessions/by-code/{code}: get: operationId: getQuizpopSessionByCode tags: [quizpop] summary: Look up a joinable session by its 6-character code parameters: - name: code in: path required: true schema: type: string responses: "200": description: Session lookup result content: application/json: schema: $ref: "#/components/schemas/QuizpopSessionLookup" /quizpop/sessions/{id}: get: operationId: getQuizpopSession tags: [quizpop] summary: Full session state for host or enrolled player parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Session state content: application/json: schema: $ref: "#/components/schemas/QuizpopSessionState" /quizpop/live: get: operationId: listLiveQuizpopSessions tags: [quizpop] summary: List live QuizPop sessions in the current student's enrolled courses parameters: - name: courseId in: query required: false schema: type: integer responses: "200": description: Live sessions content: application/json: schema: type: array items: $ref: "#/components/schemas/QuizpopLiveSession" /ai/pdf/uploads: post: operationId: uploadAiPdf tags: [quizpop] summary: Faculty - upload a PDF for AI generation requestBody: required: true content: multipart/form-data: schema: type: object required: [file] properties: file: type: string format: binary responses: "201": description: Stored PDF + extracted text preview content: application/json: schema: $ref: "#/components/schemas/AiPdfUpload" /ai/pdf/generations: get: operationId: listAiGenerations tags: [quizpop] summary: Faculty - list this faculty's past generation runs responses: "200": description: Generation runs (newest first) content: application/json: schema: type: array items: $ref: "#/components/schemas/AiGenerationRun" post: operationId: createAiGeneration tags: [quizpop] summary: Faculty - generate flashcards/MCQ/TF/match-pairs from an uploaded PDF requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateAiGenerationInput" responses: "201": description: Generation run with editable items content: application/json: schema: $ref: "#/components/schemas/AiGenerationRun" /ai/pdf/generations/{id}: get: operationId: getAiGeneration tags: [quizpop] summary: Faculty - re-open a past generation run parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Generation run content: application/json: schema: $ref: "#/components/schemas/AiGenerationRun" /ai/pdf/generations/{id}/publish: post: operationId: publishAiGeneration tags: [quizpop] summary: Faculty - publish (a possibly-edited subset of) a generation run as real activities parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PublishAiGenerationInput" responses: "201": description: One or two activities created (flashcards / quiz) content: application/json: schema: $ref: "#/components/schemas/PublishAiGenerationResult" /activities/{id}/quizpop/sessions: get: operationId: listActivityQuizpopSessions tags: [quizpop] summary: Faculty - list past sessions for one of their activities parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Sessions content: application/json: schema: type: array items: $ref: "#/components/schemas/QuizpopSession" /marketplace/listings/{id}/conversations: post: operationId: openConversationForListing tags: [marketplace] summary: Open or resume the buyer-seller chat for a listing parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Existing conversation content: application/json: schema: $ref: "#/components/schemas/ChatConversation" "201": description: Newly created conversation content: application/json: schema: $ref: "#/components/schemas/ChatConversation" "400": description: Invalid (e.g. own listing) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Listing not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /chat/conversations: get: operationId: listMyConversations tags: [marketplace] summary: List the current user's chat conversations (buyer or seller) responses: "200": description: Conversations newest-first content: application/json: schema: type: array items: $ref: "#/components/schemas/ChatConversationSummary" /chat/conversations/{id}: get: operationId: getConversation tags: [marketplace] summary: Get a single conversation header parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Conversation header content: application/json: schema: $ref: "#/components/schemas/ChatConversationDetail" "403": description: Not your conversation content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /chat/conversations/{id}/messages: get: operationId: listConversationMessages tags: [marketplace] summary: List messages in a conversation (chronological); marks them read parameters: - name: id in: path required: true schema: type: integer - name: after in: query required: false schema: type: string format: date-time responses: "200": description: Messages content: application/json: schema: type: array items: $ref: "#/components/schemas/ChatMessage" post: operationId: sendConversationMessage tags: [marketplace] summary: Send a new message in this conversation parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SendChatMessageInput" responses: "201": description: Created message content: application/json: schema: $ref: "#/components/schemas/ChatMessage" "400": description: Invalid body content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /chat/unread-count: get: operationId: getChatUnreadCount tags: [marketplace] summary: Total unread chat messages for the current user responses: "200": description: Unread count content: application/json: schema: $ref: "#/components/schemas/ChatUnreadCount" components: schemas: HealthStatus: type: object properties: status: type: string required: - status ErrorResponse: type: object properties: error: type: string required: - error SuccessResponse: type: object properties: success: type: boolean required: - success User: type: object properties: id: type: integer email: type: string name: type: string role: type: string enum: [student, faculty] xp: type: integer points: type: integer level: type: integer streak: type: integer badges: type: array items: type: string uniCoins: type: integer universityId: type: string nullable: true university: type: string major: type: string year: type: string avatarUrl: type: string emailVerifiedAt: type: string format: date-time nullable: true createdAt: type: string format: date-time required: - id - email - name - role - xp - points - level - streak - badges - uniCoins - createdAt University: type: object properties: id: type: string name: type: string allowedDomains: type: array items: type: string required: - id - name - allowedDomains RegisterInput: type: object properties: email: type: string password: type: string name: type: string role: type: string enum: [student, faculty] universityId: type: string university: type: string major: type: string year: type: string required: - email - password - name - role - universityId LoginInput: type: object properties: email: type: string password: type: string universityId: type: string required: - email - password - universityId AuthResponse: type: object properties: user: $ref: "#/components/schemas/User" required: - user VerifyEmailInput: type: object properties: email: type: string code: type: string required: [email, code] ForgotPasswordInput: type: object properties: email: type: string required: [email] ResetPasswordInput: type: object properties: email: type: string code: type: string newPassword: type: string required: [email, code, newPassword] Course: type: object properties: id: type: integer title: type: string code: type: string semester: type: string description: type: string facultyId: type: integer facultyName: type: string enrollmentCount: type: integer activityCount: type: integer createdAt: type: string format: date-time required: - id - title - code - semester - facultyId - facultyName - enrollmentCount - activityCount - createdAt CreateCourseInput: type: object properties: title: type: string code: type: string semester: type: string description: type: string required: - title - code - semester Activity: type: object properties: id: type: integer courseId: type: integer facultyId: type: integer title: type: string instructions: type: string gameType: type: string enum: [quiz_battle, flashcard, matching, elimination, team_challenge, puzzle] difficulty: type: string enum: [easy, medium, hard] timerSeconds: type: integer pointsPerQuestion: type: integer isPublished: type: boolean dueDate: type: string format: date-time isRequired: type: boolean questions: type: array items: $ref: "#/components/schemas/Question" submissionCount: type: integer createdAt: type: string format: date-time required: - id - courseId - facultyId - title - gameType - difficulty - timerSeconds - pointsPerQuestion - isPublished - isRequired - questions - submissionCount - createdAt Question: type: object properties: id: type: integer activityId: type: integer text: type: string questionType: type: string enum: [multiple_choice, true_false, match_pairs] orderIndex: type: integer answers: type: array items: $ref: "#/components/schemas/Answer" required: - id - activityId - text - questionType - orderIndex - answers Answer: type: object properties: id: type: integer questionId: type: integer text: type: string isCorrect: type: boolean pairKey: type: string nullable: true description: For match_pairs questions, identifies which pair this row belongs to. Hidden from non-faculty. side: type: string enum: [left, right] nullable: true description: For match_pairs questions, distinguishes left- vs right-column items. orderIndex: type: integer required: - id - questionId - text - isCorrect - orderIndex CreateActivityInput: type: object properties: courseId: type: integer title: type: string instructions: type: string gameType: type: string enum: [quiz_battle, flashcard, matching, elimination, team_challenge, puzzle] difficulty: type: string enum: [easy, medium, hard] timerSeconds: type: integer pointsPerQuestion: type: integer isPublished: type: boolean dueDate: type: string format: date-time isRequired: type: boolean questions: type: array items: $ref: "#/components/schemas/CreateQuestionInput" required: - courseId - title - gameType - difficulty - timerSeconds - pointsPerQuestion - isPublished - isRequired CreateQuestionInput: type: object properties: text: type: string questionType: type: string enum: [multiple_choice, true_false, match_pairs] default: multiple_choice orderIndex: type: integer answers: type: array items: $ref: "#/components/schemas/CreateAnswerInput" required: - text - orderIndex - answers CreateAnswerInput: type: object properties: text: type: string isCorrect: type: boolean pairKey: type: string nullable: true side: type: string enum: [left, right] nullable: true orderIndex: type: integer required: - text - isCorrect - orderIndex Enrollment: type: object properties: id: type: integer studentId: type: integer courseId: type: integer course: $ref: "#/components/schemas/Course" progressPercent: type: integer enrolledAt: type: string format: date-time required: - id - studentId - courseId - progressPercent - enrolledAt CreateEnrollmentInput: type: object properties: courseId: type: integer studentId: type: integer required: - courseId Submission: type: object properties: id: type: integer studentId: type: integer activityId: type: integer activity: $ref: "#/components/schemas/Activity" score: type: integer pointsEarned: type: integer uniCoinsEarned: type: integer accuracy: type: number completedAt: type: string format: date-time required: - id - studentId - activityId - score - pointsEarned - uniCoinsEarned - accuracy - completedAt CreateSubmissionInput: type: object properties: activityId: type: integer selectedAnswerIds: type: array items: type: integer description: IDs of the answers the student selected for multiple_choice / true_false questions. Score is computed server-side. matchedPairs: type: array items: type: object properties: leftAnswerId: type: integer rightAnswerId: type: integer required: - leftAnswerId - rightAnswerId description: For match_pairs questions, the student's left↔right matches. Score is computed server-side. required: - activityId - selectedAnswerIds LeaderboardEntry: type: object properties: rank: type: integer userId: type: integer name: type: string avatarUrl: type: string xp: type: integer points: type: integer level: type: integer badges: type: array items: type: string activitiesCompleted: type: integer required: - rank - userId - name - xp - points - level - badges - activitiesCompleted MarketplaceListing: type: object properties: id: type: integer sellerId: type: integer sellerName: type: string sellerEmail: type: string nullable: true title: type: string description: type: string price: type: number category: type: string enum: [electronics, textbooks, furniture, clothing, appliances, other] condition: type: string enum: [new, like_new, good, fair, poor] imageUrl: type: string pickupLocation: type: string isAvailable: type: boolean createdAt: type: string format: date-time required: - id - sellerId - sellerName - title - price - category - condition - pickupLocation - isAvailable - createdAt CreateMarketplaceListingInput: type: object properties: title: type: string description: type: string price: type: number category: type: string enum: [electronics, textbooks, furniture, clothing, appliances, other] condition: type: string enum: [new, like_new, good, fair, poor] imageUrl: type: string pickupLocation: type: string required: - title - price - category - condition - pickupLocation ContributorApplication: type: object properties: id: type: integer fullName: type: string email: type: string major: type: string year: type: string track: type: string enum: [programming, game_development, cybersecurity, ui_ux, web_development, data_ai] skillLevel: type: string enum: [beginner, intermediate, advanced] githubUrl: type: string portfolioUrl: type: string whyJoin: type: string status: type: string enum: [pending, accepted, rejected] createdAt: type: string format: date-time required: - id - fullName - email - major - year - track - skillLevel - whyJoin - status - createdAt CreateContributorApplicationInput: type: object properties: fullName: type: string email: type: string major: type: string year: type: string track: type: string enum: [programming, game_development, cybersecurity, ui_ux, web_development, data_ai] skillLevel: type: string enum: [beginner, intermediate, advanced] githubUrl: type: string portfolioUrl: type: string whyJoin: type: string required: - fullName - email - major - year - track - skillLevel - whyJoin StudentDashboard: type: object properties: user: $ref: "#/components/schemas/User" enrolledCourses: type: integer activitiesCompleted: type: integer activitiesPending: type: integer totalXp: type: integer totalPoints: type: integer uniCoins: type: integer currentLevel: type: integer streak: type: integer accuracy: type: number globalRank: type: integer recentSubmissions: type: array items: $ref: "#/components/schemas/Submission" upcomingActivities: type: array items: $ref: "#/components/schemas/Activity" topCourses: type: array items: $ref: "#/components/schemas/Enrollment" required: - user - enrolledCourses - activitiesCompleted - activitiesPending - totalXp - totalPoints - uniCoins - currentLevel - streak - accuracy - globalRank - recentSubmissions - upcomingActivities - topCourses FacultyDashboard: type: object properties: user: $ref: "#/components/schemas/User" totalCourses: type: integer totalStudents: type: integer totalActivities: type: integer activitiesPublished: type: integer recentSubmissions: type: array items: $ref: "#/components/schemas/Submission" topStudents: type: array items: $ref: "#/components/schemas/LeaderboardEntry" courseBreakdown: type: array items: $ref: "#/components/schemas/CourseStats" required: - user - totalCourses - totalStudents - totalActivities - activitiesPublished - recentSubmissions - topStudents - courseBreakdown CourseStats: type: object properties: course: $ref: "#/components/schemas/Course" enrollmentCount: type: integer completionRate: type: number avgScore: type: number required: - course - enrollmentCount - completionRate - avgScore CourseSection: type: object properties: id: type: integer courseId: type: integer title: type: string description: type: string nullable: true orderIndex: type: integer isPublished: type: boolean createdAt: type: string format: date-time updatedAt: type: string format: date-time required: - id - courseId - title - orderIndex - isPublished - createdAt - updatedAt CreateCourseSectionInput: type: object properties: title: type: string description: type: string nullable: true orderIndex: type: integer isPublished: type: boolean required: - title - orderIndex WotdWord: type: object properties: id: type: integer courseId: type: integer word: type: string description: Lowercase 5-letter word addedById: type: integer createdAt: type: string format: date-time required: - id - courseId - word - addedById - createdAt AddWotdWordsInput: type: object properties: words: type: array items: type: string description: One or more candidate words. Server normalizes to lowercase, drops anything that isn't exactly 5 a-z letters, and dedupes against the existing pool. required: - words AddWotdWordsResult: type: object properties: added: type: array items: $ref: "#/components/schemas/WotdWord" skipped: type: integer description: Number of input entries that were rejected (wrong length, invalid characters, or already in the pool). required: - added - skipped WotdSettings: type: object properties: courseId: type: integer cadence: type: string enum: [daily, weekly] maxAttempts: type: integer required: - courseId - cadence - maxAttempts UpdateWotdSettingsInput: type: object properties: cadence: type: string enum: [daily, weekly] required: - cadence WotdGuessFeedback: type: object description: Per-letter feedback for one guess. properties: guess: type: string letters: type: array items: type: object properties: letter: type: string status: type: string enum: [correct, present, absent] required: - letter - status required: - guess - letters WotdToday: type: object properties: available: type: boolean description: False when the course has no word pool / settings yet. reason: type: string nullable: true description: When available is false, a human-readable explanation. assignmentId: type: integer nullable: true periodKey: type: string nullable: true cadence: type: string enum: [daily, weekly] nullable: true wordLength: type: integer nullable: true maxAttempts: type: integer nullable: true guesses: type: array items: $ref: "#/components/schemas/WotdGuessFeedback" status: type: string enum: [in_progress, won, lost] nullable: true attemptsRemaining: type: integer nullable: true answer: type: string nullable: true description: Only revealed when status is won or lost. pointsEarned: type: integer nullable: true uniCoinsEarned: type: integer nullable: true required: - available - guesses UpdateWotdWordInput: type: object properties: word: type: string description: Replacement 5-letter word. required: - word WotdLeaderboardEntry: type: object properties: rank: type: integer userId: type: integer name: type: string avatarUrl: type: string nullable: true wins: type: integer played: type: integer bestAttempts: type: integer nullable: true description: Lowest number of guesses across the period (null when no wins). pointsEarned: type: integer uniCoinsEarned: type: integer required: - rank - userId - name - wins - played - pointsEarned - uniCoinsEarned SubmitWotdGuessInput: type: object properties: guess: type: string description: A 5-letter guess (case insensitive). required: - guess UpdateCourseSectionInput: type: object properties: title: type: string description: type: string nullable: true orderIndex: type: integer isPublished: type: boolean StartQuizpopSessionInput: type: object required: [activityId] properties: activityId: type: integer QuizpopSession: type: object properties: id: type: integer activityId: type: integer hostId: type: integer joinCode: type: string status: type: string enum: [lobby, in_question, between_questions, ended] currentQuestionIndex: type: integer currentQuestionStartedAt: type: string format: date-time nullable: true startedAt: type: string format: date-time nullable: true endedAt: type: string format: date-time nullable: true createdAt: type: string format: date-time QuizpopSessionLookup: type: object properties: id: type: integer joinCode: type: string activityId: type: integer status: type: string QuizpopLeaderboardEntry: type: object properties: rank: type: integer participantId: type: integer userId: type: integer name: type: string avatarUrl: type: string nullable: true score: type: integer QuizpopSessionState: type: object properties: session: $ref: "#/components/schemas/QuizpopSession" # Activity metadata. The full `questions` array is included only # when the requester is the host; players never receive future # questions. The shape is loose because activity rows carry game- # type-specific fields handled elsewhere in the API. activity: type: object additionalProperties: true # Currently-active question (with answer choices stripped of any # `isCorrect` flag for players). Null while in lobby/between/ended. currentQuestion: type: object nullable: true additionalProperties: true questionCount: type: integer leaderboard: type: array items: $ref: "#/components/schemas/QuizpopLeaderboardEntry" isHost: type: boolean QuizpopLiveSession: type: object properties: id: type: integer joinCode: type: string activityId: type: integer activityTitle: type: string courseId: type: integer nullable: true status: type: string createdAt: type: string format: date-time AiPdfUpload: type: object required: [id, filename, byteSize, createdAt, textPreview, textLength] properties: id: { type: integer } filename: { type: string } byteSize: { type: integer } createdAt: { type: string, format: date-time } textPreview: { type: string } textLength: { type: integer } AiGeneratedFlashcard: type: object required: [front, back] properties: front: { type: string } back: { type: string } AiGeneratedMcqAnswer: type: object required: [text, isCorrect] properties: text: { type: string } isCorrect: { type: boolean } AiGeneratedMcq: type: object required: [text, answers] properties: text: { type: string } answers: type: array items: { $ref: "#/components/schemas/AiGeneratedMcqAnswer" } AiGeneratedTrueFalse: type: object required: [text, correct] properties: text: { type: string } correct: { type: boolean } AiGeneratedPair: type: object required: [left, right] properties: left: { type: string } right: { type: string } AiGeneratedMatchPairs: type: object required: [text, pairs] properties: text: { type: string } pairs: type: array items: { $ref: "#/components/schemas/AiGeneratedPair" } AiGeneratedItems: type: object required: [flashcards, multiple_choice, true_false, match_pairs] properties: flashcards: type: array items: { $ref: "#/components/schemas/AiGeneratedFlashcard" } multiple_choice: type: array items: { $ref: "#/components/schemas/AiGeneratedMcq" } true_false: type: array items: { $ref: "#/components/schemas/AiGeneratedTrueFalse" } match_pairs: type: array items: { $ref: "#/components/schemas/AiGeneratedMatchPairs" } AiGenerationCounts: type: object required: [flashcards, multiple_choice, true_false, match_pairs] properties: flashcards: { type: integer, minimum: 0, maximum: 25 } multiple_choice: { type: integer, minimum: 0, maximum: 25 } true_false: { type: integer, minimum: 0, maximum: 25 } match_pairs: { type: integer, minimum: 0, maximum: 25 } CreateAiGenerationInput: type: object required: [uploadId, difficulty, counts] properties: uploadId: { type: integer } difficulty: { type: string, enum: [easy, medium, hard] } counts: { $ref: "#/components/schemas/AiGenerationCounts" } AiGenerationRun: type: object required: [id, uploadId, facultyId, requestedCounts, difficulty, items, status, createdAt] properties: id: { type: integer } uploadId: { type: integer } facultyId: { type: integer } requestedCounts: { $ref: "#/components/schemas/AiGenerationCounts" } difficulty: { type: string, enum: [easy, medium, hard] } items: { $ref: "#/components/schemas/AiGeneratedItems" } status: { type: string, enum: [ready, failed, published] } errorMessage: { type: string, nullable: true } createdAt: { type: string, format: date-time } PublishAiGenerationInput: type: object required: [courseId, title, items] properties: courseId: { type: integer } title: { type: string } difficulty: { type: string, enum: [easy, medium, hard] } timerSeconds: { type: integer } pointsPerQuestion: { type: integer } items: { $ref: "#/components/schemas/AiGeneratedItems" } PublishAiGenerationResult: type: object required: [runId, created] properties: runId: { type: integer } created: type: array items: type: object required: [activityId, kind, title] properties: activityId: { type: integer } kind: { type: string } title: { type: string } ChatConversation: type: object required: [id, listingId, buyerId, sellerId, createdAt, lastMessageAt] properties: id: { type: integer } listingId: { type: integer } buyerId: { type: integer } sellerId: { type: integer } createdAt: { type: string, format: date-time } lastMessageAt: { type: string, format: date-time } ChatConversationSummary: type: object required: - id - listingTitle - buyerId - sellerId - role - otherUserId - otherUserName - lastMessageAt - unreadCount - createdAt properties: id: { type: integer } listingId: { type: integer, nullable: true } listingTitle: { type: string } listingImageUrl: { type: string, nullable: true } buyerId: { type: integer } sellerId: { type: integer } role: { type: string, enum: [buyer, seller] } otherUserId: { type: integer } otherUserName: { type: string } lastMessagePreview: { type: string, nullable: true } lastMessageAt: { type: string, format: date-time } unreadCount: { type: integer } createdAt: { type: string, format: date-time } ChatConversationDetail: type: object required: - id - listingTitle - buyerId - sellerId - role - otherUserId - otherUserName - createdAt - lastMessageAt properties: id: { type: integer } listingId: { type: integer, nullable: true } listingTitle: { type: string } listingImageUrl: { type: string, nullable: true } buyerId: { type: integer } sellerId: { type: integer } role: { type: string, enum: [buyer, seller] } otherUserId: { type: integer } otherUserName: { type: string } createdAt: { type: string, format: date-time } lastMessageAt: { type: string, format: date-time } ChatMessage: type: object required: [id, conversationId, senderId, body, createdAt] properties: id: { type: integer } conversationId: { type: integer } senderId: { type: integer } body: { type: string } createdAt: { type: string, format: date-time } readAt: { type: string, format: date-time, nullable: true } SendChatMessageInput: type: object required: [body] properties: body: { type: string, minLength: 1, maxLength: 2000 } ChatUnreadCount: type: object required: [count] properties: count: { type: integer }