mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 10:46:44 -05:00
accounts table and many other fixes
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
// db/queries.ts
|
||||
"use server";
|
||||
import { eq, not , asc} from "drizzle-orm";
|
||||
import { accounts } from '@schemas/schema'
|
||||
import { db } from '../../index';
|
||||
import { accounts } from '@schemas/schema';
|
||||
import { vw_accounts } from '@schemas/schema';
|
||||
import { db } from '@db/index';
|
||||
|
||||
// Fetch all account
|
||||
export async function getAllAccounts() {
|
||||
return await db.select().from(accounts);
|
||||
}
|
||||
|
||||
//@TODO Accounts don't have these fields, i assume next.js auth code did it this way
|
||||
// Add a new account
|
||||
export async function addAcount(first_name: string, last_name : string, username : string, password_hash: string ) {
|
||||
return await db.insert(accounts).values({ first_name, last_name, username, password_hash }).returning();
|
||||
|
||||
@@ -102,6 +102,17 @@ export async function getStocks(page = 1) {
|
||||
.offset(offset);
|
||||
}
|
||||
|
||||
export async function getOptics(page = 1) {
|
||||
const limit = 40;
|
||||
const offset = (page - 1) * limit;
|
||||
|
||||
return await db.select()
|
||||
.from(psa)
|
||||
.limit(limit)
|
||||
.where(and(like(psa.fineline, "%Optics%")))
|
||||
.offset(offset);
|
||||
}
|
||||
|
||||
export async function getStocksParts(page = 1) {
|
||||
const limit = 40;
|
||||
const offset = (page - 1) * limit;
|
||||
|
||||
Reference in New Issue
Block a user