Organize/types/scheduled-todo.ts

42 lines
1.3 KiB
TypeScript

import type { RecurrenceInput } from "@/lib/validation/scheduled-todo";
/** One calendar occurrence of a ScheduledTodo -- a recurring to-do produces
* many of these, one per matching date, each independently completable. */
export interface ScheduledOccurrenceDTO {
scheduledTodoId: string;
title: string;
details: string | null;
// "YYYY-MM-DD"
occurrenceDate: string;
completed: boolean;
isRecurring: boolean;
}
export interface ScheduledDayDTO {
// "YYYY-MM-DD"
date: string;
occurrences: ScheduledOccurrenceDTO[];
}
/** Shape the Scheduled panel renders directly. */
export interface ScheduledBoardDTO {
// Missed occurrences from the last 30 days, oldest first. Empty when
// there's nothing outstanding -- the panel renders nothing for it then.
overdue: ScheduledOccurrenceDTO[];
today: ScheduledDayDTO;
// Tomorrow through Sunday of the current week, always one entry per day
// (even if empty) so the panel can render every remaining day's header.
upcoming: ScheduledDayDTO[];
}
/** The raw to-do, for the edit dialog -- distinct from ScheduledOccurrenceDTO,
* which is one date's occurrence rather than the whole series. */
export interface ScheduledTodoEditDTO {
id: string;
title: string;
details: string | null;
// "YYYY-MM-DD"
startDate: string;
recurrence: RecurrenceInput | null;
}