feat: better reminder tab
CI / build-and-test (push) Canceled after 0s

This commit is contained in:
2026-10-20 10:39:06 +02:00
parent 874f68b4b1
commit fb6d26a468
8 changed files with 441 additions and 86 deletions
+17 -6
View File
@@ -70,10 +70,16 @@ export interface PlannedTab {
export interface ReminderCandidate {
tabId: string;
customerName: string;
email: string;
/** Null when the customer has no email address on file */
email: string | null;
amountInCents: number;
itemCount: number;
items: TabLine[] | null;
reminderCount: number;
lastReminderAt: string | null;
nextEligibleAt: string | null;
/** Has an email and is past the cooldown */
eligible: boolean;
}
export interface Reminder {
@@ -274,11 +280,16 @@ export const plannedTabsApi = {
// Reminders API
export const remindersApi = {
candidates: (venueId: string) =>
api<{ candidates: ReminderCandidate[] }>(`/venues/${venueId}/reminders/candidates`),
send: (venueId: string) =>
api<{ sent: number; total: number; errors?: { customerName: string; error: string }[] }>(`/venues/${venueId}/reminders/send`, { method: 'POST' }),
history: (venueId: string) =>
api<{ reminders: Reminder[] }>(`/venues/${venueId}/reminders`),
api<{ candidates: ReminderCandidate[]; cooldownDays: number }>(`/venues/${venueId}/reminders/candidates`),
send: (venueId: string, tabIds: string[]) =>
api<{ sent: number; total: number; errors?: { customerName: string; error: string }[] }>(`/venues/${venueId}/reminders/send`, {
method: 'POST',
body: JSON.stringify({ tabIds }),
}),
history: (venueId: string, customerName?: string) =>
api<{ reminders: Reminder[] }>(
`/venues/${venueId}/reminders${customerName ? `?customerName=${encodeURIComponent(customerName)}` : ''}`,
),
sendTest: (venueId: string, plannedTabId: string) =>
api<{ ok: boolean; email: string; customerName: string }>(`/venues/${venueId}/reminders/test/${plannedTabId}`, { method: 'POST' }),
};