Major refactor
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Maybe } from '../types';
|
||||
import { Maybe } from '../../types/types';
|
||||
|
||||
// Get syntax highlighting with vscode by installing "Comment tagged templates2
|
||||
|
||||
@@ -43,7 +43,12 @@ SELECT products.productid as id,
|
||||
product_blacklist.updated_at
|
||||
)
|
||||
) FROM product_blacklist WHERE product_blacklist.product_id = products.productid
|
||||
) AS blacklisting
|
||||
) AS blacklisting,
|
||||
( SELECT json_object_agg(fields.field, pf.value)
|
||||
FROM "product-products_fields" pf
|
||||
JOIN "product-fields" fields ON fields.fieldid = pf.fieldid
|
||||
WHERE pf.productid = products.productid
|
||||
) AS fields
|
||||
FROM "product-products" products
|
||||
`;
|
||||
|
||||
@@ -75,3 +80,12 @@ export function product(id: number) {
|
||||
`
|
||||
);
|
||||
}
|
||||
|
||||
export function categoryProducts(categoryId: number) {
|
||||
return (
|
||||
baseQuery +
|
||||
/* sql */ `
|
||||
WHERE products.productid IN (SELECT product_id FROM product_category WHERE category_id = ${categoryId});
|
||||
`
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user