diff --git a/backend/services/vocabService.js b/backend/services/vocabService.js index ccdf945..ff42d9c 100644 --- a/backend/services/vocabService.js +++ b/backend/services/vocabService.js @@ -606,7 +606,19 @@ export default class VocabService { } // Kombiniere alle AND-Bedingungen + // Wenn sowohl andConditions als auch direkte where-Eigenschaften existieren, + // müssen sie kombiniert werden if (andConditions.length > 0) { + // Wenn where bereits direkte Eigenschaften hat, füge sie zu andConditions hinzu + const directWhereProps = Object.keys(where).filter(key => key !== Op.and && key !== Op.or); + if (directWhereProps.length > 0) { + const directWhere = {}; + for (const key of directWhereProps) { + directWhere[key] = where[key]; + delete where[key]; + } + andConditions.push(directWhere); + } where[Op.and] = andConditions; } @@ -621,7 +633,9 @@ export default class VocabService { languageId, nativeLanguageId, search, - where: JSON.stringify(where, null, 2) + where: JSON.stringify(where, null, 2), + includePublic, + includeOwn }); const coursesData = courses.map(c => c.get({ plain: true }));