more fises

This commit is contained in:
2024-12-18 13:51:12 -05:00
parent 12493feb6e
commit 587f183ffa
13 changed files with 112 additions and 67 deletions

View File

@@ -26,7 +26,7 @@ export async function getLowerBuildKits(page = 1) {
}
export async function getARCompleteLowers(page = 1) {
const limit = 40;
const limit = 240;
const offset = (page - 1) * limit;
return await db.select()
@@ -39,7 +39,7 @@ export async function getARCompleteLowers(page = 1) {
export async function getProductType(productType : any, page = 1) {
const limit = 40;
const offset = (page - 1) * limit;
await new Promise((resolve) => setTimeout(resolve,1000));
return await db.select()
.from(psa)
.limit(limit)

View File

@@ -1,25 +1,25 @@
// db/queries.ts
"use server";
import { eq, not , asc} from "drizzle-orm";
import { Product } from '@schemas/Product';
import { products } from '@schemas/schema';
import { db } from '../../index';
// Fetch all products
export async function getAllProducts() {
return await db.select().from(Product);
return await db.select().from(products);
}
// Add a new product
export async function addProduct() {
return await db.insert(Product).values({ }).returning();
return await db.insert(products).values({ }).returning();
}
// Update a Product
export async function updateProduct( ) {
return await db.update(Product).set({ }).where(eq(Product.id, id));
return await db.update(products).set({ }).where(eq(Product.id, id));
}
// Delete a product
export async function deleteProduct(id: number) {
return await db.delete(Product).where(eq(Product.id, id));
return await db.delete(products).where(eq(products.id, id));
}