From e247810ab5f6ce43cb5f27851fb764eb1d3870bf Mon Sep 17 00:00:00 2001 From: Don Strawsburg Date: Thu, 12 Dec 2024 16:23:05 -0500 Subject: [PATCH] lots of stuff --- src/app/Products/barrels/page.tsx | 37 ++ src/app/Products/grips/page.tsx | 37 ++ src/app/Products/handguards/page.tsx | 37 ++ src/app/Products/lowers/page.tsx | 5 +- src/app/Products/muzzle-devices/page.tsx | 37 ++ src/app/Products/parts/page.tsx | 37 ++ src/app/Products/stocks/page.tsx | 37 ++ src/app/Products/triggers/page.tsx | 37 ++ src/components/PopNav/page.tsx | 16 +- src/data/leftover.json | 394 ------------- src/data/parts_cats.json | 668 ++++++++++++++--------- src/db/queries/PSA/index.ts | 24 +- src/db/queries/Products/index.ts | 4 +- 13 files changed, 686 insertions(+), 684 deletions(-) create mode 100644 src/app/Products/barrels/page.tsx create mode 100644 src/app/Products/grips/page.tsx create mode 100644 src/app/Products/handguards/page.tsx create mode 100644 src/app/Products/muzzle-devices/page.tsx create mode 100644 src/app/Products/parts/page.tsx create mode 100644 src/app/Products/stocks/page.tsx create mode 100644 src/app/Products/triggers/page.tsx delete mode 100644 src/data/leftover.json diff --git a/src/app/Products/barrels/page.tsx b/src/app/Products/barrels/page.tsx new file mode 100644 index 0000000..75090ac --- /dev/null +++ b/src/app/Products/barrels/page.tsx @@ -0,0 +1,37 @@ +import { Button } from "@components/ui/button"; +import { getPSA, getLowerBuildKits, getProductType} from "@queries/PSA"; +import { psa } from '@db/schema/Psa'; +import partTypes from 'src/data/parts_cats.json'; +import styles from '../styles.module.css'; + +export default async function GripsPage() { + const psa = await getProductType(partTypes["AR PARTS"]); + + return ( +
+ + + + + + + + + + + {psa.map((psa) => ( + + + + + + + ))} + +
ComponentManufacturerModel #Price
{psa.category}{psa.brandName}{psa.modelnumber} + ${Number(psa.salePrice).toFixed(2)} + +
+
+ ); +} \ No newline at end of file diff --git a/src/app/Products/grips/page.tsx b/src/app/Products/grips/page.tsx new file mode 100644 index 0000000..75090ac --- /dev/null +++ b/src/app/Products/grips/page.tsx @@ -0,0 +1,37 @@ +import { Button } from "@components/ui/button"; +import { getPSA, getLowerBuildKits, getProductType} from "@queries/PSA"; +import { psa } from '@db/schema/Psa'; +import partTypes from 'src/data/parts_cats.json'; +import styles from '../styles.module.css'; + +export default async function GripsPage() { + const psa = await getProductType(partTypes["AR PARTS"]); + + return ( +
+ + + + + + + + + + + {psa.map((psa) => ( + + + + + + + ))} + +
ComponentManufacturerModel #Price
{psa.category}{psa.brandName}{psa.modelnumber} + ${Number(psa.salePrice).toFixed(2)} + +
+
+ ); +} \ No newline at end of file diff --git a/src/app/Products/handguards/page.tsx b/src/app/Products/handguards/page.tsx new file mode 100644 index 0000000..75090ac --- /dev/null +++ b/src/app/Products/handguards/page.tsx @@ -0,0 +1,37 @@ +import { Button } from "@components/ui/button"; +import { getPSA, getLowerBuildKits, getProductType} from "@queries/PSA"; +import { psa } from '@db/schema/Psa'; +import partTypes from 'src/data/parts_cats.json'; +import styles from '../styles.module.css'; + +export default async function GripsPage() { + const psa = await getProductType(partTypes["AR PARTS"]); + + return ( +
+ + + + + + + + + + + {psa.map((psa) => ( + + + + + + + ))} + +
ComponentManufacturerModel #Price
{psa.category}{psa.brandName}{psa.modelnumber} + ${Number(psa.salePrice).toFixed(2)} + +
+
+ ); +} \ No newline at end of file diff --git a/src/app/Products/lowers/page.tsx b/src/app/Products/lowers/page.tsx index feae6ba..0d81663 100644 --- a/src/app/Products/lowers/page.tsx +++ b/src/app/Products/lowers/page.tsx @@ -1,12 +1,13 @@ import { Button } from "@components/ui/button"; -import { getPSA, getLowerBuildKits, getARCompleteLowers } from "@queries/PSA"; +import { getPSA, getLowerBuildKits, getARCompleteLowers, getProductType } from "@queries/PSA"; +import partTypes from 'src/data/parts_cats.json'; import { psa } from "@db/schema/Psa"; import styles from "../styles.module.css"; import PageHero from "@components/PageHero"; import Link from "next/link"; export default async function LowerReceiverPage() { - const psa = await getARCompleteLowers(); + const psa = await getProductType(partTypes["AR COMPLETE LOWERS"]); return (
diff --git a/src/app/Products/muzzle-devices/page.tsx b/src/app/Products/muzzle-devices/page.tsx new file mode 100644 index 0000000..75090ac --- /dev/null +++ b/src/app/Products/muzzle-devices/page.tsx @@ -0,0 +1,37 @@ +import { Button } from "@components/ui/button"; +import { getPSA, getLowerBuildKits, getProductType} from "@queries/PSA"; +import { psa } from '@db/schema/Psa'; +import partTypes from 'src/data/parts_cats.json'; +import styles from '../styles.module.css'; + +export default async function GripsPage() { + const psa = await getProductType(partTypes["AR PARTS"]); + + return ( +
+ + + + + + + + + + + {psa.map((psa) => ( + + + + + + + ))} + +
ComponentManufacturerModel #Price
{psa.category}{psa.brandName}{psa.modelnumber} + ${Number(psa.salePrice).toFixed(2)} + +
+
+ ); +} \ No newline at end of file diff --git a/src/app/Products/parts/page.tsx b/src/app/Products/parts/page.tsx new file mode 100644 index 0000000..75090ac --- /dev/null +++ b/src/app/Products/parts/page.tsx @@ -0,0 +1,37 @@ +import { Button } from "@components/ui/button"; +import { getPSA, getLowerBuildKits, getProductType} from "@queries/PSA"; +import { psa } from '@db/schema/Psa'; +import partTypes from 'src/data/parts_cats.json'; +import styles from '../styles.module.css'; + +export default async function GripsPage() { + const psa = await getProductType(partTypes["AR PARTS"]); + + return ( +
+ + + + + + + + + + + {psa.map((psa) => ( + + + + + + + ))} + +
ComponentManufacturerModel #Price
{psa.category}{psa.brandName}{psa.modelnumber} + ${Number(psa.salePrice).toFixed(2)} + +
+
+ ); +} \ No newline at end of file diff --git a/src/app/Products/stocks/page.tsx b/src/app/Products/stocks/page.tsx new file mode 100644 index 0000000..75090ac --- /dev/null +++ b/src/app/Products/stocks/page.tsx @@ -0,0 +1,37 @@ +import { Button } from "@components/ui/button"; +import { getPSA, getLowerBuildKits, getProductType} from "@queries/PSA"; +import { psa } from '@db/schema/Psa'; +import partTypes from 'src/data/parts_cats.json'; +import styles from '../styles.module.css'; + +export default async function GripsPage() { + const psa = await getProductType(partTypes["AR PARTS"]); + + return ( +
+ + + + + + + + + + + {psa.map((psa) => ( + + + + + + + ))} + +
ComponentManufacturerModel #Price
{psa.category}{psa.brandName}{psa.modelnumber} + ${Number(psa.salePrice).toFixed(2)} + +
+
+ ); +} \ No newline at end of file diff --git a/src/app/Products/triggers/page.tsx b/src/app/Products/triggers/page.tsx new file mode 100644 index 0000000..75090ac --- /dev/null +++ b/src/app/Products/triggers/page.tsx @@ -0,0 +1,37 @@ +import { Button } from "@components/ui/button"; +import { getPSA, getLowerBuildKits, getProductType} from "@queries/PSA"; +import { psa } from '@db/schema/Psa'; +import partTypes from 'src/data/parts_cats.json'; +import styles from '../styles.module.css'; + +export default async function GripsPage() { + const psa = await getProductType(partTypes["AR PARTS"]); + + return ( +
+ + + + + + + + + + + {psa.map((psa) => ( + + + + + + + ))} + +
ComponentManufacturerModel #Price
{psa.category}{psa.brandName}{psa.modelnumber} + ${Number(psa.salePrice).toFixed(2)} + +
+
+ ); +} \ No newline at end of file diff --git a/src/components/PopNav/page.tsx b/src/components/PopNav/page.tsx index c8cd562..e0afe54 100644 --- a/src/components/PopNav/page.tsx +++ b/src/components/PopNav/page.tsx @@ -42,20 +42,20 @@ const navigation = { name: 'Lower Parts', items: [ { name: 'Lower Receivers', href: '/Products/lowers' }, - { name: 'Grips', href: '#' }, - { name: 'Stocks', href: '#' }, - { name: 'Triggers', href: '#' }, - { name: 'Parts', href: '#' }, + { name: 'Grips', href: '/Products/grips' }, + { name: 'Stocks', href: '/Products/stocks' }, + { name: 'Triggers', href: '/Products/triggers' }, + { name: 'Parts', href: '/Products/parts' }, ], }, { id: 'upper-parts', name: 'Upper Parks', items: [ - { name: 'Upper Receiver', href: '#' }, - { name: 'Barrels', href: '#' }, - { name: 'Handguards', href: '#' }, - { name: 'Muzzle Devices', href: '#' }, + { name: 'Upper Receiver', href: '/Products/uppers' }, + { name: 'Barrels', href: '/Products/barrels' }, + { name: 'Handguards', href: '/Products/handguards' }, + { name: 'Muzzle Devices', href: '/Products/muzzle-devices' }, ], }, { diff --git a/src/data/leftover.json b/src/data/leftover.json deleted file mode 100644 index 90e6b8a..0000000 --- a/src/data/leftover.json +++ /dev/null @@ -1,394 +0,0 @@ -/* { - "name" : "Fixed Blade Knives" - }, - { - "name" : "Reloading Primers" - }, - { - "name" : "Archery" - }, - { - "name" : "Parts Kits" - }, - { - "name" : "Reloading Shellholders & Shellplates" - }, - { - "name" : "Railed Uppers" - }, - { - "name" : "Reloading Case Length Gauges" - }, - { - "name" : "Gun Cases & Safes" - }, - { - "name" : "Multi Tools" - }, - { - "name" : "Reloading Benches & Stands" - }, - { - "name" : "Bipods & Tripods" - }, - { - "name" : "Magnifiers" - }, - { - "name" : "Door Mats" - }, - { - "name" : "Reloading Case Cleaning & Preparation" - }, - { - "name" : "Handgun Magazines" - }, - { - "name" : "Laser Sights" - }, - { - "name" : "Ankle Holster" - }, - { - "name" : "Outside Waistband Holster" - }, - { - "name" : "Brass Catchers" - }, - { - "name" : "Wallets" - }, - { - "name" : "Self-Defense" - }, - { - "name" : "Premium Uppers" - }, - { - "name" : "Reloading Priming Tools" - }, - { - "name" : "Reloading Loader Kits" - }, - { - "name" : "Binoculars" - }, - { - "name" : "Holster Accessories" - }, - { - "name" : "Belts" - }, - { - "name" : "Scopes" - }, - { - "name" : "Backpacks" - }, - { - "name" : "Batteries" - }, - { - "name" : "Health & Safety" - }, - { - "name" : "Reloading Manuals & Reference Materials" - }, - { - "name" : "Spotting Scopes" - }, - { - "name" : "Pocket Holster" - }, - { - "name" : "Vehicle Accessories" - }, - { - "name" : "Ammunition Carriers" - }, - { - "name" : "Handgun Ammunition" - }, - { - "name" : "Classic Uppers" - }, - { - "name" : "Ak Pistols" - }, - { - "name" : "Phone Accessories" - }, - { - "name" : "Inside & Outside Waistband Holster" - }, - { - "name" : "Muzzle Devices" - }, - { - "name" : "Scope Accessories" - }, - { - "name" : "Sunglasses" - }, - { - "name" : "Revolver Clips" - }, - { - "name" : "Magazine Accessories" - }, - { - "name" : "Reloading Trays" - }, - { - "name" : "Rifle Parts" - }, - { - "name" : "Tactical" - }, - { - "name" : "Novelties" - }, - { - "name" : "Pouches" - }, - { - "name" : "Rifle Magazines" - }, - { - "name" : "Snap Caps" - }, - { - "name" : "" - }, - { - "name" : "Reloading Meplat Uniformers & Trimmers" - }, - { - "name" : "Ar Gunsmithing" - }, - { - "name" : "Handcuffs" - }, - { - "name" : "Headwear" - }, - { - "name" : "Thigh Holster" - }, - { - "name" : "Rifle Ammunition" - }, - { - "name" : "Shotguns" - }, - { - "name" : "Reloading Bullet Pullers" - }, - { - "name" : "Knife Accessories" - }, - { - "name" : "Shotgun Ammunition" - }, - { - "name" : "Handguns" - }, - { - "name" : "Lights" - }, - { - "name" : "Ar Parts" - }, - { - "name" : "Airguns" - }, - { - "name" : "Moe Uppers" - }, - { - "name" : "Shotgun Parts" - }, - { - "name" : "Rifles" - }, - { - "name" : "Tapes" - }, - { - "name" : "Shovels" - }, - { - "name" : "Storage Boxes" - }, - { - "name" : "Tactical Pens" - }, - { - "name" : "Targets" - }, - { - "name" : "Shooting Rests" - }, - { - "name" : "Breaching Tools" - }, - { - "name" : "Eye & Ear Protection" - }, - { - "name" : "Flame Throwers" - }, - { - "name" : "Rangefinders" - }, - { - "name" : "Reloading Bullet Casting" - }, - { - "name" : "Knife Kits & Sets" - }, - { - "name" : "Reloading Bullets" - }, - { - "name" : "Ar Lowers" - }, - { - "name" : "Handgun Frames" - }, - { - "name" : "Reloading Shotshell Components" - }, - { - "name" : "Guides, Manuals & Reference" - }, - { - "name" : "Reloading Die Parts & Accessories" - }, - { - "name" : "Reloading Powder Measures, Scales & Tools" - }, - { - "name" : "Ak Parts" - }, - { - "name" : "Bags" - }, - { - "name" : "Machetes" - }, - { - "name" : "Thermal & Night Vision" - }, - { - "name" : "Folding Knives" - }, - { - "name" : "Rimfire Ammunition" - }, - { - "name" : "Reloading Brass" - }, - { - "name" : "Reloading Calipers & Micrometers" - }, - { - "name" : "Cleaning & Finishing" - }, - { - "name" : "Axes & Hatchets" - }, - { - "name" : "Reloading Shotshell Equipment" - }, - { - "name" : "Karambit Knives" - }, - { - "name" : "Throwing Blades" - }, - { - "name" : "Handgun Parts" - }, - { - "name" : "Reloading Press Accessories" - }, - { - "name" : "Ak Rifles" - }, - { - "name" : "Vises & Clamps" - }, - { - "name" : "Shooting Pads" - }, - { - "name" : "Reloading Ammo Boxes & Labels" - }, - { - "name" : "Reloading Dies" - }, - { - "name" : "B5 Systems Uppers" - }, - { - "name" : "Hand Cleaners" - }, - { - "name" : "Patches" - }, - { - "name" : "Ar Rifles" - }, - { - "name" : "Upper Serialized Receivers" - }, - { - "name" : "Shoulder Holster" - }, - { - "name" : "Tools" - }, - { - "name" : "Optic Accessories" - }, - { - "name" : "Ak Magazines" - }, - { - "name" : "Red Dot Sights" - }, - { - "name" : "Sight Installation & Adjustment" - }, - { - "name" : "Ar Magazines" - }, - { - "name" : "Reloading Comparators & Concentricity Gauges" - }, - { - "name" : "Alternative Carry Holster" - }, - { - "name" : "Reloading Presses" - }, - { - "name" : "Handgun Gunsmithing" - }, - { - "name" : "Tactical Magazines" - }, - { - "name" : "Holographic Sights" - }, - { - "name" : "Iron Sights" - }, - { - "name" : "Shotgun Magazines" - }, - { - "name" : "Belly Band Holster" - } -]} */ diff --git a/src/data/parts_cats.json b/src/data/parts_cats.json index 00edfab..1c21410 100644 --- a/src/data/parts_cats.json +++ b/src/data/parts_cats.json @@ -1,267 +1,403 @@ { - "AR PISTOLS": {"name" : "AR Pistols"}, - "INSIDE WAISTBAND HOLSTER": {"name": "Inside Waistband Holster"}, - - "FIXED BLADE KNIVES": {"name" : "Fixed Blade Knives"}, - - "RELOADING PRIMERS": {"name" : "Reloading Primers"}, - - "ARCHERY": {"name" : "Archery"}, - - "PARTS KITS": {"name" : "Parts Kits"}, - - "RELOADING SHELLHOLDERS & SHELLPLATES": {"name" :"Reloading Shellholders & Shellplates" }, - - "RAILED UPPERS": {"name" : "Railed Uppers"}, - - "RELOADING CASE LENGTH GAUGES": {"name" : "Reloading Case Length Gauges"}, - - "GUN CASES & SAFES": {"name" : "Gun Cases & Safes"}, - - "MULTI TOOLS": {"name" : "Multi Tools"}, - - "RELOADING BENCHES & STANDS": {"name" :"Reloading Benches & Stands" }, - - "BIPODS & TRIPODS": {"name" : "Bipods & Tripods"}, - - "MAGNIFIERS": {"name" :"Magnifiers" }, - - "DOOR MATS": {"name" : "Door Mats"}, - - "RELOADING CASE CLEANING & PREPARATION": {"name" : "Reloading Case Cleaning & Preparation":}, - - "HANDGUN MAGAZINES": {"name" :"Handgun Magazines" }, - - "LASER SIGHTS": {"name" : "Laser Sights"}, - - "ANKLE HOLSTER": {"name" : "Ankle Holster"}, - - "OUTSIDE WAISTBAND HOLSTER": {"name" :"Outside Waistband Holster" }, - - "BRASS CATCHERS": {"name" : "Brass Catchers"}, - - "WALLETS": {"name" : "Wallets"}, - - "SELF-DEFENSE": {"name" : "Self-Defense"}, - - "PREMIUM UPPERS": {"name" : "Premium Uppers"}, - - "RELOADING PRIMING TOOLS": {"name" :"Reloading Priming Tools" }, - - "RELOADING LOADER KITS": {"name" : "Reloading Loader Kits"}, - - "BINOCULARS": {"name" : "Binoculars"}, - - "HOLSTER ACCESSORIES": {"name" : "Holster Accessories"}, - - "BELTS": {"name" :"Belts"}, - - "SCOPES": {"name" : "Scopes"}, - - "BACKPACKS": {"name" :"Backpacks" }, - - "BATTERIES": {"name" : "Batteries" }, - - "HEALTH & SAFETY": {"name" : "Health & Safety"}, - - "RELOADING MANUALS & REFERENCE MATERIALS": {"name" : "Reloading Manuals & Reference Materials"}, - - "SPOTTING SCOPES": {"name" : "Spotting Scopes"}, - - "POCKET HOLSTER": {"name" : "Pocket Holster"}, - - "VEHICLE ACCESSORIES": {"name" : "Vehicle Accessories"}, - - "AMMUNITION CARRIERS": {"name" : "Ammunition Carriers"}, - - "HANDGUN AMMUNITION": {"name" : "Handgun Ammunition"}, - - "CLASSIC UPPERS": {"name" : "Classic Uppers" }, - - "AK PISTOLS": {"name" : "Ak Pistols"}, - - "PHONE ACCESSORIES": {"name" : "Phone Accessories"}, - - "INSIDE & OUTSIDE WAISTBAND HOLSTER": {"name" : "Inside & Outside Waistband Holster" }, - - "MUZZLE DEVICES": {"name" : "Muzzle Devices"}, - - "SCOPE ACCESSORIES": {"name" :"Scope Accessories" }, - - "SUNGLASSES": {"name" : "Sunglasses"}, - - "REVOLVER CLIPS": {"name" : "Revolver Clips"}, - - "MAGAZINE ACCESSORIES": {"name" : "Magazine Accessories"}, - - "RELOADING TRAYS": {"name" : "Reloading Trays"}, - - "RIFLE PARTS": {"name" : "Rifle Parts"}, - - "TACTICAL": {"name" : "Tactical"}, - - "NOVELTIES": {"name" : "Novelties"}, - - "POUCHES": {"name" : "Pouches"}, - - "RIFLE MAGAZINES": {"name" : "Rifle Magazines"}, - - "SNAP CAPS": {"name" :"Snap Caps" }, - - "RELOADING MEPLAT UNIFORMERS & TRIMMERS": {"name" :"Reloading Meplat Uniformers & Trimmers" }, - - "AR GUNSMITHING": {"name" : "Ar Gunsmithing"}, - - "HANDCUFFS": {"name" : "Handcuffs"}, - - "HEADWEAR": {"name" : "Headwear"}, - - "THIGH HOLSTER": {"name" :"Thigh Holster" }, - - "RIFLE AMMUNITION": {"name" : "Rifle Ammunition"}, - - "SHOTGUNS": {"name" : "Shotguns"}, - - "RELOADING BULLET PULLERS": {"name" : "Reloading Bullet Pullers"}, - - "KNIFE ACCESSORIES": {"name" : "Knife Accessories"}, - - "SHOTGUN AMMUNITION": {"name" : "Shotgun Ammunition"}, - - "HANDGUNS": {"name" : "Handguns"}, - - "LIGHTS": {"name" : "Lights"}, - - "AR PARTS": {"name" : "Ar Parts"}, - - "AIRGUNS": {"name" : "Airguns"}, - - "MOE UPPERS": {"name" : "Moe Uppers"}, - - "SHOTGUN PARTS": {"name" : "Shotgun Parts"}, - - "RIFLES": {"name" : "Rifles"}, - - "TAPES": {"name" : "Tapes"}, - - "SHOVELS": {"name" : "Shovels"}, - - "STORAGE BOXES": {"name" : "Storage Boxes"}, - - "TACTICAL PENS": {"name" : "tactical Pens"}, - - "TARGETS": {"name" : "Targets"}, - - "SHOOTING RESTS": {"name" : "Shooting Rests"}, - - "BREACHING TOOLS": {"name" : "Breaching Tools"}, - - "EYE & EAR PROTECTION": {"name" : "Eye & Ear Protection"}, - - "FLAME THROWERS": {"name" : "Flame Throwers"}, - - "RANGEFINDERS": {"name" : "Rangefinders"}, - - "RELOADING BULLET CASTING": {"name" :"Reloading Bullet Casting" }, - - "KNIFE KITS & SETS": {"name" : "Knife Kits & Sets"}, - - "RELOADING BULLETS": {"name" : "Reloading Bullets"}, - - "AR LOWERS": {"name" : "Ar Lowers"}, - - "HANDGUN FRAMES": {"name" : "Handgun Frames"}, - - "RELOADING SHOTSHELL COMPONENTS": {"name" : "Reloading Shotshell Components"}, - - "GUIDES, MANUALS & REFERENCE": {"name" : "Guides, Manuals & Reference"}, - - "RELOADING DIE PARTS & ACCESSORIES": {"name" : "Reloading Die Parts & Accessories"}, - - "RELOADING POWDER MEASURES, SCALES & TOOLS": {"name" : "Reloading Powder Measures, Scales & Tools"}, - - "AK PARTS": {"name" : "Ak Parts"}, - - "BAGS": {"name" : "Bags" }, - - "MACHETES": {"name" :"Machetes" }, - - "THERMAL & NIGHT VISION": {"name" :"Thermal & Night Vision" }, - - "FOLDING KNIVES": {"name" : "Folding Knives"}, - - "RIMFIRE AMMUNITION": {"name" :"Rimfire Ammunition" }, - - "RELOADING BRASS": {"name" :"Reloading Brass" }, - - "RELOADING CALIPERS & MICROMETERS":{"name" : "Reloading Calipers & Micrometers"}, - - "CLEANING & FINISHING": {"name" : "Cleaning & Finishing"}, - - "AXES & HATCHETS": {"name" : "Axes & Hatchets"}, - - "RELOADING SHOTSHELL EQUIPMENT": {"name" : "Reloading Shotshell Equipment"}, - - "KARAMBIT KNIVES": {"name" : "Karambit Knives"}, - - "THROWING BLADES": {"name" : "Throwing Blades"}, - - "HANDGUN PARTS": {"name" : "Handgun Parts"}, - - "RELOADING PRESS ACCESSORIES": {"name" : "Reloading Press Accessories"}, - - "AK RIFLES": {"name" : "Ak Rifles", - - "VISES & CLAMPS": {"name" : "Vises & Clamps"}, - - "SHOOTING PADS": {"name" : "Shooting Pads"}, - - "RELOADING AMMO BOXES & LABELS": {"name" : "Reloading Ammo Boxes & Labels"}, - - "RELOADING DIES": {"name" : "Reloading Dies"}, - - "B5 SYSTEMS UPPERS": {"name" : "B5 Systems Uppers"}, - - "HAND CLEANERS": {"name" : "Hand Cleaners"}, - - "PATCHES": {"name" : "Patches"}, - - "AR RIFLES": {"name" :"Ar Rifles"}, - - "UPPER SERIALIZED RECEIVERS": {"name" : "Upper Serialized Receivers"}, - - "SHOULDER HOLSTER": {"name" :"Shoulder Holster" }, - - "TOOLS": {"name" : "Tools"}, - - "OPTIC ACCESSORIES": {"name" : "Optic Accessories"}, - - "AK MAGAZINES": {"name" :"Ak Magazines" }, - - "RED DOT SIGHTS": {"name" : "Red Dot Sights" }, - - "SIGHT INSTALLATION & ADJUSTMENT": {"name" : "Sight Installation & Adjustment" }, - - "AR MAGAZINES": {"name" : "Ar Magazines" }, - - "RELOADING COMPARATORS & CONCENTRICITY GAUGES": {"name" : "Reloading Comparators & Concentricity Gauges"}, - - "ALTERNATIVE CARRY HOLSTER": {"name" : "Alternative Carry Holster"}, - - "RELOADING PRESSES": {"name" : "Reloading Presses"}, - - "HANDGUN GUNSMITHING": {"name" :"Handgun Gunsmithing" }, - - "TACTICAL MAGAZINES": {"name" : "Tactical Magazines"}, - - "HOLOGRAPHIC SIGHTS": {"name" : "Holographic Sights"}, - - "IRON SIGHTS": {"name" :"Iron Sights" }, - - "SHOTGUN MAGAZINES": {"name" :"Shotgun Magazines" }, - - "BELLY BAND HOLSTER": {"name" :"Belly Band Holster" } - - - - + "AR PISTOLS": { + "name": "AR Pistols" + }, + "INSIDE WAISTBAND HOLSTER": { + "name": "Inside Waistband Holster" + }, + "FIXED BLADE KNIVES": { + "name": "Fixed Blade Knives" + }, + "RELOADING PRIMERS": { + "name": "Reloading Primers" + }, + "ARCHERY": { + "name": "Archery" + }, + "PARTS KITS": { + "name": "Parts Kits" + }, + "RELOADING SHELLHOLDERS & SHELLPLATES": { + "name": "Reloading Shellholders & Shellplates" + }, + "RAILED UPPERS": { + "name": "Railed Uppers" + }, + "RELOADING CASE LENGTH GAUGES": { + "name": "Reloading Case Length Gauges" + }, + "GUN CASES & SAFES": { + "name": "Gun Cases & Safes" + }, + "MULTI TOOLS": { + "name": "Multi Tools" + }, + "RELOADING BENCHES & STANDS": { + "name": "Reloading Benches & Stands" + }, + "BIPODS & TRIPODS": { + "name": "Bipods & Tripods" + }, + "MAGNIFIERS": { + "name": "Magnifiers" + }, + "DOOR MATS": { + "name": "Door Mats" + }, + "RELOADING CASE CLEANING & PREPARATION": { + "name": "Reloading Case Cleaning & Preparation" + }, + "HANDGUN MAGAZINES": { + "name": "Handgun Magazines" + }, + "LASER SIGHTS": { + "name": "Laser Sights" + }, + "ANKLE HOLSTER": { + "name": "Ankle Holster" + }, + "OUTSIDE WAISTBAND HOLSTER": { + "name": "Outside Waistband Holster" + }, + "BRASS CATCHERS": { + "name": "Brass Catchers" + }, + "WALLETS": { + "name": "Wallets" + }, + "SELF-DEFENSE": { + "name": "Self-Defense" + }, + "PREMIUM UPPERS": { + "name": "Premium Uppers" + }, + "RELOADING PRIMING TOOLS": { + "name": "Reloading Priming Tools" + }, + "RELOADING LOADER KITS": { + "name": "Reloading Loader Kits" + }, + "BINOCULARS": { + "name": "Binoculars" + }, + "HOLSTER ACCESSORIES": { + "name": "Holster Accessories" + }, + "BELTS": { + "name": "Belts" + }, + "SCOPES": { + "name": "Scopes" + }, + "BACKPACKS": { + "name": "Backpacks" + }, + "BATTERIES": { + "name": "Batteries" + }, + "HEALTH & SAFETY": { + "name": "Health & Safety" + }, + "RELOADING MANUALS & REFERENCE MATERIALS": { + "name": "Reloading Manuals & Reference Materials" + }, + "SPOTTING SCOPES": { + "name": "Spotting Scopes" + }, + "POCKET HOLSTER": { + "name": "Pocket Holster" + }, + "VEHICLE ACCESSORIES": { + "name": "Vehicle Accessories" + }, + "AMMUNITION CARRIERS": { + "name": "Ammunition Carriers" + }, + "HANDGUN AMMUNITION": { + "name": "Handgun Ammunition" + }, + "CLASSIC UPPERS": { + "name": "Classic Uppers" + }, + "AK PISTOLS": { + "name": "Ak Pistols" + }, + "PHONE ACCESSORIES": { + "name": "Phone Accessories" + }, + "INSIDE & OUTSIDE WAISTBAND HOLSTER": { + "name": "Inside & Outside Waistband Holster" + }, + "MUZZLE DEVICES": { + "name": "Muzzle Devices" + }, + "SCOPE ACCESSORIES": { + "name": "Scope Accessories" + }, + "SUNGLASSES": { + "name": "Sunglasses" + }, + "REVOLVER CLIPS": { + "name": "Revolver Clips" + }, + "MAGAZINE ACCESSORIES": { + "name": "Magazine Accessories" + }, + "RELOADING TRAYS": { + "name": "Reloading Trays" + }, + "RIFLE PARTS": { + "name": "Rifle Parts" + }, + "TACTICAL": { + "name": "Tactical" + }, + "NOVELTIES": { + "name": "Novelties" + }, + "POUCHES": { + "name": "Pouches" + }, + "RIFLE MAGAZINES": { + "name": "Rifle Magazines" + }, + "SNAP CAPS": { + "name": "Snap Caps" + }, + "RELOADING MEPLAT UNIFORMERS & TRIMMERS": { + "name": "Reloading Meplat Uniformers & Trimmers" + }, + "AR GUNSMITHING": { + "name": "Ar Gunsmithing" + }, + "HANDCUFFS": { + "name": "Handcuffs" + }, + "HEADWEAR": { + "name": "Headwear" + }, + "THIGH HOLSTER": { + "name": "Thigh Holster" + }, + "RIFLE AMMUNITION": { + "name": "Rifle Ammunition" + }, + "SHOTGUNS": { + "name": "Shotguns" + }, + "RELOADING BULLET PULLERS": { + "name": "Reloading Bullet Pullers" + }, + "KNIFE ACCESSORIES": { + "name": "Knife Accessories" + }, + "SHOTGUN AMMUNITION": { + "name": "Shotgun Ammunition" + }, + "HANDGUNS": { + "name": "Handguns" + }, + "LIGHTS": { + "name": "Lights" + }, + "AR PARTS": { + "name": "Ar Parts" + }, + "AIRGUNS": { + "name": "Airguns" + }, + "MOE UPPERS": { + "name": "Moe Uppers" + }, + "SHOTGUN PARTS": { + "name": "Shotgun Parts" + }, + "RIFLES": { + "name": "Rifles" + }, + "TAPES": { + "name": "Tapes" + }, + "SHOVELS": { + "name": "Shovels" + }, + "STORAGE BOXES": { + "name": "Storage Boxes" + }, + "TACTICAL PENS": { + "name": "tactical Pens" + }, + "TARGETS": { + "name": "Targets" + }, + "SHOOTING RESTS": { + "name": "Shooting Rests" + }, + "BREACHING TOOLS": { + "name": "Breaching Tools" + }, + "EYE & EAR PROTECTION": { + "name": "Eye & Ear Protection" + }, + "FLAME THROWERS": { + "name": "Flame Throwers" + }, + "RANGEFINDERS": { + "name": "Rangefinders" + }, + "RELOADING BULLET CASTING": { + "name": "Reloading Bullet Casting" + }, + "KNIFE KITS & SETS": { + "name": "Knife Kits & Sets" + }, + "RELOADING BULLETS": { + "name": "Reloading Bullets" + }, + "AR LOWERS": { + "name": "Ar Lowers", + "column_name" : "FINELINE" + }, + "AR COMPLETE LOWERS": { + "name": "AR Complete Lowers", + "column_name" : "FINELINE" + }, + "HANDGUN FRAMES": { + "name": "Handgun Frames" + }, + "RELOADING SHOTSHELL COMPONENTS": { + "name": "Reloading Shotshell Components" + }, + "GUIDES, MANUALS & REFERENCE": { + "name": "Guides, Manuals & Reference" + }, + "RELOADING DIE PARTS & ACCESSORIES": { + "name": "Reloading Die Parts & Accessories" + }, + "RELOADING POWDER MEASURES, SCALES & TOOLS": { + "name": "Reloading Powder Measures, Scales & Tools" + }, + "AK PARTS": { + "name": "Ak Parts" + }, + "BAGS": { + "name": "Bags" + }, + "MACHETES": { + "name": "Machetes" + }, + "THERMAL & NIGHT VISION": { + "name": "Thermal & Night Vision" + }, + "FOLDING KNIVES": { + "name": "Folding Knives" + }, + "RIMFIRE AMMUNITION": { + "name": "Rimfire Ammunition" + }, + "RELOADING BRASS": { + "name": "Reloading Brass" + }, + "RELOADING CALIPERS & MICROMETERS": { + "name": "Reloading Calipers & Micrometers" + }, + "CLEANING & FINISHING": { + "name": "Cleaning & Finishing" + }, + "AXES & HATCHETS": { + "name": "Axes & Hatchets" + }, + "RELOADING SHOTSHELL EQUIPMENT": { + "name": "Reloading Shotshell Equipment" + }, + "KARAMBIT KNIVES": { + "name": "Karambit Knives" + }, + "THROWING BLADES": { + "name": "Throwing Blades" + }, + "HANDGUN PARTS": { + "name": "Handgun Parts" + }, + "RELOADING PRESS ACCESSORIES": { + "name": "Reloading Press Accessories" + }, + "AK RIFLES": { + "name": "Ak Rifles" + }, + "VISES & CLAMPS": { + "name": "Vises & Clamps" + }, + "SHOOTING PADS": { + "name": "Shooting Pads" + }, + "RELOADING AMMO BOXES & LABELS": { + "name": "Reloading Ammo Boxes & Labels" + }, + "RELOADING DIES": { + "name": "Reloading Dies" + }, + "B5 SYSTEMS UPPERS": { + "name": "B5 Systems Uppers" + }, + "HAND CLEANERS": { + "name": "Hand Cleaners" + }, + "PATCHES": { + "name": "Patches" + }, + "AR RIFLES": { + "name": "Ar Rifles" + }, + "UPPER SERIALIZED RECEIVERS": { + "name": "Upper Serialized Receivers" + }, + "SHOULDER HOLSTER": { + "name": "Shoulder Holster" + }, + "TOOLS": { + "name": "Tools" + }, + "OPTIC ACCESSORIES": { + "name": "Optic Accessories" + }, + "AK MAGAZINES": { + "name": "Ak Magazines" + }, + "RED DOT SIGHTS": { + "name": "Red Dot Sights" + }, + "SIGHT INSTALLATION & ADJUSTMENT": { + "name": "Sight Installation & Adjustment" + }, + "AR MAGAZINES": { + "name": "Ar Magazines" + }, + "RELOADING COMPARATORS & CONCENTRICITY GAUGES": { + "name": "Reloading Comparators & Concentricity Gauges" + }, + "ALTERNATIVE CARRY HOLSTER": { + "name": "Alternative Carry Holster" + }, + "RELOADING PRESSES": { + "name": "Reloading Presses" + }, + "HANDGUN GUNSMITHING": { + "name": "Handgun Gunsmithing" + }, + "TACTICAL MAGAZINES": { + "name": "Tactical Magazines" + }, + "HOLOGRAPHIC SIGHTS": { + "name": "Holographic Sights" + }, + "IRON SIGHTS": { + "name": "Iron Sights" + }, + "SHOTGUN MAGAZINES": { + "name": "Shotgun Magazines" + }, + "BELLY BAND HOLSTER": { + "name": "Belly Band Holster" + } +} \ No newline at end of file diff --git a/src/db/queries/PSA/index.ts b/src/db/queries/PSA/index.ts index a5abc57..8376b55 100644 --- a/src/db/queries/PSA/index.ts +++ b/src/db/queries/PSA/index.ts @@ -1,6 +1,7 @@ import { db } from '../../index'; import { psa } from '../../../drizzle/schema'; import { eq, lt, gte, ne } from 'drizzle-orm'; +import CATEGORY from '@src/data/parts_cats.json'; export async function getPSA(page = 1) { const limit = 20; @@ -24,18 +25,6 @@ export async function getLowerBuildKits(page = 1) { .offset(offset); } -// DISABLING FOR NOW. NO NEED FOR AK. FOCUS ON AR15 -// export async function getAKBarreledReceivers(page = 1) { -// const limit = 20; -// const offset = (page - 1) * limit; - -// return await db.select() -// .from(psa) -// .limit(limit) -// .where(eq(psa.fineline, "AK Barreled Receivers")) -// .offset(offset); -// } - export async function getARCompleteLowers(page = 1) { const limit = 40; const offset = (page - 1) * limit; @@ -46,3 +35,14 @@ export async function getARCompleteLowers(page = 1) { .where(eq(psa.fineline, "AR Complete Lowers")) .offset(offset); } + +export async function getProductType(productType : any, page = 1) { + const limit = 40; + const offset = (page - 1) * limit; + + return await db.select() + .from(psa) + .limit(limit) + .where(eq(psa.fineline, productType.name)) + .offset(offset); +} diff --git a/src/db/queries/Products/index.ts b/src/db/queries/Products/index.ts index 9648294..b2127a2 100644 --- a/src/db/queries/Products/index.ts +++ b/src/db/queries/Products/index.ts @@ -1,10 +1,10 @@ // db/queries.ts "use server"; import { eq, not , asc} from "drizzle-orm"; -import { Product } from '../../schema/Product' +import { Product } from '@schemas/Product'; import { db } from '../../index'; -// Fetch all account +// Fetch all products export async function getAllProducts() { return await db.select().from(Product); }