Buchungskalender: Verdrahtung, Router-Gerüste und API-Vertrag
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1d2ca2791d
commit
a68baf10d9
37 files changed
+888
-30
No files matched your search
@@ -190,12 +190,13 @@ const fehlerText = (err) =>
|
||||
* Eingaben (TypeError) oder wenn das Speichern scheitert; dann ist nichts gespeichert und nichts gesendet.
|
||||
* `ics` und `icsMethod` gehoeren zusammen: die METHOD-Zeile der Kalenderdatei muss icsMethod entsprechen.
|
||||
* @param {{ featureId: string, bookingId: string, art: string, an: string, fromName: string, replyTo?: string|null,
|
||||
* template: string, values?: object, blocks?: object, ics?: string|null, icsMethod?: 'REQUEST'|'CANCEL'|'PUBLISH' }} daten
|
||||
* template: string, values?: object, blocks?: object, ics?: string|null, icsMethod?: 'REQUEST'|'CANCEL'|'PUBLISH',
|
||||
* anhang?: string|null (Verweis auf einen Anhang, max. 500 Zeichen; wird nur gespeichert) }} daten
|
||||
* @param {Date} [now]
|
||||
* @returns {Promise<object>} das gespeicherte Dokument (Status wartet)
|
||||
*/
|
||||
export async function einreihen(
|
||||
{ featureId, bookingId, art, an, fromName, replyTo = null, template, values = {}, blocks = {}, ics = null, icsMethod = 'REQUEST' },
|
||||
{ featureId, bookingId, art, an, fromName, replyTo = null, template, values = {}, blocks = {}, ics = null, icsMethod = 'REQUEST', anhang = null },
|
||||
now = new Date(),
|
||||
) {
|
||||
for (const [wert, name] of [[featureId, 'featureId'], [bookingId, 'bookingId'], [art, 'art'], [an, 'an'], [fromName, 'fromName'], [template, 'template']]) {
|
||||
@@ -207,6 +208,8 @@ export async function einreihen(
|
||||
if (!new RegExp(`^METHOD:${icsMethod}\\r?$`, 'm').test(ics)) throw new TypeError(`ics: METHOD passt nicht zu icsMethod ${icsMethod}`)
|
||||
}
|
||||
|
||||
if (anhang !== null && anhang !== undefined && (typeof anhang !== 'string' || anhang.length > 500)) throw new TypeError('anhang muss ein Text bis 500 Zeichen sein')
|
||||
|
||||
const mail = renderMail(template, values, blocks)
|
||||
for (const problem of mail.problems) console.warn(`[termine-outbox] Vorlage ${template}: ${problem}`)
|
||||
|
||||
@@ -222,6 +225,7 @@ export async function einreihen(
|
||||
text: mail.text,
|
||||
ics: ics || '',
|
||||
icsMethod: ics ? icsMethod : '',
|
||||
anhang: anhang || '',
|
||||
status: 'wartet',
|
||||
versuche: 0,
|
||||
naechsterVersuch: iso(nowMs),
|
||||
|
||||
@@ -110,6 +110,8 @@ export const TERMINE_COLLECTIONS = {
|
||||
str('text', 50000),
|
||||
str('ics', 20000),
|
||||
str('icsMethod', 8),
|
||||
// optional: Verweis auf einen Anhang (Buchungskalender: Rechnungs-PDF, Task 20); wird nur gespeichert, das Senden bleibt unveraendert
|
||||
str('anhang', 500),
|
||||
str('status', 16),
|
||||
int('versuche'),
|
||||
dt('naechsterVersuch'),
|
||||
|
||||
Reference in new issue
Block a user