Archived
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>
90 lines
2.8 KiB
TypeScript
90 lines
2.8 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export const ampelSchema = z.enum(['green', 'amber', 'red']);
|
|
export const trendSchema = z.enum(['besser', 'gleich', 'schlechter']);
|
|
export const bezugKindSchema = z.enum(['project', 'deal', 'campaign', 'allgemein']);
|
|
export const todoStatusSchema = z.enum(['open', 'done', 'dropped']);
|
|
|
|
export const todoInputSchema = z.object({
|
|
title: z.string().min(1).max(200),
|
|
bezugKind: bezugKindSchema.optional(),
|
|
bezugId: z.string().uuid().optional(),
|
|
});
|
|
export type TodoInput = z.infer<typeof todoInputSchema>;
|
|
|
|
export const checkInInput = z.object({
|
|
todos: z.array(todoInputSchema).min(1),
|
|
date: z
|
|
.string()
|
|
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
.optional(), // Default: heute
|
|
});
|
|
export type CheckInInput = z.infer<typeof checkInInput>;
|
|
|
|
export const submitReflectionInput = z.object({
|
|
dayEntryId: z.string().uuid(),
|
|
todos: z
|
|
.array(
|
|
z.object({
|
|
id: z.string().uuid(),
|
|
status: todoStatusSchema,
|
|
dropReason: z.string().max(200).optional(),
|
|
}),
|
|
)
|
|
.default([]),
|
|
reflectionText: z.string().max(1000).default(''),
|
|
ampel: ampelSchema,
|
|
trend: trendSchema.nullable().optional(),
|
|
blocker: z
|
|
.object({
|
|
title: z.string().min(1).max(200),
|
|
description: z.string().max(1000).optional(),
|
|
})
|
|
.optional(),
|
|
url: z.string().url().optional(),
|
|
});
|
|
export type SubmitReflectionInput = z.infer<typeof submitReflectionInput>;
|
|
|
|
export const todoMutationInput = z.object({
|
|
dayEntryId: z.string().uuid(),
|
|
todos: z.array(todoInputSchema).min(0),
|
|
});
|
|
export type TodoMutationInput = z.infer<typeof todoMutationInput>;
|
|
|
|
export const editTodoTitleInput = z.object({
|
|
todoId: z.string().uuid(),
|
|
title: z.string().min(1).max(200),
|
|
});
|
|
export type EditTodoTitleInput = z.infer<typeof editTodoTitleInput>;
|
|
|
|
// Einzelnes ToDo mitten am Tag zum heutigen Tageseintrag hinzufügen.
|
|
export const addTodoInput = z.object({
|
|
title: z.string().min(1).max(200),
|
|
bezugKind: bezugKindSchema.optional(),
|
|
bezugId: z.string().uuid().optional(),
|
|
});
|
|
export type AddTodoInput = z.infer<typeof addTodoInput>;
|
|
|
|
// Ungeplant dazugekommenes & bereits erledigtes Item nachtragen (Drive-by).
|
|
export const addUnplannedInput = z.object({
|
|
title: z.string().min(1).max(200),
|
|
bezugKind: bezugKindSchema.optional(),
|
|
bezugId: z.string().uuid().optional(),
|
|
});
|
|
export type AddUnplannedInput = z.infer<typeof addUnplannedInput>;
|
|
|
|
export const historyForDateInput = z.object({
|
|
date: z
|
|
.string()
|
|
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
.optional(), // Default: vorheriger Werktag
|
|
});
|
|
export type HistoryForDateInput = z.infer<typeof historyForDateInput>;
|
|
|
|
export const markAbsentInput = z.object({
|
|
from: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
to: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
reason: z.enum(['urlaub', 'krank', 'sonstiges']),
|
|
});
|
|
export type MarkAbsentInput = z.infer<typeof markAbsentInput>;
|