added a products page and pulled psa data

This commit is contained in:
2024-12-11 06:38:50 -05:00
parent ae4d142e05
commit 80c23f1518
3 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
import { db } from '../../index';
import { psa } from '../../../drizzle/schema';
export async function getPSA(page = 1) {
const limit = 10;
const offset = (page - 1) * limit;
return await db.select()
.from(psa)
.limit(limit)
.offset(offset);
}

8
src/db/schema/Psa.ts Normal file
View File

@@ -0,0 +1,8 @@
import { pgTable, text, decimal, serial, integer } from 'drizzle-orm/pg-core';
export const psa = pgTable('psa', {
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "brands_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
category: text('category').notNull(),
department: text('department').notNull(),
saleprice: decimal('saleprice', { precision: 10, scale: 2 }).notNull(),
});