Add customer contact fields and admin API docs (refs #41)

This commit is contained in:
Paul Nothaft
2025-10-14 18:29:21 +02:00
parent 8f297e25c4
commit 775c5159ea
21 changed files with 1124 additions and 103 deletions
+18 -6
View File
@@ -2,16 +2,27 @@ import { api } from '../config/api';
import type { Event } from '../types';
import { normalizeRequirePassword } from '../utils/accessControl';
const normalizeEvent = (event: Event): Event => ({
...event,
require_password: normalizeRequirePassword((event as any)?.require_password, true),
});
const normalizeEvent = (event: Event): Event => {
const legacyHostName = (event as any)?.host_name;
const legacyHostEmail = (event as any)?.host_email;
const customerName = event.customer_name ?? legacyHostName ?? undefined;
const customerEmail = event.customer_email ?? legacyHostEmail ?? '';
return {
...event,
customer_name: customerName,
customer_email: customerEmail,
require_password: normalizeRequirePassword((event as any)?.require_password, true),
};
};
interface CreateEventData {
event_type: string;
event_name: string;
event_date: string;
host_email: string;
customer_name?: string;
customer_email: string;
admin_email: string;
require_password?: boolean;
password?: string;
@@ -33,7 +44,8 @@ interface CreateEventData {
interface UpdateEventData {
event_name?: string;
event_date?: string;
host_email?: string;
customer_name?: string;
customer_email?: string;
admin_email?: string;
require_password?: boolean;
password?: string;