feat(heute): ToDos mitten am Tag hinzufügen
ci / quality (push) Failing after 33s
ci / build (push) Has been skipped
deploy / deploy (push) Successful in 52s

Nach dem Lock-in konnte man ToDos nur bearbeiten/abhaken, aber keine neuen
anlegen. Neuer Endpoint dayEntry.addTodo hängt ein einzelnes ToDo an den
heutigen Tageseintrag an (erlaubt solange der Eintrag vom heutigen
Berlin-Tag ist, auch nach der Reflexion). Inline-Feld „Neues ToDo
hinzufügen" in der EinstempeltView; aktualisiert Heute + Dashboard-Sichten.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
dejanandClaude Opus 4.8 committed 2026-06-06 15:47:54 +02:00
1 parent bcae44eeb3
commit 68480c1eb1
3 files changed
+85

No files matched your search

+40
View File
@@ -240,6 +240,46 @@ export const dayEntryRouter = router({
return updated;
}),
/**
* Einzelnes ToDo mitten am Tag hinzufügen (auch nach der Reflexion möglich,
* solange der Tageseintrag vom heutigen Berlin-Tag ist).
*/
addTodo: protectedProcedure
.input(DayEntrySchemas.addTodoInput)
.mutation(async ({ ctx, input }) => {
const date = todayIso();
const entry = (
await ctx.db
.select()
.from(dayEntry)
.where(and(eq(dayEntry.userId, ctx.user.id), eq(dayEntry.date, date)))
.limit(1)
)[0];
if (!entry) {
throw new TRPCError({
code: 'BAD_REQUEST',
message: 'Du bist heute noch nicht locked in.',
});
}
const existing = await ctx.db
.select({ id: todo.id })
.from(todo)
.where(eq(todo.dayEntryId, entry.id));
const [created] = await ctx.db
.insert(todo)
.values({
dayEntryId: entry.id,
userId: ctx.user.id,
date: entry.date,
title: input.title,
order: existing.length,
bezugKind: input.bezugKind ?? null,
bezugId: input.bezugId ?? null,
})
.returning();
return created;
}),
/**
* Abend-Reflexion. Setzt Ampel + Trend, optional Blocker.
*/