fixes, nested the NextLink, it works, removed prisma

This commit is contained in:
2024-11-26 11:58:39 -05:00
parent 608705772e
commit 2454b1dc14
8 changed files with 51 additions and 181 deletions

View File

@@ -1,4 +1,4 @@
import { Button } from "@/components/ui/button"
import { Button } from "src/components/ui/button";
export default function BuilderPage() {

View File

@@ -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 = () => {
<Flex justify="space-between" align="center" maxW="5xl" mx="auto">
<Heading as="h1" size="lg">
{/* <NextLink href="/" passHref> */}
<Link color="#374151" _hover={{ textDecoration: "none" }}>
Ballistic Builder
<NextLink href="/" passHref> Ballistic Builder </NextLink>
</Link>
{/* </NextLink> */}
</Heading>
<Flex as="nav" gap="6">
{/* <NextLink href="/builder" passHref> */}
<Link color="#374151" _hover={{ textDecoration: "underline" }}>
Builder
<NextLink href="/builder" passHref> Builder </NextLink>
</Link>
{/* </NextLink> */}
{/* <NextLink href="/products" passHref> */}
<Link color="#374151" _hover={{ textDecoration: "underline" }}>
Products
<NextLink href="/products" passHref> Products </NextLink>
</Link>
{/* </NextLink> */}
{/* <NextLink href="/auth/signin" passHref> */}
<Link color="#374151" _hover={{ textDecoration: "underline" }}>
Sign In
<NextLink href="/auth/signin" passHref> Sign In </NextLink>
</Link>
{/* </NextLink> */}
</Flex>
</Flex>
</Box>

View File

@@ -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),
}));

View File

@@ -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", {

View File

@@ -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)
})