feat: reminder due calculation

This commit is contained in:
opencode committed 2026-10-18 10:34:15 +02:00
1 parent f2b1d0293a
commit 6e1d0a7568
4 files changed
+72 -1

No files matched your search

+6
View File
@@ -2,6 +2,7 @@ import { NextRequest, NextResponse } from "next/server";
import { getDb } from "@/lib/db";
import { getVoucherStatus } from "@/lib/voucher-status";
import { validateVoucher, isExpiringSoon } from "@/lib/vouchers";
import { parseReminderDays } from "@/lib/reminders";
export async function GET(req: NextRequest) {
const filter = req.nextUrl.searchParams.get("filter");
@@ -47,6 +48,11 @@ export async function POST(req: NextRequest) {
kategorie: input.kategorie,
notiz: input.notiz,
contacts: contactIds.length ? { create: contactIds.map((contactId) => ({ contactId })) } : undefined,
rules: {
create: parseReminderDays(
typeof body.reminderDays === "string" ? body.reminderDays : Array.isArray(body.reminderDays) ? body.reminderDays.join(",") : undefined
).map((tageVorher) => ({ tageVorher })),
},
},
});
return NextResponse.json(created, { status: 201 });