mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
fixes, more fixes
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
import { getProductType } from "@queries/PSA";
|
import { getProductType } from "@queries/PSA";
|
||||||
import partTypes from 'src/data/parts_cats.json';
|
|
||||||
import styles from '../styles.module.css';
|
import styles from '../styles.module.css';
|
||||||
import PageHero from "@src/components/PageHero";
|
import PageHero from "@src/components/PageHero";
|
||||||
import ProductTable from "@src/components/ProductTable";
|
|
||||||
import SortTable from "@src/components/SortTable";
|
import SortTable from "@src/components/SortTable";
|
||||||
|
|
||||||
export default async function BarrelsPage() {
|
export default async function BarrelsPage() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getGrips } from "@queries/PSA";
|
import { getGrips } from "@queries/PSA";
|
||||||
import partTypes from 'src/data/parts_cats.json';
|
|
||||||
import styles from '../styles.module.css';
|
import styles from '../styles.module.css';
|
||||||
import PageHero from "@src/components/PageHero";
|
import PageHero from "@src/components/PageHero";
|
||||||
import SortTable from "@src/components/SortTable";
|
import SortTable from "@src/components/SortTable";
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { getARHandGuards } from "@queries/PSA";
|
import { getARHandGuards } from "@queries/PSA";
|
||||||
import styles from '../styles.module.css';
|
import styles from '../styles.module.css';
|
||||||
import PageHero from "@src/components/PageHero";
|
import PageHero from "@src/components/PageHero";
|
||||||
import ProductTable from "@src/components/ProductTable";
|
|
||||||
import SortTable from "@src/components/SortTable";
|
import SortTable from "@src/components/SortTable";
|
||||||
|
|
||||||
export default async function HamdGuardsPage() {
|
export default async function HamdGuardsPage() {
|
||||||
|
|||||||
@@ -14,11 +14,9 @@ export default function RootLayout({
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
|
||||||
<body>
|
|
||||||
<div className="flex min-h-full flex-col">
|
<div className="flex min-h-full flex-col">
|
||||||
<Navbar />
|
|
||||||
<PopNav />
|
|
||||||
<PageHero title="Category" />
|
<PageHero title="Category" />
|
||||||
<div className="mx-auto flex w-full max-w-7xl items-start gap-x-8 ">
|
<div className="mx-auto flex w-full max-w-7xl items-start gap-x-8 ">
|
||||||
<aside className="sticky top-8 hidden w-44 shrink-0 lg:block pt-4">
|
<aside className="sticky top-8 hidden w-44 shrink-0 lg:block pt-4">
|
||||||
@@ -33,8 +31,5 @@ export default function RootLayout({
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import { getARCompleteLowers, getProductType } from "@queries/PSA";
|
import { getProductType } from "@queries/PSA";
|
||||||
import partTypes from 'src/data/parts_cats.json';
|
import partTypes from 'src/data/parts_cats.json';
|
||||||
import { psa } from "@db/schema/Psa";
|
|
||||||
import styles from "../styles.module.css";
|
import styles from "../styles.module.css";
|
||||||
import PageHero from "@components/PageHero";
|
|
||||||
import Link from "next/link";
|
|
||||||
import SortTable from "@src/components/SortTable";
|
import SortTable from "@src/components/SortTable";
|
||||||
|
|
||||||
export default async function LowerReceiverPage() {
|
export default async function LowerReceiverPage() {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { getMags } from "@queries/PSA";
|
import { getMags } from "@queries/PSA";
|
||||||
import partTypes from 'src/data/parts_cats.json';
|
|
||||||
import styles from '../styles.module.css';
|
import styles from '../styles.module.css';
|
||||||
import PageHero from "@src/components/PageHero";
|
import PageHero from "@src/components/PageHero";
|
||||||
import ProductTable from "@src/components/ProductTable";
|
|
||||||
import SortTable from "@src/components/SortTable";
|
import SortTable from "@src/components/SortTable";
|
||||||
|
|
||||||
export default async function MagsPage() {
|
export default async function MagsPage() {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { getMuzzleDevices } from "@queries/PSA";
|
import { getMuzzleDevices } from "@queries/PSA";
|
||||||
import partTypes from 'src/data/parts_cats.json';
|
|
||||||
import styles from '../styles.module.css';
|
import styles from '../styles.module.css';
|
||||||
import PageHero from "@src/components/PageHero";
|
import PageHero from "@src/components/PageHero";
|
||||||
import ProductTable from "@src/components/ProductTable";
|
|
||||||
import SortTable from "@src/components/SortTable";
|
import SortTable from "@src/components/SortTable";
|
||||||
|
|
||||||
export default async function MuzzleDevices() {
|
export default async function MuzzleDevices() {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import { getARParts } from "@queries/PSA";
|
import { getARParts } from "@queries/PSA";
|
||||||
import partTypes from 'src/data/parts_cats.json';
|
|
||||||
import styles from '../styles.module.css';
|
import styles from '../styles.module.css';
|
||||||
import ProductTable from "@src/components/ProductTable";
|
|
||||||
import SortTable from "@src/components/SortTable";
|
import SortTable from "@src/components/SortTable";
|
||||||
|
|
||||||
export default async function PartsPage() {
|
export default async function PartsPage() {
|
||||||
|
|||||||
@@ -1,19 +1,16 @@
|
|||||||
import { getARTriggers } from "@queries/PSA";
|
import { getARTriggers } from "@queries/PSA";
|
||||||
import { psa } from '@db/schema/Psa';
|
|
||||||
import partTypes from 'src/data/parts_cats.json';
|
|
||||||
import styles from '../styles.module.css';
|
import styles from '../styles.module.css';
|
||||||
import PageHero from "@src/components/PageHero";
|
import PageHero from "@src/components/PageHero";
|
||||||
import ProductTable from "@src/components/ProductTable";
|
|
||||||
import SortTable from "@src/components/SortTable";
|
import SortTable from "@src/components/SortTable";
|
||||||
|
|
||||||
export default async function TriggersPage() {
|
export default async function TriggersPage() {
|
||||||
const psa = await getARTriggers();
|
const data = await getARTriggers();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<PageHero title="AR Triggers" />
|
<PageHero title="AR Triggers" />
|
||||||
<div className="container mx-auto">
|
<div className="container mx-auto">
|
||||||
<SortTable data={psa}></SortTable>
|
<SortTable data={data}></SortTable>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import { getPSA, getUpperReciever } from "@queries/PSA";
|
import { getUpperReciever } from "@queries/PSA";
|
||||||
import { psa } from '@db/schema/Psa';
|
|
||||||
import styles from '../styles.module.css';
|
import styles from '../styles.module.css';
|
||||||
import PageHero from "@src/components/PageHero";
|
import PageHero from "@src/components/PageHero";
|
||||||
import ProductTable from "@src/components/ProductTable";
|
import ProductTable from "@src/components/ProductTable";
|
||||||
|
|
||||||
export default async function UpperReceiverPage() {
|
export default async function UpperReceiverPage() {
|
||||||
const psa = await getUpperReciever();
|
const data = await getUpperReciever();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<PageHero title="Upper Recievers" />
|
<PageHero title="Upper Recievers" />
|
||||||
<div className="container mx-auto">
|
<div className="container mx-auto">
|
||||||
<ProductTable data={psa}></ProductTable>
|
<ProductTable data={data}></ProductTable>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const metadata = {
|
|||||||
|
|
||||||
const roboto = Roboto({
|
const roboto = Roboto({
|
||||||
weight: '400',
|
weight: '400',
|
||||||
subsets: ['latin'],
|
subsets: ['latin'],git s
|
||||||
display: 'swap',
|
display: 'swap',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -24,8 +24,8 @@ export default function RootLayout(props: { children: React.ReactNode }) {
|
|||||||
<html suppressHydrationWarning className={roboto.className}>
|
<html suppressHydrationWarning className={roboto.className}>
|
||||||
<body className="bg-slate-200 ">
|
<body className="bg-slate-200 ">
|
||||||
|
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<PopNav />
|
<PopNav />
|
||||||
{children}
|
{children}
|
||||||
<Footer />
|
<Footer />
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// db/queries.ts
|
// db/queries.ts
|
||||||
"use server";
|
"use server";
|
||||||
import { eq, not , asc} from "drizzle-orm";
|
import { eq, not , asc} from "drizzle-orm";
|
||||||
import { Account } from '../../schema/Account'
|
import { Account } from '@schemas/Account'
|
||||||
import { db } from '../../index';
|
import { db } from '../../index';
|
||||||
|
|
||||||
// Fetch all account
|
// Fetch all account
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { db } from '../../index';
|
import { db } from '../../index';
|
||||||
import { psa } from '../../../drizzle/schema';
|
import { psa } from '@schemas/Psa';
|
||||||
import { eq, lt, gte, ne, and, like } from 'drizzle-orm';
|
import { eq, lt, gte, ne, and, like } from 'drizzle-orm';
|
||||||
import CATEGORY from '@src/data/parts_cats.json';
|
import CATEGORY from '@src/data/parts_cats.json';
|
||||||
|
|
||||||
@@ -112,6 +112,7 @@ export async function getStocksParts(page = 1) {
|
|||||||
.where(eq(psa.fineline, "Stocks"))
|
.where(eq(psa.fineline, "Stocks"))
|
||||||
.offset(offset);
|
.offset(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getUpperReciever(page = 1) {
|
export async function getUpperReciever(page = 1) {
|
||||||
const limit = 40;
|
const limit = 40;
|
||||||
const offset = (page - 1) * limit;
|
const offset = (page - 1) * limit;
|
||||||
@@ -133,6 +134,7 @@ export async function getARTriggers(page = 1) {
|
|||||||
.where(and(like(psa.fineline, "%Trigger%"), like(psa.category, "Ar Parts")))
|
.where(and(like(psa.fineline, "%Trigger%"), like(psa.category, "Ar Parts")))
|
||||||
.offset(offset);
|
.offset(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getARParts(page = 1) {
|
export async function getARParts(page = 1) {
|
||||||
const limit = 40;
|
const limit = 40;
|
||||||
const offset = (page - 1) * limit;
|
const offset = (page - 1) * limit;
|
||||||
@@ -143,6 +145,7 @@ export async function getARParts(page = 1) {
|
|||||||
.where(and(like(psa.fineline, "%Trigger%"), like(psa.category, "Ar Parts")))
|
.where(and(like(psa.fineline, "%Trigger%"), like(psa.category, "Ar Parts")))
|
||||||
.offset(offset);
|
.offset(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getMags(page = 1) {
|
export async function getMags(page = 1) {
|
||||||
const limit = 40;
|
const limit = 40;
|
||||||
const offset = (page - 1) * limit;
|
const offset = (page - 1) * limit;
|
||||||
@@ -150,6 +153,6 @@ export async function getMags(page = 1) {
|
|||||||
return await db.select()
|
return await db.select()
|
||||||
.from(psa)
|
.from(psa)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.where(and(like(psa.fineline, "%Magazine%"), like(psa.category, "Ar Parts")))
|
.where(like(psa.superfineline, "%AR Magazines%"))
|
||||||
.offset(offset);
|
.offset(offset);
|
||||||
}
|
}
|
||||||
18
src/db/schema/UserActivity.ts
Normal file
18
src/db/schema/UserActivity.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { bigint, bigserial, foreignKey, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
||||||
|
import { users } from "./User";
|
||||||
|
|
||||||
|
export const userActivityLog = pgTable("user_activity_log", {
|
||||||
|
id: bigserial({ mode: "bigint" }).primaryKey().notNull(),
|
||||||
|
// You can use { mode: "bigint" } if numbers are exceeding js number limitations
|
||||||
|
userId: bigint("user_id", { mode: "number" }).notNull(),
|
||||||
|
activity: text().notNull(),
|
||||||
|
timestamp: timestamp({ mode: 'string' }).default(sql`CURRENT_TIMESTAMP`),
|
||||||
|
}, (table) => {
|
||||||
|
return {
|
||||||
|
userActivityLogUserIdFkey: foreignKey({
|
||||||
|
columns: [table.userId],
|
||||||
|
foreignColumns: [users.id],
|
||||||
|
name: "user_activity_log_user_id_fkey"
|
||||||
|
}).onDelete("cascade"),
|
||||||
|
}
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user