Skip to content

Commit

Permalink
EDF: [premieroctet#116] is_allergic is now an enum field in user schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien-Wappizy committed Dec 16, 2024
1 parent 4116273 commit ec0f212
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions backend/web/server/plugins/entreprisedufutur/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ USER_MODELS.forEach(m => {
declareComputedField({model: m, field: 'unseen_notifications_count', getterFn: getPendingNotificationsCount})
declareVirtualField({model: m, field: 'published_missions_count', instance: 'Number'})
declareVirtualField({model: m, field: 'published_public_missions_count', instance: 'Number'})
declareEnumField({model: m, field:'is_allergic', enumValues: BOOLEAN_ENUM})
})

//Company declarations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { isEmailOk, isPhoneOk } = require('../../../../utils/sms')
const {schemaOptions} = require('../../../utils/schemas')
const bcrypt = require('bcryptjs')
const { DUMMY_REF, idEqual } = require('../../../utils/database')
const { ROLES , JOBS, DISCRIMINATOR_KEY, LEVEL_THRESHOLD_EXPLORER, USER_LEVEL_CURIOUS, LEVEL_THRESHOLD_AMBASSADOR, USER_LEVEL_AMBASSADOR, USER_LEVEL_EXPLORER, COMPLETED_YES, OPTIONAL_COMPLETION_FIELDS, REQUIRED_COMPLETION_FIELDS, ROLE_MEMBER } = require('../consts')
const { ROLES , JOBS, DISCRIMINATOR_KEY, LEVEL_THRESHOLD_EXPLORER, USER_LEVEL_CURIOUS, LEVEL_THRESHOLD_AMBASSADOR, USER_LEVEL_AMBASSADOR, USER_LEVEL_EXPLORER, COMPLETED_YES, OPTIONAL_COMPLETION_FIELDS, REQUIRED_COMPLETION_FIELDS, ROLE_MEMBER, BOOLEAN_ENUM_NO, BOOLEAN_ENUM } = require('../consts')
const AddressSchema = require('../../../models/AddressSchema')
const { CREATED_AT_ATTRIBUTE } = require('../../../../utils/consts')

Expand Down Expand Up @@ -189,9 +189,10 @@ const UserSchema = new Schema({
type: Number
},
is_allergic: {
type: Boolean,
type: String,
enum: Object.keys(BOOLEAN_ENUM),
required: true,
default: false
default: BOOLEAN_ENUM_NO
},
allergy: {
type: String,
Expand Down

0 comments on commit ec0f212

Please sign in to comment.