Skip to content

Commit

Permalink
EDF: [premieroctet#128] add model test in generate order action
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien-Wappizy committed Dec 19, 2024
1 parent 6289b92 commit 2701044
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/web/server/plugins/entreprisedufutur/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ const generateOrder = async ({value,nb_tickets}, user) => {
throw new NotFoundError(`no eventTicket id`)
}

const model = getModel(value)
if (model != 'eventTicket') {
throw new TypeError(`value type is ${model} instead of eventTicket`)
}

if (!testNumber(nb_tickets)) {
throw new TypeError(`nb_tickets is not a number`)
}
Expand Down

0 comments on commit 2701044

Please sign in to comment.