Terminplaner TP2 B6: Nachbesserung 1
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ded6bb2a77
commit
1f6ae0f7e0
2 files changed
+4
-16
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { config } from '../config.js'
|
||||
import { getDocument } from './appwriteAdmin.js'
|
||||
import { aboMemo } from './aboStatus.js'
|
||||
import { oeffentlicheAnsicht } from './featureRegistry.js'
|
||||
import { ladeEinstellung } from './termine/kontext.js'
|
||||
import { istObjekt } from './termine/ablauf.js'
|
||||
import { holeOderNull, ladeEinstellung } from './termine/kontext.js'
|
||||
|
||||
// Bausteine der Bestell-Vorpruefungen (POST /api/funktionen/:key/checkout, Task B6): Zustimmung, Abo-Hinweistexte,
|
||||
// Entwurf des Terminplaners. Die Route in routes/funktionen.js legt die Reihenfolge fest; jede Stufe hier ist
|
||||
@@ -32,7 +32,6 @@ const FASSUNG_VERALTET = 'Die Erklärungen wurden inzwischen geändert. Bitte li
|
||||
const MAX_HAKEN = 50
|
||||
|
||||
const fehlt = () => bestellFehler(400, ZUSTIMMUNG_FEHLT, 'zustimmung_fehlt')
|
||||
const istObjekt = (wert) => wert !== null && typeof wert === 'object' && !Array.isArray(wert)
|
||||
const hatWert = (wert) => wert !== undefined && wert !== null
|
||||
|
||||
/**
|
||||
@@ -92,18 +91,6 @@ export function aboMeldung(feature, grund) {
|
||||
return text(feature?.mails?.formen?.akk || 'diese Funktion')
|
||||
}
|
||||
|
||||
/** 404 "Dokument fehlt" (nicht: Collection oder Datenbank fehlt). */
|
||||
const dokumentFehlt = (err) => err?.status === 404 && err.type !== 'collection_not_found' && err.type !== 'database_not_found'
|
||||
|
||||
async function holeOderNull(collectionId, id) {
|
||||
try {
|
||||
return await getDocument(collectionId, id)
|
||||
} catch (err) {
|
||||
if (dokumentFehlt(err)) return null
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
// Fragebogen aus termineConfig.fragebogen (JSON-Text): nur ein Objekt zaehlt, fehlend oder kaputt ist null
|
||||
function liesFragebogen(text) {
|
||||
if (typeof text !== 'string' || text === '') return null
|
||||
|
||||
@@ -42,7 +42,8 @@ const istObjekt = (wert) => wert !== null && typeof wert === 'object' && !Array.
|
||||
/** 404 "Dokument fehlt" (nicht: Collection oder Datenbank fehlt). */
|
||||
const dokumentFehlt = (err) => err?.status === 404 && err.type !== 'collection_not_found' && err.type !== 'database_not_found'
|
||||
|
||||
async function holeOderNull(collectionId, id) {
|
||||
/** Dokument lesen; fehlt es (404 "Dokument fehlt"), ist das Ergebnis null. Fehlt Collection oder Datenbank, wird der Fehler weitergereicht. */
|
||||
export async function holeOderNull(collectionId, id) {
|
||||
try {
|
||||
return await getDocument(collectionId, id)
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user