ZEITEN_ENABLED/ZEITEN_PILOT_EMAILS/ZEITEN_KEIN_NEUBAU als config.zeiten (neben config.termine), zeitenSetup (30 € einmalig), Collection-IDs oeffnungszeiten und zeitenErinnerungen, Schema der beiden Collections plus fünf neue portalFeatures-Felder, scripts/zeiten-setup.mjs (idempotent, --check), schemaKeys kennt die neuen Collections und Felder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
import { config } from '../../config.js'
|
|
|
|
/**
|
|
* Oeffnungszeiten-Schalter (Funktionsschluessel 'zeiten'): ZEITEN_ENABLED = off (Vorgabe) | pilot | on.
|
|
* Liest config.zeiten bei jedem Aufruf. Bei off laufen keine Zeiten-Jobs und keine Zeiten-Abfragen.
|
|
*/
|
|
|
|
/** 'off' | 'pilot' | 'on'; alles andere (leer, unbekannt) gilt als off. */
|
|
export function zeitenModus() {
|
|
const mode = config.zeiten.mode
|
|
return mode === 'pilot' || mode === 'on' ? mode : 'off'
|
|
}
|
|
|
|
export function zeitenAus() {
|
|
return zeitenModus() === 'off'
|
|
}
|
|
|
|
/**
|
|
* Darf dieser Kunde Oeffnungszeiten live nutzen? pilot = nur Adressen aus ZEITEN_PILOT_EMAILS ('*' = alle; eine
|
|
* leere Liste laesst niemanden durch); on = alle Kunden; off = niemand.
|
|
*/
|
|
export function zeitenFuerKunde(email) {
|
|
const modus = zeitenModus()
|
|
if (modus === 'off') return false
|
|
if (modus === 'on') return true
|
|
const erlaubt = config.zeiten.pilotEmails
|
|
if (erlaubt.includes('*')) return true
|
|
const adresse = String(email || '').trim().toLowerCase()
|
|
return adresse !== '' && erlaubt.includes(adresse)
|
|
}
|