Guest User

Untitled

a guest
Apr 8th, 2018
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. const userSchema =new Schema({
  2. username: {
  3. type: String,
  4. unique: true
  5. },
  6. email: String,
  7. password: String,
  8. name: String,
  9. contestsParticipated: [
  10. {
  11. contestID:{
  12. type: Schema.ObjectId,
  13. ref: "contest"
  14. },
  15. rank: Number,
  16. score: Number
  17. }
  18. ],
  19. rating: Number,
  20. contestsConducted: [
  21. {
  22. contest:{
  23. type: Schema.ObjectId,
  24. ref: "contest"
  25. }
  26. }
  27. ],
  28. submissions: [
  29. {
  30. //file required if we are saving the submission code as well
  31. problem:{
  32. type: Schema.ObjectId,
  33. ref: "problem"
  34. }
  35. timeUsed: Number,
  36. memoryConsumed: Number
  37. }
  38. ]
  39. });
  40. const problemSchema =new Schema({
  41. problemId: {
  42. type: String,
  43. unique: true
  44. },
  45. statement: String,
  46. editorial: String,
  47. testCases: [
  48. {
  49. input: String,
  50. output: String
  51. }
  52. ] ,
  53. memoryLimit: Number,
  54. timeLimit: Number,
  55. difficulty: Number,
  56. accuracy: Number,
  57. contestAsked: {
  58. type: Schema.ObjectId,
  59. ref: "contest"
  60. },
  61. numberOfAttempts: Number
  62. });
  63.  
  64. const contestSchema = new Schema({
  65. contestId:{
  66. type: String,
  67. unique: true
  68. },
  69. name: String,
  70. type: String,
  71. Date: Date,
  72. Time: String,
  73. Duration: Number,
  74. Prizes: String,
  75. organiser:{
  76. type: Schema.ObjectId,
  77. ref: "user"
  78. },
  79. participants: [
  80. user:{
  81. type: Schema.ObjectId,
  82. ref: "user"
  83. },
  84. score: Number,
  85. rank: Number
  86. ],
  87. problemsAsked:[
  88. problem:{
  89. type: Schema.ObjectId,
  90. ref: "probelem"
  91. }
  92. ]
  93. });
Add Comment
Please, Sign In to add comment