adding dynamic filters

This commit is contained in:
2025-02-01 23:47:45 -05:00
parent 583162acbe
commit ffb42ba2d1
25 changed files with 241 additions and 165 deletions

View File

@@ -1,5 +1,5 @@
import { db } from '@db/index';
import { psa } from '@schemas/schema';
import { bb_products, psa } from '@schemas/schema';
import { eq, lt, gte, ne, and, like } from 'drizzle-orm';
import CATEGORY from '@src/data/parts_cats.json';
@@ -69,6 +69,17 @@ export async function getARHandGuards(page = 1) {
.offset(offset);
}
export async function getSuppressors(page = 1) {
const limit = 40;
const offset = (page - 1) * limit;
return await db.select()
.from(bb_products)
.limit(limit)
.where(and(eq(bb_products.category, "Muzzle Devices"), eq(bb_products.subcategory, 'Suppressors')))
.offset(offset);
}
export async function getAKHandGuards(page = 1) {
const limit = 40;
const offset = (page - 1) * limit;