-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Tables
-
conteststable
id (primary key)
show_leaderboard (tiny int, 0/1)
public (tiny int, 0/1)
confidential_questions (tiny int, default 0)
creator (username, admin only, foreign key from users table)
name (string)
start_time (timestamp)
end_time (timestamp)
participants_count (int)
about (string)
rules (string, can be null)
prizes (string, can be null)
-
contests_groups_maptable
id (primary key)
contest_id (foreign key from `contests` table)
group_id (foreign key from `groups` table)
-
contests_moderators_maptable
id (primary key)
contest_id (foreign key from `contests` table)
moderator_username (foreign key from `users` table)
-
contests_participants_maptable
id (primary key)
contest_id (foreign key from `contests` table)
participant_username (foreign key from `users` table)
-
questionstable
id (primary key)
creator (foreign key from `users` table)
type (tiny int, 0 - MCQ, similar)
name (string)
problem statement (string)
input_format (string)
output_format (string)
constraints (string)
options (string, JSON array)
correct (int, index of correct option)
difficulty (int, 1-easy, 2-medium, 3-hard, can be 0 by default - not specified)
-
questions_editors_maptable
id (primary key)
question_id (foreign key from `questions` table)
editor_username (foreign key from `users` table)
-
tagstable
id (primary key)
description (string)
name (string)
-
questions_tags_maptable
id (primary key)
question_id (foreign key from `questions` table)
tag_id (foreign key from `tags` table)
-
contests_questions_maptable
id (primary key)
question_id (foreign key from `questions` table)
contest_id (foreign key from `contests` table)
max_score (int)
-
mcq_submissionstable
id (primary key)
question_id (foreign_key from `questions` table)
contest_id (foreign_key from `contests` table)
username (foreign_key from `users` table)
response (int, index of option selected),
submission_time (timestamp)
judged (tiny int, default 0)
score (int, default 0)
-
subjective_submissionstable
id (primary key)
question_id (foreign_key from `questions` table)
contest_id (foreign_key from `contests` table)
username (foreign_key from `users` table)
response (text),
submission_time (timestamp)
judged (tiny int, default 0)
score (int, default 0)
feedback (varchar, if the moderator wants to give any feedback after checking)
-
leaderboardtable
id (primary key)
uesrname (foreign key from `users` table)
contest_id (foreign_key from `contests` table)
score (int, total score)
total_time (time, total penalty yet)
attempted_count (int)
API
Contests API
-
createContest
POST /contests/Admin only -
updateContest
POST /contests/:contest_id/updateModerator only -
addModerator
POST /contests/:contest_id/moderatorModerator only -
removeModerator
DELETE /contests/:contest_id/moderatorModerator only -
addGroup
POST /contests/:contest_id/:groupsModerator only -
removeGroup
DELETE /contests/:contest_id/groupsModerator only -
getContests
GET /contests?status=active&limit=5 -
getModeratorContests
GET /contests/moderator_contests?limit=5Moderator only -
getContest
GET /contests/:contest_id -
getContestDetails
GET /contests/:contest_id/details?only_name=falseModerator only -
getContestModerators
GET /contests/:contest_id/moderatorsModerator only -
getAllParticipants
GET /contests/:contest_id/participants -
getAllParticipantsDetails
GET /contests/:contest_id/participants_detailsModerator only -
participate
POST /contests/:contest_id/participate -
addQuestion
POST /contests/:contest_id/:questions -
removeQuestion
DELETE /contests/:contest_id/questions -
getAllQuestions
GET /contests/:contest_id/questions -
getQuestion
GET /contests/:contest_id/questions/:question_id
Questions API:
-
createQuestion
POST /questions/Admin only: to create a question -
getModeratorQuestions
GET /questions/moderator_questions?limit=5&search=’’Moderator only: show the questions for which user is a moderator -
getQuestion
GET /questions/:question_id, Editor only: to get the question -
updateQuestion
POST /questions/:question_id/update, Editor only: to edit the questions, the change will be reflected in all instances of the question -
getAllQuestions
GET /questions/: - send all public questions with their contest_id (for practice section) -
addEditor
POST /questions/:question_id/editorEditor only: Add editor to a question -
removeEditor
DELETE /questions/:question_id/editorEditor only: Remove editor to a question (creator can't be removed) -
forkQuestion
POST /questions/:question_id/forkEditor only: Return the id of the forked new question
Submissions API
-
createSubmission
POST /contests/:contest_id/questions/:question_id/submitAll participants: everyone eligible for the contest should be allowed (For MCQ, allow only 1 attempt) -
getAllSubmissions
GET /contests/:contest_id/submissionsContest Moderator only: See all submissions (pagination, sorting, filtering and searching enabled) -
getUserContestSubmissions
GET /contests/:contest_id/users/:user_id/submissionsThe user only: get all submissions of a user -
gradeSubjectiveSubmission
POST /contests/:contest_id/subjective_submissions/:submission_id/gradeContest Moderator only: Grade a subjective submission providing a score along with an optional feedback. (If submission is already judged/graded, update it) -
getMCQSubmission
GET /contests/:contest_id/mcq_submissions/:submission_idOnly the specific user: Get a specific MCQ submission
GET /contests/:contest_id/mcq_submissions/:submission_id?moderator=trueContest Moderator only: Get a specific MCQ submission -
getSubjectiveSubmission
GET /contests/:contest_id/subjective_submissions/:submission_idOnly the specific user: Get a specific subjective submission.
GET /contests/:contest_id/subjective_submissions/:submission_id?moderator=trueContest Moderator only: Get a specific subjective submission -
getContestLeaderboard
GET /contests/:contest_id/leaderboardAll participants: Everyone should be allowed, ifshow_leaderboardis true, otherwise allow only contest moderators. -
getQuestionLeaderboard
GET /contests/:contest_id/questions/:question_id/leaderboard:Everyone should be allowed, ifshow_leaderboardis true, otherwise allow only contest moderators. -
getPracticeLeaderboard
GET /practice/leaderboard: accessible to all
Tags API:
-
createTag
POST /tagAdmin only: -
getTag
GET /tag?search=keyword