Files
everythingbutwork/packages/shared/src/schemas/time-entry.ts
T
dejanandClaude Opus 4.8 7f9a4506c5
ci / quality (push) Failing after 45s
ci / build (push) Has been skipped
deploy / deploy (push) Successful in 53s
refactor(zeit): Pausen nicht mehr buchen — Lücken zwischen Tasks = Pause
Pause-Feature entfernt: kein Pause-Button, kein break-Buchen mehr. Man bucht
nur Tasks; stoppt man eine Task und es läuft keine andere, ist die Lücke
automatisch eine Pause — im Kalender/Tagesansicht schlicht leer. Tasks bleiben
pausierbar (Stop = Pause, erneut Start = Fortsetzen → mehrere Segmente auf
dieselbe Task, Lücke dazwischen leer). Wall-Clock zählt Lücken ohnehin nicht.

- time.pause-Endpoint entfernt; 'break' aus der angebotenen Kategorienliste
  raus (bleibt im Enum für Altdaten).
- TimerPill: Pause-Button + Pause-Panel-Grund entfernt; Stop/Start je Task bleibt
  (= pausieren/fortsetzen). Heute-ToDo-Zeile entsprechend beschriftet.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-06 18:56:54 +02:00

56 lines
1.8 KiB
TypeScript

import { z } from 'zod';
export const timeCategorySchema = z.enum([
'focus',
'meeting',
'break',
'admin',
'learning',
'other',
]);
export type TimeCategory = z.infer<typeof timeCategorySchema>;
export const TIME_CATEGORIES: { value: TimeCategory; label: string }[] = [
{ value: 'focus', label: 'Fokus' },
{ value: 'meeting', label: 'Meeting' },
{ value: 'admin', label: 'Admin' },
{ value: 'learning', label: 'Lernen' },
{ value: 'other', label: 'Sonstiges' },
];
// 'break' bleibt im Enum (timeCategorySchema) für Altdaten, wird aber nicht mehr
// angeboten — Pausen werden nicht gebucht (Lücken zwischen Tasks = Pause).
export const startTimeEntryInput = z.object({
todoId: z.string().uuid().optional(),
category: timeCategorySchema.default('focus'),
description: z.string().max(200).optional(),
});
export type StartTimeEntryInput = z.infer<typeof startTimeEntryInput>;
export const updateTimeEntryInput = z.object({
id: z.string().uuid(),
startedAt: z.string().datetime().optional(),
endedAt: z.string().datetime().nullable().optional(),
todoId: z.string().uuid().nullable().optional(),
category: timeCategorySchema.optional(),
description: z.string().max(200).nullable().optional(),
});
export type UpdateTimeEntryInput = z.infer<typeof updateTimeEntryInput>;
export const teamTimelineInput = z.object({
date: z
.string()
.regex(/^\d{4}-\d{2}-\d{2}$/)
.optional(), // Default: heute
});
export type TeamTimelineInput = z.infer<typeof teamTimelineInput>;
export const manualTimeEntryInput = z.object({
startedAt: z.string().datetime(),
endedAt: z.string().datetime(),
todoId: z.string().uuid().optional(),
category: timeCategorySchema.default('focus'),
description: z.string().max(200).optional(),
});
export type ManualTimeEntryInput = z.infer<typeof manualTimeEntryInput>;