diff --git a/backend/web/server/plugins/cyberleague/functions.js b/backend/web/server/plugins/cyberleague/functions.js index a8901a14e9..ccec82fb77 100644 --- a/backend/web/server/plugins/cyberleague/functions.js +++ b/backend/web/server/plugins/cyberleague/functions.js @@ -142,6 +142,12 @@ USER_MODELS.forEach(m => { }) declareVirtualField({model: m, field: 'level', requires: 'tokens', instance: 'String', enumValues: USER_LEVELS}) declareComputedField({model: m, field: 'related_users', requires:'function,company.size,company.sector,shortname', getterFn: getRelated('user')}) + declareVirtualField({model: m, field: 'carreer_applications', instance: 'Array', multiple: true, + caster: { + instance: 'ObjectID', + options: {ref: 'carreer'} + } + }) }) //Company declarations diff --git a/backend/web/server/plugins/cyberleague/schemas/UserSchema.js b/backend/web/server/plugins/cyberleague/schemas/UserSchema.js index 2c1ea30f49..76a1f9e16e 100644 --- a/backend/web/server/plugins/cyberleague/schemas/UserSchema.js +++ b/backend/web/server/plugins/cyberleague/schemas/UserSchema.js @@ -318,6 +318,12 @@ UserSchema.virtual('level', DUMMY_REF).get(function() { return USER_LEVEL_EXPLORER }) +UserSchema.virtual('carreer_applications', { + ref:'carreer', + localField:'_id', + foreignField:'candidates', +}) + /* eslint-enable prefer-arrow-callback */ module.exports = UserSchema