From 6c009d15588895193369d0469666e060f736b9ba Mon Sep 17 00:00:00 2001 From: Bastien Seree Date: Thu, 26 Sep 2024 17:35:51 +0200 Subject: [PATCH] Cyberleague: [#156] add expertise_levels --- .../cyberleague/schemas/ProgramSchema.js | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/backend/web/server/plugins/cyberleague/schemas/ProgramSchema.js b/backend/web/server/plugins/cyberleague/schemas/ProgramSchema.js index 113dbcbe57..80326029ab 100644 --- a/backend/web/server/plugins/cyberleague/schemas/ProgramSchema.js +++ b/backend/web/server/plugins/cyberleague/schemas/ProgramSchema.js @@ -4,24 +4,32 @@ const {schemaOptions} = require('../../../utils/schemas') const Schema = mongoose.Schema const ProgramSchema = new Schema({ - modules: { - type: Schema.Types.ObjectId, - ref: 'cLModule', - required: [true, 'Les modules sont obligatoires'], - }, - name: { - type: String, - required: [true, 'Le nom du programme est obligatoire'], - }, - picture: { - type: String, - required: false, - }, - creator: { - type: Schema.Types.ObjectId, - ref: 'user', - required: [true, 'Le créateur du programme est obligatoire'] - } + modules: { + type: Schema.Types.ObjectId, + ref: 'cLModule', + required: [true, 'Les modules sont obligatoires'], + }, + name: { + type: String, + required: [true, 'Le nom du programme est obligatoire'], + }, + picture: { + type: String, + required: false, + }, + expertise_levels: { + type: [{ + type: Schema.Types.ObjectId, + ref: 'expertiseLevel', + required: [true, `Les expertises et leurs niveaux sont obligatoires`] + }], + default: [] + }, + creator: { + type: Schema.Types.ObjectId, + ref: 'user', + required: [true, 'Le créateur du programme est obligatoire'] + } }, {...schemaOptions}) /* eslint-disable prefer-arrow-callback */