4257 - add multi locale support to categories resolver (#161)

This commit is contained in:
Anders Gustafsson
2024-01-09 14:48:44 +01:00
committed by GitHub
parent 2a9b7a88ee
commit 051355ba6a
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -125,13 +125,13 @@ WHERE product_category.product_id = ?
async getLocaleDataForId(
id: number,
locale?: string,
locales?: string[],
): Promise<CategoryLocaleData[]> {
// Dataloaders does not need scopes validation since they
// use other functions.
const res = await this.localeDataLoader.load(id);
if (locale) {
return res.filter((row) => row.locale === locale);
if (locales) {
return res.filter((row) => locales.includes(row.locale));
}
return res;
}