Terminplaner: Schalter, Konfiguration, Schema
Schalter TERMINE_ENABLED (off|pilot|on) mit TERMINE_PILOT_EMAILS, config.termine und die vier Collection-IDs, Schema der Termine-Collections als reine Daten (server/services/termine/schema.js), Setup-Skript scripts/termine-setup.mjs mit --check und schemaKeys() fuer den Appwrite-Nachbau der Tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f63165c158
commit
334dc1e669
7 files changed
+714
-1
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { config } from '../../config.js'
|
||||
|
||||
/**
|
||||
* Terminplaner-Schalter (Funktionsschluessel 'termine'): TERMINE_ENABLED = off (Vorgabe) | pilot | on.
|
||||
* Liest config.termine bei jedem Aufruf. Bei off laufen keine Termine-Jobs und keine Termine-Abfragen.
|
||||
*/
|
||||
|
||||
/** 'off' | 'pilot' | 'on'; alles andere (leer, unbekannt) gilt als off. */
|
||||
export function termineModus() {
|
||||
const mode = config.termine.mode
|
||||
return mode === 'pilot' || mode === 'on' ? mode : 'off'
|
||||
}
|
||||
|
||||
export function termineAus() {
|
||||
return termineModus() === 'off'
|
||||
}
|
||||
|
||||
/**
|
||||
* Darf dieser Kunde den Terminplaner nutzen? pilot = nur Adressen aus TERMINE_PILOT_EMAILS ('*' = alle; eine leere
|
||||
* Liste laesst niemanden durch); on = alle Kunden (TP1: pilot ohne E-Mail-Filter); off = niemand.
|
||||
*/
|
||||
export function termineFuerKunde(email) {
|
||||
const modus = termineModus()
|
||||
if (modus === 'off') return false
|
||||
if (modus === 'on') return true
|
||||
const erlaubt = config.termine.pilotEmails
|
||||
if (erlaubt.includes('*')) return true
|
||||
const adresse = String(email || '').trim().toLowerCase()
|
||||
return adresse !== '' && erlaubt.includes(adresse)
|
||||
}
|
||||
Reference in new issue
Block a user