Implementiere Kundenportal mit zentraler Appwrite-Anbindung.

Express-Server für Appwrite-Auth, Session, Projekt-Dashboard und Gitea-Webhook; statisches Frontend und Schema-Dokumentation für woms-database.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-22 23:38:38 +02:00
commit f31727aeb4
23 changed files with 2056 additions and 0 deletions

36
server/routes/features.js Normal file
View File

@@ -0,0 +1,36 @@
import { Router } from 'express'
import { Query } from 'node-appwrite'
import { config } from '../config.js'
import { listDocuments } from '../services/appwriteAdmin.js'
import { getSessionCustomerId, requireSession } from '../middleware/session.js'
const router = Router()
router.get('/', requireSession, async (req, res) => {
const customerId = getSessionCustomerId(req)
if (!customerId) {
return res.status(401).json({ error: 'Nicht angemeldet' })
}
try {
const features = await listDocuments(config.collections.portalFeatures, [
Query.equal('customerId', customerId),
Query.equal('enabled', true),
])
const sanitized = features.map((f) => ({
id: f.$id,
projectId: f.projectId || '',
featureKey: f.featureKey || '',
enabled: Boolean(f.enabled),
unlockedByPurchase: Boolean(f.unlockedByPurchase),
purchaseStatus: f.purchaseStatus || '',
}))
return res.json({ features: sanitized })
} catch (err) {
return res.status(500).json({ error: err.message || 'Features konnten nicht geladen werden' })
}
})
export default router