From f0d6a45dc72628484bb76516a8126ca8fac9a01c Mon Sep 17 00:00:00 2001 From: Bastien Seree Date: Wed, 2 Oct 2024 16:33:40 +0200 Subject: [PATCH] Cyberleague: [#172] Add contract_type required enum field to carreer schema --- backend/web/server/plugins/cyberleague/functions.js | 5 ++++- .../web/server/plugins/cyberleague/schemas/CarreerSchema.js | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/web/server/plugins/cyberleague/functions.js b/backend/web/server/plugins/cyberleague/functions.js index 8da00e0b65..4b0a537522 100644 --- a/backend/web/server/plugins/cyberleague/functions.js +++ b/backend/web/server/plugins/cyberleague/functions.js @@ -11,7 +11,7 @@ const { setPostPutData, idEqual, } = require('../../utils/database') -const { ROLES, SECTOR, EXPERTISE_CATEGORIES, CONTENT_TYPE, JOBS, COMPANY_SIZE, ROLE_PARTNER, ROLE_ADMIN, ROLE_MEMBER, ESTIMATED_DURATION_UNITS, LOOKING_FOR_MISSION, CONTENT_VISIBILITY, EVENT_VISIBILITY, ANSWERS, QUESTION_CATEGORIES, SCORE_LEVELS, COIN_SOURCES, SCORE_LEVEL_1, SCORE_LEVEL_3, SCORE_LEVEL_2, STATUTS, GROUP_VISIBILITY, USER_LEVELS } = require('./consts') +const { ROLES, SECTOR, EXPERTISE_CATEGORIES, CONTENT_TYPE, JOBS, COMPANY_SIZE, ROLE_PARTNER, ROLE_ADMIN, ROLE_MEMBER, ESTIMATED_DURATION_UNITS, LOOKING_FOR_MISSION, CONTENT_VISIBILITY, EVENT_VISIBILITY, ANSWERS, QUESTION_CATEGORIES, SCORE_LEVELS, COIN_SOURCES, SCORE_LEVEL_1, SCORE_LEVEL_3, SCORE_LEVEL_2, STATUTS, GROUP_VISIBILITY, USER_LEVELS, CONTRACT_TYPES } = require('./consts') const { PURCHASE_STATUS } = require('../../../utils/consts') const Company = require('../../models/Company') const { BadRequestError, ForbiddenError } = require('../../utils/errors') @@ -310,6 +310,9 @@ declareEnumField( {model: 'gain', field: 'source', enumValues: COIN_SOURCES}) //Pack && purchase status declarations declareEnumField( {model: 'purchase', field: 'status', enumValues: PURCHASE_STATUS}) +//Carreer declarations +declareEnumField({model: 'carreer', field: 'contract_type', enumValues: CONTRACT_TYPES}) + diff --git a/backend/web/server/plugins/cyberleague/schemas/CarreerSchema.js b/backend/web/server/plugins/cyberleague/schemas/CarreerSchema.js index 75464ad5d9..df0fc59e98 100644 --- a/backend/web/server/plugins/cyberleague/schemas/CarreerSchema.js +++ b/backend/web/server/plugins/cyberleague/schemas/CarreerSchema.js @@ -1,5 +1,6 @@ const mongoose = require('mongoose') const { schemaOptions } = require('../../../utils/schemas') +const { CONTRACT_TYPES } = require('../consts') const Schema = mongoose.Schema @@ -14,6 +15,11 @@ const CarreerSchema = new Schema( type: String, required: [true, `L'intitulé de poste est obligatoire`] }, + contract_type: { + type: String, + enum: Object.keys(CONTRACT_TYPES), + required: [true, `Le type de contrat est obligatoire`] + } }, schemaOptions )