Skip to content

Commit

Permalink
EDF: [premieroctet#115] take statut member value of statut field in c…
Browse files Browse the repository at this point in the history
…ompany schema into account for filters
  • Loading branch information
Bastien-Wappizy committed Dec 16, 2024
1 parent d513b28 commit c52c40a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/web/server/plugins/entreprisedufutur/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
setPrePutData,
setPreDeleteData,
} = require('../../utils/database')
const { ROLES, SECTOR, EXPERTISE_CATEGORIES, CONTENT_TYPE, JOBS, COMPANY_SIZES, 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, NOTIFICATION_TYPES, NOTIFICATION_TYPE_MESSAGE, NOTIFICATION_TYPE_FEED_COMMENT, NOTIFICATION_TYPE_FEED_LIKE, NOTIFICATION_TYPE_GROUP_COMMENT, NOTIFICATION_TYPE_GROUP_LIKE, BOOLEAN_ENUM, EVENT_AVAILABILITIES, BIOGRAPHY_STATUSES, USERTICKET_STATUSES, ACCOMODATION_TYPES, TIMEZONES, PARTNER_LEVELS, COMPANY_TURNOVERS } = require('./consts')
const { ROLES, SECTOR, EXPERTISE_CATEGORIES, CONTENT_TYPE, JOBS, COMPANY_SIZES, 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, NOTIFICATION_TYPES, NOTIFICATION_TYPE_MESSAGE, NOTIFICATION_TYPE_FEED_COMMENT, NOTIFICATION_TYPE_FEED_LIKE, NOTIFICATION_TYPE_GROUP_COMMENT, NOTIFICATION_TYPE_GROUP_LIKE, BOOLEAN_ENUM, EVENT_AVAILABILITIES, BIOGRAPHY_STATUSES, USERTICKET_STATUSES, ACCOMODATION_TYPES, TIMEZONES, PARTNER_LEVELS, COMPANY_TURNOVERS, STATUT_MEMBER } = require('./consts')
const { PURCHASE_STATUS, REGIONS } = require('../../../utils/consts')
const Company = require('../../models/Company')
const { BadRequestError, ForbiddenError } = require('../../utils/errors')
Expand Down Expand Up @@ -672,7 +672,7 @@ const preCreate = async ({model, params, user}) => {
throw new BadRequestError(`Il faut faire partie d'une entreprise pour pouvoir créer un job`)
}
const [company]=await loadFromDb({model: 'company', id: user.company, fields:['statut']})
if (!company.statut) {
if (company.statut == STATUT_MEMBER) {
throw new BadRequestError(`Il faut faire partie d'une entreprise partenaire, sponsor ou fondatrice pour pouvoir créer un job`)
}
params.company = user.company
Expand All @@ -683,7 +683,7 @@ const preCreate = async ({model, params, user}) => {
throw new BadRequestError(`Il faut faire partie d'une entreprise pour pouvoir créer une offre`)
}
const [company]=await loadFromDb({model: 'company', id: user.company, fields:['statut']})
if (!company.statut || company.statut == STATUT_PARTNER) {
if (company.statut == STATUT_MEMBER || company.statut == STATUT_PARTNER) {
throw new BadRequestError(`Il faut faire partie d'une entreprise sponsor ou fondatrice pour pouvoir créer une offre`)
}
params.company = user.company
Expand Down

0 comments on commit c52c40a

Please sign in to comment.