Files
anouma/collections/Availability.ts
T
maro 45261a0461 Initial commit: ANOUMA website with Payload CMS, WebRTC meetings, and booking system
- Next.js 16 App Router site with the ANOUMA design system
- Payload CMS (PostgreSQL) for offers, events, posts and page content
- WebRTC video-call system with custom signaling server
- SMTP email reminders and booking-request notifications
- Customer accounts, calendar-based availability, and booking workflow
2026-08-25 16:40:51 +02:00

70 lines
1.8 KiB
TypeScript

import type { CollectionConfig } from "payload";
import { isAdmin } from "@/access";
export const WEEKDAYS = [
{ label: "Montag", value: "monday" },
{ label: "Dienstag", value: "tuesday" },
{ label: "Mittwoch", value: "wednesday" },
{ label: "Donnerstag", value: "thursday" },
{ label: "Freitag", value: "friday" },
{ label: "Samstag", value: "saturday" },
{ label: "Sonntag", value: "sunday" },
] as const;
export const Availability: CollectionConfig = {
slug: "availability",
labels: {
singular: "Verfügbarkeit",
plural: "Verfügbarkeiten",
},
admin: {
useAsTitle: "weekday",
defaultColumns: ["weekday", "startTime", "endTime", "active"],
group: "Buchungen",
description: "Wiederkehrende wöchentliche Arbeitszeiten für Buchungsanfragen. Kein Eintrag = an diesem Tag nicht verfügbar.",
},
access: {
read: () => true,
create: isAdmin,
update: isAdmin,
delete: isAdmin,
},
fields: [
{
name: "weekday",
type: "select",
label: "Wochentag",
required: true,
options: [...WEEKDAYS],
},
{
type: "row",
fields: [
{
name: "startTime",
type: "date",
label: "Start",
required: true,
admin: { date: { pickerAppearance: "timeOnly", displayFormat: "HH:mm" }, width: "50%" },
},
{
name: "endTime",
type: "date",
label: "Ende",
required: true,
admin: { date: { pickerAppearance: "timeOnly", displayFormat: "HH:mm" }, width: "50%" },
},
],
},
{
name: "active",
type: "checkbox",
label: "Aktiv",
defaultValue: true,
admin: {
description: "Deaktivieren statt löschen, um eine Zeitspanne vorübergehend auszusetzen.",
},
},
],
};