Skip to content

Commit

Permalink
fix(validation): address dateRange validation error (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
makinwab authored Jul 29, 2019
1 parent 35cd82a commit df609a9
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ const range = (type) => Joi.object({
max: Joi[type]().allow(null)
})

const rangeForDate = () => Joi.object({
before: Joi.string().optional().allow(null),
after: Joi.string().optional().allow(null),
min: Joi.string().optional().allow(null),
max: Joi.string().optional().allow(null)
})

const linkContentType = validation('linkContentType', Joi.array().items(Joi.string()))
const inValidation = validation('in', Joi.array())
const linkMimetypeGroup = validation('linkMimetypeGroup', Joi.array().items(Joi.string()))
Expand All @@ -27,7 +34,7 @@ const prohibitRegexp = validation('prohibitRegexp', Joi.object({
}))

const unique = validation('unique', Joi.boolean())
const dateRange = validation('dateRange', range('string'))
const dateRange = validation('dateRange', rangeForDate())

const assetImageDimensions = validation('assetImageDimensions', Joi.object({
width: range('number'),
Expand Down

0 comments on commit df609a9

Please sign in to comment.