Skip to content

Commit

Permalink
Cyberleague: [premieroctet#90] score schema declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien-Wappizy committed Sep 2, 2024
1 parent c455ebb commit 9c2d445
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions backend/web/server/plugins/cyberleague/schemas/ScoreSchema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const mongoose = require('mongoose')
const {schemaOptions} = require('../../../utils/schemas')

const Schema = mongoose.Schema

const ScoreSchema = new Schema({
creator: {
type: Schema.Types.ObjectId,
ref: 'user',
required: [true, `Le créateur du score est obligatoire`],
},
questions: {
type: [{
question: {
type: Schema.Types.ObjectId,
ref: 'question',
required: true
},
answer: {
type: Number,
required: true
}
}]
}
}, {...schemaOptions})

/* eslint-disable prefer-arrow-callback */
/* eslint-enable prefer-arrow-callback */

module.exports = ScoreSchema

0 comments on commit 9c2d445

Please sign in to comment.