Skip to content

Commit

Permalink
fix: api validations
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael.Taylor committed Jan 6, 2022
1 parent 0b06b64 commit 97195c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/routes/v1/resources/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ const baseSchema = {
validationDate: Joi.string().required(),
projectTag: Joi.string().required(),
estimatedAnnualAverageEmissionReduction: Joi.number().required(),
projectLocations: Joi.array().min(1).optional(),
qualifications: Joi.array().min(1).optional(),
vintages: Joi.array().min(1).optional(),
coBenefits: Joi.array().min(1).optional(),
relatedProjects: Joi.array().min(1).optional(),
};

const postSchema = Joi.object({
Expand Down
7 changes: 4 additions & 3 deletions src/routes/v1/resources/units.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,22 @@ UnitRouter.get('/', validator.query(querySchema), (req, res) => {
});

const bodySchema = Joi.object({
orgUid: Joi.string().required(),
buyer: Joi.string().required(),
registry: Joi.string().required(),
blockIdentifier: Joi.string().required(),
identifier: Joi.string().required(),
qualificationId: Joi.number().required(),
qualifications: Joi.array().min(1).optional(),
unitType: Joi.string().required(),
unitCount: Joi.number().required(),
unitCount: Joi.string().required(),
unitStatus: Joi.string().required(),
unitStatusDate: Joi.string().required(),
transactionType: Joi.string().required(),
unitIssuanceLocation: Joi.string().required(),
unitLink: Joi.string().required(),
correspondingAdjustment: Joi.string().required(),
unitTag: Joi.string().required(),
vintageId: Joi.number().required(),
vintage: Joi.object().optional(),
});

UnitRouter.post('/', validator.body(bodySchema), UnitController.create);
Expand Down

0 comments on commit 97195c1

Please sign in to comment.