From 27010445f10739f7e44b6f887915f27063ad5dbb Mon Sep 17 00:00:00 2001 From: Bastien Seree Date: Thu, 19 Dec 2024 16:06:07 +0100 Subject: [PATCH] EDF: [#128] add model test in generate order action --- backend/web/server/plugins/entreprisedufutur/actions.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/web/server/plugins/entreprisedufutur/actions.js b/backend/web/server/plugins/entreprisedufutur/actions.js index c66344fe6..681237806 100644 --- a/backend/web/server/plugins/entreprisedufutur/actions.js +++ b/backend/web/server/plugins/entreprisedufutur/actions.js @@ -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`) }