Fix distractor_words special=m2m in Directus via eigenen Endpoint

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 20:25:09 +02:00
parent 434dbb2b4a
commit c2a2b0e6f7
2 changed files with 26 additions and 4 deletions

View File

@@ -323,10 +323,14 @@ export default function GenerateIt() {
title="Directus-Schema einmalig konfigurieren (M2M-Relationen)"
onClick={async () => {
if (!token) return
const res = await fetch('/api/setup-schema', { method: 'POST', headers: { Authorization: `Bearer ${token}` } })
const d = await res.json()
alert(`Setup: ${d.total} Schritte, ${d.failed} Fehler.\nSiehe Konsole für Details.`)
console.log('[setup-schema]', d)
const h = { Authorization: `Bearer ${token}` }
const [r1, r2] = await Promise.all([
fetch('/api/setup-schema', { method: 'POST', headers: h }),
fetch('/api/fix-distractor-field', { method: 'POST', headers: h }),
])
const [d1, d2] = await Promise.all([r1.json(), r2.json()])
alert(`Setup: ${d1.total} Schritte, ${d1.failed} Fehler\nDistractor-Fix: ${d2.ok ? 'OK' : 'Fehler'}`)
console.log('[setup-schema]', d1, '[fix-distractor]', d2)
}}
>
Schema