3769 - Differentiate forbidden and unauthenticated - add product group filter (#153)
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
Orientation,
|
||||
PrintProduct,
|
||||
Product,
|
||||
ProductGroup,
|
||||
ProductListResult,
|
||||
ProductsFilterInput,
|
||||
ProductsSearchResult,
|
||||
@@ -32,6 +33,17 @@ const ProductBlacklist = {
|
||||
};
|
||||
|
||||
const Product = {
|
||||
async printProducts(
|
||||
product: { printProducts: PrintProduct[] },
|
||||
input: { groups: ProductGroup[] },
|
||||
) {
|
||||
if (!input.groups) {
|
||||
return product.printProducts;
|
||||
}
|
||||
return product.printProducts.filter((printProduct) => {
|
||||
return input.groups.includes(printProduct.group);
|
||||
});
|
||||
},
|
||||
async categories({ id }, _args, { dataSources }): Promise<Array<Category>> {
|
||||
return (<CategoryAPI>dataSources.categoryApi).getProductCategories(id);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user