telegram_notes_bot/notes/Implementation/event_alerts handler.js
2021-04-23 10:48:42 +02:00

16 lines
412 B
JavaScript

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);