feat(heute): ungeplant Erledigtes nachtragen (ENTWICKLUN-7)
Drive-by-Aufgaben ("btw, Yevgen-Security-Fix hab ich auch noch gemacht")
strukturiert erfassen statt nur im Freitext. Neues Feld todo.unplanned +
Endpoint dayEntry.addUnplanned: legt sofort ein erledigtes, als „ungeplant"
markiertes ToDo an.
- Schnell-Eingabe „Ungeplant erledigt" auf Heute (Mid-Day) und in der
Reflexion (End-of-Day-Recall).
- "ungeplant"-Badge in Heute, Reflexion und Historie.
- historyForDate liefert das unplanned-Flag mit.
- Reflexions-Freitext bleibt für die Tages-Story.
Migration 0012 (todo.unplanned).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
516b35bf15
commit
66adc49e2c
9 files changed
+3431
-3
No files matched your search
@@ -280,6 +280,47 @@ export const dayEntryRouter = router({
|
||||
return created;
|
||||
}),
|
||||
|
||||
/**
|
||||
* Ungeplant dazugekommenes & bereits erledigtes Item nachtragen
|
||||
* („btw, das habe ich heute auch noch gemacht"). Wird sofort als erledigt
|
||||
* und als ungeplant markiert.
|
||||
*/
|
||||
addUnplanned: protectedProcedure
|
||||
.input(DayEntrySchemas.addUnplannedInput)
|
||||
.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,
|
||||
status: 'done',
|
||||
unplanned: true,
|
||||
completedAt: new Date(),
|
||||
})
|
||||
.returning();
|
||||
return created;
|
||||
}),
|
||||
|
||||
/**
|
||||
* Abend-Reflexion. Setzt Ampel + Trend, optional Blocker.
|
||||
*/
|
||||
@@ -428,6 +469,7 @@ export const dayEntryRouter = router({
|
||||
title: t.title,
|
||||
status: t.status,
|
||||
dropReason: t.dropReason,
|
||||
unplanned: t.unplanned,
|
||||
})),
|
||||
}))
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
Reference in new issue
Block a user