Analyse: Lesezugriff fuer WOMS
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
821e947275
commit
0b59dac2be
4 files changed
+91
-4
No files matched your search
@@ -30,7 +30,11 @@ function previewUrlFor(p) {
|
||||
|
||||
router.get('/', async (_req, res) => {
|
||||
try {
|
||||
const { kinds, features } = servicesCatalog()
|
||||
const { kinds, features: catalogFeatures } = servicesCatalog()
|
||||
// Katalog nicht mutieren: Analyse ist 'available', sobald der Schalter ANALYSE_ENABLED an ist
|
||||
const features = config.analyse.enabled
|
||||
? { ...catalogFeatures, analyse: { ...catalogFeatures.analyse, status: 'available' } }
|
||||
: catalogFeatures
|
||||
const projRes = await listDocuments(config.collections.websiteProjects, [Query.limit(5000)])
|
||||
const projects = (projRes || []).filter((p) => !p.archived && !p.isTemplate)
|
||||
|
||||
@@ -39,6 +43,12 @@ router.get('/', async (_req, res) => {
|
||||
loadByIds(config.collections.workorders, projects.map((p) => p.ticketId)),
|
||||
])
|
||||
|
||||
const analyseDocs = await listDocuments(config.collections.portalFeatures, [
|
||||
Query.equal('featureKey', 'analyse'),
|
||||
Query.limit(5000),
|
||||
])
|
||||
const analyseState = new Map((analyseDocs || []).map((d) => [d.projectId, d.state || 'off']))
|
||||
|
||||
const groups = {}
|
||||
for (const p of projects) {
|
||||
const key = kinds.some((k) => k.key === p.kind) ? p.kind : 'missing'
|
||||
@@ -52,7 +62,7 @@ router.get('/', async (_req, res) => {
|
||||
woid: tickets.get(p.ticketId)?.woid || '',
|
||||
previewUrl: previewUrlFor(p),
|
||||
previewState: p.previewState || '',
|
||||
features: {},
|
||||
features: { analyse: analyseState.get(p.$id) || null },
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user