Buchungskalender: Konfiguration, Schalter, Schema und Setup-Skript

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
knsoandClaude Opus 5.5 committed 2026-10-07 13:45:57 +00:00
1 parent 18369a348c
commit 5717a5cdd0
7 files changed
+728

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
import { config } from '../../config.js'
/**
* Buchungskalender-Schalter (Funktionsschluessel 'unterkunft'): UNTERKUNFT_ENABLED = off (Vorgabe) | pilot | on.
* Liest config.unterkunft bei jedem Aufruf. Bei off laufen keine Jobs und keine Abfragen des Moduls.
*/
/** 'off' | 'pilot' | 'on'; alles andere (leer, unbekannt) gilt als off. */
export function unterkunftModus() {
const mode = config.unterkunft.mode
return mode === 'pilot' || mode === 'on' ? mode : 'off'
}
/**
* Darf dieser Kunde den Buchungskalender nutzen? pilot = nur Adressen aus UNTERKUNFT_PILOT_EMAILS ('*' = alle; eine leere
* Liste laesst niemanden durch); on = alle Kunden; off = niemand.
*/
export function unterkunftFuerKunde(email) {
const modus = unterkunftModus()
if (modus === 'off') return false
if (modus === 'on') return true
const erlaubt = config.unterkunft.pilotEmails
if (erlaubt.includes('*')) return true
const adresse = String(email || '').trim().toLowerCase()
return adresse !== '' && erlaubt.includes(adresse)
}