implicit ids in events

This commit is contained in:
Lachlan Kermode
2020-06-19 10:45:50 +02:00
parent 00a8080eba
commit 3a847a2042
2 changed files with 3 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
import Joi from 'joi'
const eventSchema = Joi.object().keys({
id: Joi.string().required(),
id: Joi.string().allow(''),
description: Joi.string().allow('').required(),
date: Joi.string().allow(''),
time: Joi.string().allow(''),

View File

@@ -164,7 +164,8 @@ export function validateDomain (domain) {
sanitizedDomain.filters = domain.filters
// append events with datetime and sort
sanitizedDomain.events.forEach(event => {
sanitizedDomain.events.forEach((event, idx) => {
event.id = idx
event.datetime = calcDatetime(event.date, event.time)
})