feat: contacts and voucher assignment

This commit is contained in:
opencode committed 2026-10-18 10:33:05 +02:00
1 parent c86ec8bd36
commit f2b1d0293a
8 files changed
+154 -4

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
export function validateContact(c: { name: string; email: string | null; telegramChatId: string | null }): string[] {
const errs: string[] = [];
if (!c.name?.trim()) errs.push("name");
const email = c.email?.trim() ?? "";
const chat = c.telegramChatId?.trim() ?? "";
if (!email && !chat) errs.push("kanal");
if (email && !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) errs.push("email");
return errs;
}