Öffnungszeiten: Schalter, Collections und Felder
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>
This commit is contained in:
1 parent
385f768d76
commit
4b4cd1058f
7 files changed
+649
-3
No files matched your search
@@ -0,0 +1,30 @@
|
||||
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)
|
||||
}
|
||||
Reference in new issue
Block a user