Analyse: Freischalten selbstheilend, Sperre, Retention-Abschaltung
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f0eee196ed
commit
37203f00c4
6 files changed
+149
-33
No files matched your search
@@ -1,9 +1,10 @@
|
||||
import { rm } from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import { config } from '../config.js'
|
||||
import { deleteDocument, listDocuments, Query } from './appwriteAdmin.js'
|
||||
import { deleteDocument, getDocument, listDocuments, Query } from './appwriteAdmin.js'
|
||||
import { deleteNewsImage } from './newsImages.js'
|
||||
import { disable } from './siteFeatures.js'
|
||||
import { analyseDeps, analyseDomains } from './analyse.js'
|
||||
import { getStripe } from './stripeBilling.js'
|
||||
import { filesOf, STATUS } from './takeoverCredits.js'
|
||||
|
||||
@@ -219,7 +220,18 @@ export async function applyDeletions(plan) {
|
||||
}
|
||||
for (const id of entry.featureIds) {
|
||||
const off = await attempt('portalFeatures', id, async () => {
|
||||
const feature = await getDocument(FEATURES(), id).catch(() => null)
|
||||
await disable(id, { adminNote: 'Abgeschaltet: Aufbewahrungsfrist abgelaufen' })
|
||||
// Analyse: auch den Sammeldienst abschalten (best effort, die Daten loescht dessen 60-Tage-Job)
|
||||
if (feature?.featureKey === 'analyse' && feature.siteKey) {
|
||||
try {
|
||||
// der Sammeldienst verlangt mindestens eine Domain, auch beim Abschalten
|
||||
const project = await getDocument(config.collections.websiteProjects, feature.projectId)
|
||||
await analyseDeps.client.putSite(feature.siteKey, { projectId: feature.projectId, domains: analyseDomains(project), active: false })
|
||||
} catch (err) {
|
||||
console.warn(`[retention] Sammeldienst für Analyse ${id} nicht abgeschaltet:`, err.message)
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
if (off) deleted.features += 1
|
||||
|
||||
Reference in new issue
Block a user