Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const userSchema =new Schema({
- username: {
- type: String,
- unique: true
- },
- email: String,
- password: String,
- name: String,
- contestsParticipated: [
- {
- contestID:{
- type: Schema.ObjectId,
- ref: "contest"
- },
- rank: Number,
- score: Number
- }
- ],
- rating: Number,
- contestsConducted: [
- {
- contest:{
- type: Schema.ObjectId,
- ref: "contest"
- }
- }
- ],
- submissions: [
- {
- //file required if we are saving the submission code as well
- problem:{
- type: Schema.ObjectId,
- ref: "problem"
- }
- timeUsed: Number,
- memoryConsumed: Number
- }
- ]
- });
- const problemSchema =new Schema({
- problemId: {
- type: String,
- unique: true
- },
- statement: String,
- editorial: String,
- testCases: [
- {
- input: String,
- output: String
- }
- ] ,
- memoryLimit: Number,
- timeLimit: Number,
- difficulty: Number,
- accuracy: Number,
- contestAsked: {
- type: Schema.ObjectId,
- ref: "contest"
- },
- numberOfAttempts: Number
- });
- const contestSchema = new Schema({
- contestId:{
- type: String,
- unique: true
- },
- name: String,
- type: String,
- Date: Date,
- Time: String,
- Duration: Number,
- Prizes: String,
- organiser:{
- type: Schema.ObjectId,
- ref: "user"
- },
- participants: [
- user:{
- type: Schema.ObjectId,
- ref: "user"
- },
- score: Number,
- rank: Number
- ],
- problemsAsked:[
- problem:{
- type: Schema.ObjectId,
- ref: "probelem"
- }
- ]
- });
Add Comment
Please, Sign In to add comment