Skip to content

Commit

Permalink
Cyberleague: [premieroctet#159] Add fields to statist schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien-Wappizy committed Oct 15, 2024
1 parent 9a07861 commit 32a54f9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
5 changes: 4 additions & 1 deletion backend/web/server/plugins/cyberleague/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const {
loadFromDb,
setPrePutData,
} = 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, STATUTS, GROUP_VISIBILITY, USER_LEVELS, CONTRACT_TYPES, WORK_DURATIONS, PAY, STATUT_SPONSOR, STATUT_FOUNDER, STATUSES, STATUT_PARTNER, COMPLETED, OFFER_VISIBILITY, MISSION_VISIBILITY, COIN_SOURCE_LIKE_COMMENT, COMPLETED_YES, COIN_SOURCE_PARTICIPATE, REQUIRED_COMPLETION_FIELDS, OPTIONAL_COMPLETION_FIELDS } = 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, STATUTS, GROUP_VISIBILITY, USER_LEVELS, CONTRACT_TYPES, WORK_DURATIONS, PAY, STATUT_SPONSOR, STATUT_FOUNDER, STATUSES, STATUT_PARTNER, COMPLETED, OFFER_VISIBILITY, MISSION_VISIBILITY, COIN_SOURCE_LIKE_COMMENT, COMPLETED_YES, COIN_SOURCE_PARTICIPATE, REQUIRED_COMPLETION_FIELDS, OPTIONAL_COMPLETION_FIELDS, ENOUGH_SCORES } = require('./consts')
const { PURCHASE_STATUS, REGIONS } = require('../../../utils/consts')
const Company = require('../../models/Company')
const { BadRequestError, ForbiddenError } = require('../../utils/errors')
Expand Down Expand Up @@ -382,6 +382,9 @@ declareEnumField({model: 'offer', field: 'price_member_duration_unit', enumValue
//Mission declarations
declareVirtualField({model: 'mission', field: 'visibility', requires: 'is_public', instance: 'String', enumValues: MISSION_VISIBILITY})

//Statistic declarations
declareEnumField({model: 'statistic', field: 'enoughScores', enumValues: ENOUGH_SCORES})




Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,57 @@
const mongoose = require('mongoose')
const {schemaOptions} = require('../../../utils/schemas')
const { ENOUGH_SCORES } = require('../consts')


const Schema = mongoose.Schema

const StatisticSchema = new Schema({

enoughScores: {
type: String,
enum: Object.keys(ENOUGH_SCORES)
},
securityIncidentManagement: {
type: Number
},
partner: {
type: Number
},
inventory: {
type: Number
},
insurance: {
type: Number
},
cyberRef: {
type: Number
},
intrusion: {
type: Number
},
externalized: {
type: Number
},
webApp: {
type: Number
},
antivirus: {
type: Number
},
charter: {
type: Number
},
financial: {
type: Number
},
sensibilization: {
type: Number
},
mfa: {
type: Number
},
admin: {
type: Number
},
}, schemaOptions )

module.exports = StatisticSchema

0 comments on commit 32a54f9

Please sign in to comment.