From 743ce57fd283698099b65dfe7b2ab00e6e1f5368 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Mon, 8 Aug 2022 15:25:09 -0400 Subject: [PATCH] fix: allow string fields to also accept numbers --- package.json | 2 +- src/validations/projects.validations.js | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 38c167da..5304da7c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "climate-warehouse", - "version": "1.1.1", + "version": "1.1.2", "private": true, "bin": "build/server.js", "type": "module", diff --git a/src/validations/projects.validations.js b/src/validations/projects.validations.js index 97db3a84..9c81d532 100644 --- a/src/validations/projects.validations.js +++ b/src/validations/projects.validations.js @@ -19,12 +19,16 @@ export const baseSchema = { originProjectId: Joi.alternatives() .try(Joi.string(), Joi.number()) .required(), - registryOfOrigin: Joi.string().required(), + registryOfOrigin: Joi.alternatives() + .try(Joi.string(), Joi.number()) + .required(), program: Joi.string().optional(), - projectName: Joi.string().required(), - projectLink: Joi.string().required(), - projectDeveloper: Joi.string().required(), - sector: Joi.string().required(), + projectName: Joi.alternatives().try(Joi.string(), Joi.number()).required(), + projectLink: Joi.alternatives().try(Joi.string(), Joi.number()).required(), + projectDeveloper: Joi.alternatives() + .try(Joi.string(), Joi.number()) + .required(), + sector: Joi.alternatives().try(Joi.string(), Joi.number()).required(), projectType: Joi.string() .custom(pickListValidation('projectType')) .required(), @@ -38,7 +42,7 @@ export const baseSchema = { .required(), projectStatusDate: Joi.date().required(), unitMetric: Joi.string().custom(pickListValidation('unitMetric')).required(), - methodology: Joi.string().required(), + methodology: Joi.alternatives().try(Joi.string(), Joi.number()).required(), methodology2: Joi.string().optional(), validationBody: Joi.string() .custom(pickListValidation('validationBody'))