Add categoryIds to article.listSearchIndex response
This commit is contained in:
@@ -187,7 +187,14 @@ SELECT
|
||||
WHERE ae.article_id = a.id
|
||||
ORDER BY ae.ean
|
||||
FOR JSON PATH
|
||||
) AS eansJson
|
||||
) AS eansJson,
|
||||
(
|
||||
SELECT ca2.category_id
|
||||
FROM categoryarticle ca2
|
||||
WHERE ca2.article_id = a.id
|
||||
ORDER BY ca2.category_id
|
||||
FOR JSON PATH
|
||||
) AS categoryIdsJson
|
||||
FROM article a
|
||||
LEFT JOIN articletext at
|
||||
ON at.article_id = a.id AND at.language_id = @languageId
|
||||
|
||||
@@ -18,6 +18,9 @@ export default function listSearchIndex(pool) {
|
||||
sku: row.sku,
|
||||
name: row.name,
|
||||
eans: row.eansJson ? JSON.parse(row.eansJson).map((r) => r.ean) : [],
|
||||
categoryIds: row.categoryIdsJson
|
||||
? JSON.parse(row.categoryIdsJson).map((r) => r.category_id)
|
||||
: [],
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user