mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 10:46:44 -05:00
more fixes and organizing
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
// db/queries.ts
|
||||
"use server";
|
||||
import { eq, not , asc} from "drizzle-orm";
|
||||
import { Account } from '../schema/Account'
|
||||
import { db } from '../index';
|
||||
import { Account } from '../../schema/Account'
|
||||
import { db } from '../../index';
|
||||
|
||||
// Fetch all account
|
||||
export async function getAllAccounts() {
|
||||
25
src/db/queries/Products/index.ts
Normal file
25
src/db/queries/Products/index.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
// db/queries.ts
|
||||
"use server";
|
||||
import { eq, not , asc} from "drizzle-orm";
|
||||
import { Product } from '../../schema/Product'
|
||||
import { db } from '../../index';
|
||||
|
||||
// Fetch all account
|
||||
export async function getAllProducts() {
|
||||
return await db.select().from(Product);
|
||||
}
|
||||
|
||||
// Add a new product
|
||||
export async function addProduct() {
|
||||
return await db.insert(Product).values({}).returning();
|
||||
}
|
||||
|
||||
// Update a Product
|
||||
export async function updateProduct( ) {
|
||||
return await db.update(Product).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));
|
||||
}
|
||||
Reference in New Issue
Block a user