diff --git a/package-lock.json b/package-lock.json index f3e7a22..5e503e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "dotenv": "^16.4.5", - "drizzle-orm": "^0.36.3", + "drizzle-orm": "^0.36.4", "fontsource-roboto": "^4.0.0", "framer-motion": "^11.11.17", "lucide-react": "^0.460.0", @@ -5411,17 +5411,16 @@ } }, "node_modules/drizzle-orm": { - "version": "0.36.3", - "resolved": "https://registry.npmjs.org/drizzle-orm/-/drizzle-orm-0.36.3.tgz", - "integrity": "sha512-ffQB7CcyCTvQBK6xtRLMl/Jsd5xFTBs+UTHrgs1hbk68i5TPkbsoCPbKEwiEsQZfq2I7VH632XJpV1g7LS2H9Q==", - "license": "Apache-2.0", + "version": "0.36.4", + "resolved": "https://registry.npmjs.org/drizzle-orm/-/drizzle-orm-0.36.4.tgz", + "integrity": "sha512-1OZY3PXD7BR00Gl61UUOFihslDldfH4NFRH2MbP54Yxi0G/PKn4HfO65JYZ7c16DeP3SpM3Aw+VXVG9j6CRSXA==", "peerDependencies": { "@aws-sdk/client-rds-data": ">=3", "@cloudflare/workers-types": ">=3", "@electric-sql/pglite": ">=0.2.0", "@libsql/client": ">=0.10.0", "@libsql/client-wasm": ">=0.10.0", - "@neondatabase/serverless": ">=0.1", + "@neondatabase/serverless": ">=0.10.0", "@op-engineering/op-sqlite": ">=2", "@opentelemetry/api": "^1.4.1", "@planetscale/database": ">=1", diff --git a/package.json b/package.json index 24a9bf8..c6cc285 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "balistics-builder", - "version": "0.1.0", + "version": "0.2.0", "private": "true", "scripts": { "dev": "next dev", @@ -21,12 +21,11 @@ "@mui/styles": "^6.1.7", "@mui/system": "^6.1.7", "@mui/x-data-grid": "^7.22.2", - "@prisma/client": "^5.22.0", "@radix-ui/react-slot": "^1.1.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "dotenv": "^16.4.5", - "drizzle-orm": "^0.36.3", + "drizzle-orm": "^0.36.4", "fontsource-roboto": "^4.0.0", "framer-motion": "^11.11.17", "lucide-react": "^0.460.0", @@ -50,7 +49,6 @@ "eslint": "^8", "eslint-config-next": "15.0.3", "postcss": "^8", - "prisma": "^5.22.0", "tailwindcss": "^3.4.15", "tsx": "^4.19.2", "typescript": "^5.6.3" diff --git a/prisma/schema.prisma b/prisma/schema.prisma deleted file mode 100644 index 4cfe300..0000000 --- a/prisma/schema.prisma +++ /dev/null @@ -1,122 +0,0 @@ -generator client { - provider = "prisma-client-js" -} - -datasource db { - provider = "postgresql" - url = env("DATABASE_URL") -} - -model Post { - id Int @id @default(autoincrement()) - createdAt DateTime @default(now()) - updatedAt DateTime - title String? - content String? - published Boolean @default(false) - authorId Int - User User @relation(fields: [authorId], references: [id]) - - @@index([id]) -} - -model Profile { - id Int @id @default(autoincrement()) - bio String? - userId Int @unique - User User @relation(fields: [userId], references: [id]) - - @@index([id]) -} - -model User { - id Int @id @default(autoincrement()) - email String @unique - name String? - Post Post[] - Profile Profile? - - @@index([id]) -} - -model lipseycatalog { - id Int @id @default(autoincrement()) - itemno String @db.VarChar(20) - description1 String? - description2 String? - upc String? @db.VarChar(20) - manufacturermodelno String? @db.VarChar(30) - msrp Float? - model String? - calibergauge String? - manufacturer String? - type String? - action String? - barrellength String? - capacity String? - finish String? - overalllength String? - receiver String? - safety String? - sights String? - stockframegrips String? - magazine String? - weight String? - imagename String? - chamber String? - drilledandtapped String? - rateoftwist String? - itemtype String? - additionalfeature1 String? - additionalfeature2 String? - additionalfeature3 String? - shippingweight String? - boundbookmanufacturer String? - boundbookmodel String? - boundbooktype String? - nfathreadpattern String? - nfaattachmentmethod String? - nfabaffletype String? - silencercanbedisassembled String? - silencerconstructionmaterial String? - nfadbreduction String? - silenceroutsidediameter String? - nfaform3caliber String? - opticmagnification String? - maintubesize String? - adjustableobjective String? - objectivesize String? - opticadjustments String? - illuminatedreticle String? - reticle String? - exclusive String? - quantity String? @db.VarChar(10) - allocated String? - onsale String? - price Float? - currentprice Float? - retailmap Float? - fflrequired String? - sotrequired String? - exclusivetype String? - scopecoverincluded String? - special String? - sightstype String? - case String? - choke String? - dbreduction String? - family String? - finishtype String? - frame String? - griptype String? @db.VarChar(30) - handgunslidematerial String? - countryoforigin String? @db.VarChar(4) - itemlength String? - itemwidth String? - itemheight String? - packagelength Float? - packagewidth Float? - packageheight Float? - itemgroup String? @db.VarChar(40) - createdon DateTime? @db.Timestamp(6) -} diff --git a/src/app/Builder/page.tsx b/src/app/Builder/page.tsx index 2864dec..0f33f66 100644 --- a/src/app/Builder/page.tsx +++ b/src/app/Builder/page.tsx @@ -1,4 +1,8 @@ +<<<<<<< HEAD import { Button } from "@components/ui/button" +======= +import { Button } from "src/components/ui/button"; +>>>>>>> 2454b1dc14659dae1bc827566b8c071e89ce3ac5 export default function BuilderPage() { diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 3e6c405..3909f43 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -1,4 +1,5 @@ import { Box, Flex, Link, Heading } from "@chakra-ui/react"; +import NextLink from 'next/link'; const Header: React.FC = () => { return ( @@ -7,29 +8,27 @@ const Header: React.FC = () => { - {/* */} - Ballistic Builder + Ballistic Builder - {/* */} + - {/* */} + - Builder + Builder - {/* */} - {/* */} + + - Products + Products - {/* */} - {/* */} + - Sign In + Sign In - {/* */} + diff --git a/src/drizzle/relations.ts b/src/drizzle/relations.ts index 80768e2..5f1aec9 100644 --- a/src/drizzle/relations.ts +++ b/src/drizzle/relations.ts @@ -1,3 +1,13 @@ import { relations } from "drizzle-orm/relations"; -import { } from "./schema"; +import { balAccounts, builds } from "./schema"; +export const buildsRelations = relations(builds, ({one}) => ({ + balAccount: one(balAccounts, { + fields: [builds.accountId], + references: [balAccounts.id] + }), +})); + +export const balAccountsRelations = relations(balAccounts, ({many}) => ({ + builds: many(builds), +})); \ No newline at end of file diff --git a/src/drizzle/schema.ts b/src/drizzle/schema.ts index 79518f3..e7b47ae 100644 --- a/src/drizzle/schema.ts +++ b/src/drizzle/schema.ts @@ -1,6 +1,8 @@ -import { pgTable, integer, varchar, timestamp, text, numeric, unique, doublePrecision } from "drizzle-orm/pg-core" +import { pgTable, integer, varchar, timestamp, text, numeric, unique, foreignKey, doublePrecision } from "drizzle-orm/pg-core" import { sql } from "drizzle-orm" + + export const productFeeds = pgTable("product_feeds", { id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "productfeeds_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), resellerId: integer("reseller_id").notNull(), @@ -49,13 +51,6 @@ export const manufacturer = pgTable("manufacturer", { deletedAt: timestamp("deleted_at", { mode: 'string' }), }); -export const baseTable = pgTable("base_table", { - id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "base_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), - updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(), - createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(), - deletedAt: timestamp("deleted_at", { mode: 'string' }), -}); - export const componentType = pgTable("component_type", { id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "component_type_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), name: varchar({ length: 100 }).notNull(), @@ -80,13 +75,22 @@ export const balAccounts = pgTable("bal_accounts", { email: varchar({ length: 100 }), username: varchar({ length: 50 }).notNull(), passwordHash: varchar("password_hash", { length: 255 }).notNull(), -}, (table) => { +}, (self) => { return { balAccountsUsernameUnique: unique("bal_accounts_username_unique").on(table.username), balAccountsPasswordHashUnique: unique("bal_accounts_password_hash_unique").on(table.passwordHash), } }); +export const buildsComponents = pgTable("builds_components", { + id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "build_components_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), + buildId: integer("build_id").notNull(), + productId: integer("product_id").notNull(), + updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(), + createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(), + deletedAt: timestamp("deleted_at", { mode: 'string' }), +}); + export const builds = pgTable("builds", { id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "build_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), accountId: integer("account_id").notNull(), @@ -95,15 +99,14 @@ export const builds = pgTable("builds", { updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(), createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(), deletedAt: timestamp("deleted_at", { mode: 'string' }), -}); - -export const buildsComponents = pgTable("builds_components", { - id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "build_components_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), - buildId: integer("build_id").notNull(), - productId: integer("product_id").notNull(), - updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(), - createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(), - deletedAt: timestamp("deleted_at", { mode: 'string' }), +}, (table) => { + return { + buildsBalAccountsFk: foreignKey({ + columns: [table.accountId], + foreignColumns: [balAccounts.id], + name: "builds_bal_accounts_fk" + }), + } }); export const lipseycatalog = pgTable("lipseycatalog", { diff --git a/src/lib/script.ts b/src/lib/script.ts deleted file mode 100644 index 04cfb4b..0000000 --- a/src/lib/script.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { PrismaClient } from '@prisma/client' - -const prisma = new PrismaClient() - -async function main() { - // ... you will write your Prisma Client queries here -} - -main() - .then(async () => { - await prisma.$disconnect() - }) - .catch(async (e) => { - console.error(e) - await prisma.$disconnect() - process.exit(1) - }) \ No newline at end of file