mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-05 18:26:45 -05:00
changing to SortTable
This commit is contained in:
@@ -3,6 +3,7 @@ import partTypes from 'src/data/parts_cats.json';
|
||||
import styles from '../styles.module.css';
|
||||
import PageHero from "@src/components/PageHero";
|
||||
import ProductTable from "@src/components/ProductTable";
|
||||
import SortTable from "@src/components/SortTable";
|
||||
|
||||
export default async function BarrelsPage() {
|
||||
const data = await getProductType('Barrels');
|
||||
@@ -11,7 +12,7 @@ export default async function BarrelsPage() {
|
||||
<div>
|
||||
<PageHero title="Barrels" />
|
||||
<div className="container mx-auto">
|
||||
<ProductTable data={data}></ProductTable>
|
||||
<SortTable data={data}></SortTable>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -2,6 +2,7 @@ import { getARHandGuards } from "@queries/PSA";
|
||||
import styles from '../styles.module.css';
|
||||
import PageHero from "@src/components/PageHero";
|
||||
import ProductTable from "@src/components/ProductTable";
|
||||
import SortTable from "@src/components/SortTable";
|
||||
|
||||
export default async function HamdGuardsPage() {
|
||||
const data = await getARHandGuards();
|
||||
@@ -10,7 +11,7 @@ export default async function HamdGuardsPage() {
|
||||
<div>
|
||||
<PageHero title="Hand Guards" />
|
||||
<div className="container mx-auto">
|
||||
<ProductTable data={data}></ProductTable>
|
||||
<SortTable data={data}></SortTable>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
19
src/app/Products/magazines/page.tsx
Normal file
19
src/app/Products/magazines/page.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { getMags } from "@queries/PSA";
|
||||
import partTypes from 'src/data/parts_cats.json';
|
||||
import styles from '../styles.module.css';
|
||||
import PageHero from "@src/components/PageHero";
|
||||
import ProductTable from "@src/components/ProductTable";
|
||||
import SortTable from "@src/components/SortTable";
|
||||
|
||||
export default async function MagsPage() {
|
||||
const data = await getMags();
|
||||
|
||||
return (
|
||||
<div>
|
||||
<PageHero title="Magazines" />
|
||||
<div className="container mx-auto">
|
||||
<SortTable data={data}></SortTable>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import partTypes from 'src/data/parts_cats.json';
|
||||
import styles from '../styles.module.css';
|
||||
import PageHero from "@src/components/PageHero";
|
||||
import ProductTable from "@src/components/ProductTable";
|
||||
import SortTable from "@src/components/SortTable";
|
||||
|
||||
export default async function MuzzleDevices() {
|
||||
const data = await getMuzzleDevices();
|
||||
@@ -11,7 +12,7 @@ export default async function MuzzleDevices() {
|
||||
<div>
|
||||
<PageHero title="Muzzle Devices" />
|
||||
<div className="container mx-auto">
|
||||
<ProductTable data={data}></ProductTable>
|
||||
<SortTable data={data}></SortTable>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -2,13 +2,14 @@ import { getARParts } from "@queries/PSA";
|
||||
import partTypes from 'src/data/parts_cats.json';
|
||||
import styles from '../styles.module.css';
|
||||
import ProductTable from "@src/components/ProductTable";
|
||||
import SortTable from "@src/components/SortTable";
|
||||
|
||||
export default async function PartsPage() {
|
||||
const data = await getARParts();
|
||||
|
||||
return (
|
||||
<div className="container mx-auto">
|
||||
<ProductTable data={data}></ProductTable>
|
||||
<SortTable data={data}></SortTable>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import partTypes from 'src/data/parts_cats.json';
|
||||
import styles from '../styles.module.css';
|
||||
import PageHero from "@src/components/PageHero";
|
||||
import ProductTable from "@src/components/ProductTable";
|
||||
import SortTable from "@src/components/SortTable";
|
||||
|
||||
export default async function StocksPage() {
|
||||
const psa = await getStocks();
|
||||
@@ -12,7 +13,7 @@ export default async function StocksPage() {
|
||||
<div>
|
||||
<PageHero title="Stocks" />
|
||||
<div className="container mx-auto">
|
||||
<ProductTable data={psa}></ProductTable>
|
||||
<SortTable data={psa}></SortTable>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@ import partTypes from 'src/data/parts_cats.json';
|
||||
import styles from '../styles.module.css';
|
||||
import PageHero from "@src/components/PageHero";
|
||||
import ProductTable from "@src/components/ProductTable";
|
||||
import SortTable from "@src/components/SortTable";
|
||||
|
||||
export default async function TriggersPage() {
|
||||
const psa = await getARTriggers();
|
||||
@@ -12,7 +13,7 @@ export default async function TriggersPage() {
|
||||
<div>
|
||||
<PageHero title="AR Triggers" />
|
||||
<div className="container mx-auto">
|
||||
<ProductTable data={psa}></ProductTable>
|
||||
<SortTable data={psa}></SortTable>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -50,6 +50,7 @@ const navigation = {
|
||||
items: [
|
||||
{ name: "Lower Receivers", href: "/Products/lowers" },
|
||||
{ name: "Grips", href: "/Products/grips" },
|
||||
{ name: "Magazines", href: "/Products/magazines" },
|
||||
{ name: "Stocks", href: "/Products/stocks" },
|
||||
{ name: "Triggers", href: "/Products/triggers" },
|
||||
{ name: "Parts", href: "/Products/parts" },
|
||||
|
||||
@@ -143,3 +143,13 @@ export async function getARParts(page = 1) {
|
||||
.where(and(like(psa.fineline, "%Trigger%"), like(psa.category, "Ar Parts")))
|
||||
.offset(offset);
|
||||
}
|
||||
export async function getMags(page = 1) {
|
||||
const limit = 40;
|
||||
const offset = (page - 1) * limit;
|
||||
|
||||
return await db.select()
|
||||
.from(psa)
|
||||
.limit(limit)
|
||||
.where(and(like(psa.fineline, "%Magazine%"), like(psa.category, "Ar Parts")))
|
||||
.offset(offset);
|
||||
}
|
||||
27
src/db/schema/User.ts
Normal file
27
src/db/schema/User.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { pgTable, integer, varchar, text, decimal, uuid, real, bigserial, date, timestamp, boolean, unique, check } from "drizzle-orm/pg-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { timestamps } from "./helpers/columns.helpers";
|
||||
|
||||
export const users = pgTable("users", {
|
||||
id: bigserial({ mode: "bigint" }).primaryKey().notNull(),
|
||||
username: varchar({ length: 50 }).notNull(),
|
||||
email: varchar({ length: 255 }).notNull(),
|
||||
passwordHash: varchar("password_hash", { length: 255 }).notNull(),
|
||||
firstName: varchar("first_name", { length: 50 }),
|
||||
lastName: varchar("last_name", { length: 50 }),
|
||||
profilePicture: varchar("profile_picture", { length: 255 }),
|
||||
dateOfBirth: date("date_of_birth"),
|
||||
phoneNumber: varchar("phone_number", { length: 20 }),
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).default(sql`CURRENT_TIMESTAMP`),
|
||||
updatedAt: timestamp("updated_at", { mode: 'string' }).default(sql`CURRENT_TIMESTAMP`),
|
||||
isAdmin: boolean("is_admin").default(false),
|
||||
lastLogin: timestamp("last_login", { mode: 'string' }),
|
||||
emailVerified: boolean("email_verified").default(false),
|
||||
buildPrivacySetting: text("build_privacy_setting").default('public'),
|
||||
}, (table) => {
|
||||
return {
|
||||
usersUsernameKey: unique("users_username_key").on(table.username),
|
||||
usersEmailKey: unique("users_email_key").on(table.email),
|
||||
usersBuildPrivacySettingCheck: check("users_build_privacy_setting_check", sql`build_privacy_setting = ANY (ARRAY['private'::text, 'public'::text])`),
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user