Kundenansicht P6: alte Abgleiche lassen Abo-Modell-Dokumente dem neuen Abgleich, Zeiten ohne Behalten

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-10-16 16:46:15 +00:00
1 parent d8c952ac2a
commit 7a03f073bc
5 files changed
+125 -11

No files matched your search

+3 -1
View File
@@ -1,5 +1,6 @@
import { config } from '../../config.js'
import { aboLage } from '../aboStatus.js'
import { istAboModell } from '../aboModell.js'
import { getDocument, updateDocument } from '../appwriteAdmin.js'
import { featureConfig } from '../featureRegistry.js'
import { withLocks } from '../keyedLock.js'
@@ -43,9 +44,10 @@ async function datenDa(featureId) {
/**
* Darf der Kunde die Funktion jetzt behalten? In Einrichtung oder aktiv: sobald das Ende des Abos erkannt ist (aboEndeAt). Abgeschaltet:
* nur nach dem Abo-Ende (disabledReason abo_ende, nicht: Team, vor der Einrichtung, Kunde geloescht) und solange die Eingaben noch da sind.
* Nie fuer ein Dokument des Abo-Modells (istAboModell).
*/
async function behaltenMoeglich(doc) {
if (!doc) return false
if (!doc || istAboModell(doc)) return false // Abo-Modell (P6): kein Behalten gegen Zahlung, die Funktion endet mit dem Abo und kehrt mit einem neuen zurueck
if (doc.state === 'setup' || doc.state === 'active') return Boolean(doc.aboEndeAt)
if (doc.state === 'disabled' && doc.disabledReason === 'abo_ende') return datenDa(doc.$id)
return false