Skip to content

Commit

Permalink
fix: joi
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Mar 7, 2024
1 parent ddf21be commit f437359
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/validations/projects.validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,22 @@ export const projectsGetQuerySchema = Joi.object({
order: Joi.string().regex(genericSortColumnRegex).optional(),
filter: Joi.string().regex(genericFilterRegex).optional(),
onlyMarketplaceProjects: Joi.boolean().optional(),
}).when(Joi.object({ warehouseProjectId: Joi.string().required() }).unknown(), {
then: Joi.object({
page: Joi.number().optional(),
limit: Joi.number().optional(),
}),
otherwise: Joi.object({
page: Joi.number().required(),
limit: Joi.number().required(),
}),
});
}).when(
Joi.alternatives([
Joi.object({ projectIds: Joi.string().required() }).unknown(),
Joi.object({ warehouseProjectId: Joi.string().required() }).unknown(),
]),
{
then: Joi.object({
page: Joi.number().optional(),
limit: Joi.number().optional(),
}),
otherwise: Joi.object({
page: Joi.number().required(),
limit: Joi.number().required(),
}),
},
);

export const projectsPostSchema = Joi.object({
...baseSchema,
Expand Down

0 comments on commit f437359

Please sign in to comment.