fix products
This commit is contained in:
@@ -52,8 +52,13 @@ router.get('/', async (req, res, next) => {
|
||||
|
||||
if (search) {
|
||||
paramCount++;
|
||||
whereConditions.push(`(p.name ILIKE $${paramCount} OR p.brand ILIKE $${paramCount} OR p.active_ingredients ILIKE $${paramCount})`);
|
||||
queryParams.push(`%${search}%`);
|
||||
const searchParam1 = paramCount;
|
||||
paramCount++;
|
||||
const searchParam2 = paramCount;
|
||||
paramCount++;
|
||||
const searchParam3 = paramCount;
|
||||
whereConditions.push(`(p.name ILIKE $${searchParam1} OR p.brand ILIKE $${searchParam2} OR p.active_ingredients ILIKE $${searchParam3})`);
|
||||
queryParams.push(`%${search}%`, `%${search}%`, `%${search}%`);
|
||||
}
|
||||
|
||||
const whereClause = whereConditions.length > 0 ? `AND ${whereConditions.join(' AND ')}` : '';
|
||||
|
||||
Reference in New Issue
Block a user