Skip to content

Commit

Permalink
EDF: [premieroctet#126] add status field to orderTicket schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien-Wappizy committed Dec 17, 2024
1 parent 740a468 commit fdd9aa6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backend/web/server/plugins/entreprisedufutur/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,9 @@ declareComputedField({model: 'admin_dashboard', field: 'partner_list', getterFn:
//Order declarations
declareEnumField({model: 'order', field:'status', enumValues: ORDER_STATUSES})

//OrderTicket declarations
declareEnumField({model: 'orderTicket', field: 'status', enumValues: USERTICKET_STATUSES})




Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const mongoose = require('mongoose')
const {schemaOptions} = require('../../../utils/schemas')
const { isEmailOk } = require('../../../../utils/sms')
const { USERTICKET_STATUSES } = require('../consts')

const Schema = mongoose.Schema

Expand All @@ -26,6 +27,11 @@ const OrderTicketSchema = new Schema({
set: v => v ? v.toLowerCase().trim() : v,
validate: [isEmailOk, v => `L'email '${v.value}' est invalide`],
},
status: {
type: String,
enum: Object.keys(USERTICKET_STATUSES),
required: [true, `Le statut du ticket est obligatoire`]
},
}, schemaOptions)

/* eslint-disable prefer-arrow-callback */
Expand Down

0 comments on commit fdd9aa6

Please sign in to comment.