refactor: maintain flat orders

This commit is contained in:
Carlos Valente
2025-04-17 10:12:06 +02:00
parent ed7f8a0aa2
commit a55dfba4ef
13 changed files with 71 additions and 25 deletions
@@ -71,7 +71,7 @@ export async function addEvent(eventData: EventPostPayload): Promise<OntimeEntry
}
// 2. if the user provides a parent (inside a group), we make sure it exists
let parent: EntryId | undefined;
let parent: EntryId | null = null;
if ('parent' in eventData && eventData.parent != null) {
if (!cache.hasId(eventData.parent)) {
throw new Error(`Parent event with ID ${eventData.parent} not found`);