lots of stuff

This commit is contained in:
2024-12-12 16:23:05 -05:00
parent c2a195268b
commit e247810ab5
13 changed files with 686 additions and 684 deletions

View File

@@ -1,6 +1,7 @@
import { db } from '../../index';
import { psa } from '../../../drizzle/schema';
import { eq, lt, gte, ne } from 'drizzle-orm';
import CATEGORY from '@src/data/parts_cats.json';
export async function getPSA(page = 1) {
const limit = 20;
@@ -24,18 +25,6 @@ export async function getLowerBuildKits(page = 1) {
.offset(offset);
}
// DISABLING FOR NOW. NO NEED FOR AK. FOCUS ON AR15
// export async function getAKBarreledReceivers(page = 1) {
// const limit = 20;
// const offset = (page - 1) * limit;
// return await db.select()
// .from(psa)
// .limit(limit)
// .where(eq(psa.fineline, "AK Barreled Receivers"))
// .offset(offset);
// }
export async function getARCompleteLowers(page = 1) {
const limit = 40;
const offset = (page - 1) * limit;
@@ -46,3 +35,14 @@ export async function getARCompleteLowers(page = 1) {
.where(eq(psa.fineline, "AR Complete Lowers"))
.offset(offset);
}
export async function getProductType(productType : any, page = 1) {
const limit = 40;
const offset = (page - 1) * limit;
return await db.select()
.from(psa)
.limit(limit)
.where(eq(psa.fineline, productType.name))
.offset(offset);
}

View File

@@ -1,10 +1,10 @@
// db/queries.ts
"use server";
import { eq, not , asc} from "drizzle-orm";
import { Product } from '../../schema/Product'
import { Product } from '@schemas/Product';
import { db } from '../../index';
// Fetch all account
// Fetch all products
export async function getAllProducts() {
return await db.select().from(Product);
}