inherits the tags from the parent event, fix #138

This commit is contained in:
lesion
2022-01-27 23:15:14 +01:00
parent 0b96e653b1
commit cf51c3aedc

View File

@@ -627,7 +627,8 @@ const eventController = {
log.info(cursor)
event.start_datetime = cursor.unix()
event.end_datetime = event.start_datetime + duration
Event.create(event)
const newEvent = await Event.create(event)
return newEvent.addTags(e.tags)
},
/**
@@ -637,8 +638,9 @@ const eventController = {
// select recurrent events and its childs
const events = await Event.findAll({
where: { is_visible: true, recurrent: { [Op.ne]: null } },
include: [{ model: Event, as: 'child', required: false, where: { start_datetime: { [Op.gte]: start_datetime } } }],
order: ['start_datetime']
include: [{ model: Tag, required: false },
{ model: Event, as: 'child', required: false, where: { start_datetime: { [Op.gte]: start_datetime } }}],
order: [['child', 'start_datetime', 'DESC']]
})
// filter events that as no instance in future yet
const creations = events