telegram_notes_bot/notes/Implementation/event_alerts handler.js

16 lines
412 B
JavaScript
Raw Normal View History

2021-02-27 09:18:43 +00:00
const {req, res} = api;
const targetTemplate = await api.currentNote.getRelationValue("targetTemplateEvent");
const events = await api.getNotesWithLabel("template", targetTemplate);
let eventsData = [];
for (const event of events) {
const attr = await event.getAttribute("label", "startTime");
eventsData.push({
name: event.title,
startTime: attr.value
});
}
res.send(eventsData);