feat(F-093): completed feature
This commit is contained in:
@@ -189,7 +189,13 @@ export class PgProductRepository implements ProductRepository {
|
||||
|
||||
const countResult = await this.pool.query<{ count: string }>(
|
||||
q
|
||||
? `SELECT COUNT(*) FROM catalog_products WHERE name ILIKE $1`
|
||||
? `SELECT COUNT(*)
|
||||
FROM catalog_products p
|
||||
WHERE p.name ILIKE $1
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM catalog_product_variants v
|
||||
WHERE v.product_id = p.id AND v.ean ILIKE $1
|
||||
)`
|
||||
: 'SELECT COUNT(*) FROM catalog_products',
|
||||
q ? [`%${q}%`] : [],
|
||||
);
|
||||
@@ -202,6 +208,10 @@ export class PgProductRepository implements ProductRepository {
|
||||
LEFT JOIN catalog_product_categories pc ON pc.product_id = p.id
|
||||
LEFT JOIN brands_brands b ON b.id = p.brand_id
|
||||
WHERE p.name ILIKE $1
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM catalog_product_variants v
|
||||
WHERE v.product_id = p.id AND v.ean ILIKE $1
|
||||
)
|
||||
GROUP BY p.id, b.name, b.slug
|
||||
ORDER BY p.created_at DESC
|
||||
LIMIT $2 OFFSET $3`
|
||||
|
||||
Reference in New Issue
Block a user