allow events without time

This commit is contained in:
Lachlan Kermode
2019-01-17 12:15:37 +00:00
committed by Franc Camps-Febrer
parent e25a634cf6
commit 798d0b0703

View File

@@ -3,22 +3,25 @@ import Joi from 'joi';
const eventSchema = Joi.object().keys({
id: Joi.string().required(),
description: Joi.string().allow('').required(),
date: Joi.string().required(),
time: Joi.string().required(),
date: Joi.string().allow(''),
time: Joi.string().allow(''),
time_precision: Joi.string().allow(''),
location: Joi.string().allow('').required(),
latitude: Joi.string().allow('').required(),
longitude: Joi.string().allow('').required(),
location: Joi.string().allow(''),
latitude: Joi.string().allow(''),
longitude: Joi.string().allow(''),
type: Joi.string().allow(''),
category: Joi.string().required(),
narratives: Joi.array(),
sources: Joi.array(),
tags: Joi.array().allow(''),
comments: Joi.string().allow(''),
timestamp: Joi.string().required(),
timestamp: Joi.string(),
// nested
narrative___stepStyles: Joi.array(),
});
})
.and('latitude', 'longitude')
.and('date', 'time', 'timestamp')
.or('timestamp', 'latitude')
export default eventSchema;
export default eventSchema