feat(reflexion): ToDo-Titel inline editierbar

ToDos in der Reflexion lassen sich per Klick auf den Titel korrigieren
(z. B. Tippfehler), Enter speichert / Escape bricht ab. Neuer Endpoint
dayEntry.editTodoTitle — nur eigene ToDos vom heutigen Berlin-Tag,
ändert den Titel in-place (Status/Reihenfolge/IDs bleiben).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
dejanandClaude Opus 4.8 committed 2026-06-05 17:31:03 +02:00
1 parent 804b7637e7
commit 8933169ba9
3 files changed
+124 -2

No files matched your search

+31
View File
@@ -209,6 +209,37 @@ export const dayEntryRouter = router({
return result;
}),
/**
* Einzelnen ToDo-Titel korrigieren (z. B. Tippfehler) — auch noch in der
* Reflexion. Erlaubt, solange das ToDo der eigenen Person gehört und vom
* heutigen Berlin-Tag ist (gleiche Editierbarkeits-Regel wie die Reflexion).
*/
editTodoTitle: protectedProcedure
.input(DayEntrySchemas.editTodoTitleInput)
.mutation(async ({ ctx, input }) => {
const rows = await ctx.db
.select()
.from(todo)
.where(and(eq(todo.id, input.todoId), eq(todo.userId, ctx.user.id)))
.limit(1);
const existing = rows[0];
if (!existing) {
throw new TRPCError({ code: 'NOT_FOUND', message: 'ToDo nicht gefunden.' });
}
if (existing.date !== todayIso(new Date())) {
throw new TRPCError({
code: 'BAD_REQUEST',
message: 'ToDos eines Vortags können nicht mehr bearbeitet werden.',
});
}
const [updated] = await ctx.db
.update(todo)
.set({ title: input.title })
.where(eq(todo.id, input.todoId))
.returning();
return updated;
}),
/**
* Abend-Reflexion. Setzt Ampel + Trend, optional Blocker.
*/