feat: individual word link_to (F/A/B), edit form word management, fix picture-based suggestions

- Words in pair form now linkable individually per word (Frage/Aussage/Beide toggle)
- Edit form includes full word management: view existing words with link indicator, remove/restore, add new words with link_to selector
- Fix word suggestions: load from picture words (db_words_db_pictures) instead of object words (always empty)
- Backend PATCH /api/directus/db-pairs/<id> handles words_add with link_to and words_remove with junction IDs
- Level range 1-100 throughout

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-10 12:20:21 +02:00
parent 2e6cf094cb
commit 2595b8d32e
4 changed files with 236 additions and 31 deletions

View File

@@ -440,7 +440,7 @@ export async function createDbPair(
question_de?: string
statement_de: string
level: number
words: { titel_de: string; level: number }[]
words: { titel_de: string; level: number; link_to: 'question' | 'statement' | 'both' }[]
},
token: string
): Promise<{ ok: boolean; pair_id: string; statement_id: string; question_id: string | null }> {
@@ -465,7 +465,13 @@ export async function getDbObjectWords(objectId: string, token: string): Promise
export async function updateDbPair(
pairId: string,
payload: { level?: number; question_de?: string; statement_de?: string },
payload: {
level?: number
question_de?: string
statement_de?: string
words_add?: { titel_de: string; level: number; link_to: 'question' | 'statement' | 'both' }[]
words_remove?: { junction_id: number; link_to: 'question' | 'statement' | 'both' }[]
},
token: string
): Promise<void> {
const res = await fetch(`/api/directus/db-pairs/${pairId}`, {