Skip to content

Commit

Permalink
feat: add fields to joi validations
Browse files Browse the repository at this point in the history
  • Loading branch information
siddarth2824 committed Aug 8, 2024
1 parent f11e827 commit ca7584a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/app/modules/form/admin-form/admin-form.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
FormSettings,
FormWebhookResponseModeSettings,
FormWebhookSettings,
Language,
LogicConditionState,
LogicDto,
LogicIfValue,
Expand Down Expand Up @@ -2451,6 +2452,28 @@ export const handleUpdateEndPage = [
.message('Please enter a valid HTTP or HTTPS URI'),
buttonText: Joi.string().allow(''),
// TODO(#1895): Remove when deprecated `buttons` key is removed from all forms in the database
titleTranslations: Joi.array()
.items(
Joi.object({
language: Joi.string()
.valid(...Object.values(Language))
.required(),
translation: Joi.string().required(),
}),
)
.optional()
.default([]),
paragraphTranslations: Joi.array()
.items(
Joi.object({
language: Joi.string()
.valid(...Object.values(Language))
.required(),
translation: Joi.string().required(),
}),
)
.optional()
.default([]),
}).unknown(true),
}),
_handleUpdateEndPage,
Expand Down Expand Up @@ -2737,6 +2760,17 @@ export const handleUpdateStartPage = [
otherwise: Joi.any().forbidden(),
}),
}).required(),
paragraphTranslations: Joi.array()
.items(
Joi.object({
language: Joi.string()
.valid(...Object.values(Language))
.required(),
translation: Joi.string().required(),
}),
)
.optional()
.default([]),
},
}),
_handleUpdateStartPage,
Expand Down

0 comments on commit ca7584a

Please sign in to comment.