mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
stuff
This commit is contained in:
30
src/app/(auth)/reset-password/shared.ts
Normal file
30
src/app/(auth)/reset-password/shared.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { type inferRouterInputs, type inferRouterOutputs } from "@trpc/server";
|
||||||
|
import superjson from "superjson";
|
||||||
|
|
||||||
|
import { type AppRouter } from "@/server/api/root";
|
||||||
|
|
||||||
|
export const transformer = superjson;
|
||||||
|
|
||||||
|
function getBaseUrl() {
|
||||||
|
if (typeof window !== "undefined") return "";
|
||||||
|
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`;
|
||||||
|
return `http://localhost:${process.env.PORT ?? 3000}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getUrl() {
|
||||||
|
return getBaseUrl() + "/api/trpc";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inference helper for inputs.
|
||||||
|
*
|
||||||
|
* @example type HelloInput = RouterInputs['example']['hello']
|
||||||
|
*/
|
||||||
|
export type RouterInputs = inferRouterInputs<AppRouter>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inference helper for outputs.
|
||||||
|
*
|
||||||
|
* @example type HelloOutput = RouterOutputs['example']['hello']
|
||||||
|
*/
|
||||||
|
export type RouterOutputs = inferRouterOutputs<AppRouter>;
|
||||||
30
src/app/(auth)/signup/shared.ts
Normal file
30
src/app/(auth)/signup/shared.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { type inferRouterInputs, type inferRouterOutputs } from "@trpc/server";
|
||||||
|
import superjson from "superjson";
|
||||||
|
|
||||||
|
import { type AppRouter } from "@/server/api/root";
|
||||||
|
|
||||||
|
export const transformer = superjson;
|
||||||
|
|
||||||
|
function getBaseUrl() {
|
||||||
|
if (typeof window !== "undefined") return "";
|
||||||
|
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`;
|
||||||
|
return `http://localhost:${process.env.PORT ?? 3000}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getUrl() {
|
||||||
|
return getBaseUrl() + "/api/trpc";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inference helper for inputs.
|
||||||
|
*
|
||||||
|
* @example type HelloInput = RouterInputs['example']['hello']
|
||||||
|
*/
|
||||||
|
export type RouterInputs = inferRouterInputs<AppRouter>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inference helper for outputs.
|
||||||
|
*
|
||||||
|
* @example type HelloOutput = RouterOutputs['example']['hello']
|
||||||
|
*/
|
||||||
|
export type RouterOutputs = inferRouterOutputs<AppRouter>;
|
||||||
20
src/app/api/auth/bugout/route.tsx
Normal file
20
src/app/api/auth/bugout/route.tsx
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { NextResponse } from 'next/server';
|
||||||
|
import { db } from '@db/index';
|
||||||
|
import { users } from '@schemas/schema';
|
||||||
|
import bcrypt from 'bcryptjs';
|
||||||
|
import { eq } from 'drizzle-orm';
|
||||||
|
import { lucia } from '@/lib/auth';
|
||||||
|
import { validateRequest } from '@/lib/auth/validate-request';
|
||||||
|
|
||||||
|
export async function POST(request: Request) {
|
||||||
|
try {
|
||||||
|
const {user, session } = await validateRequest();
|
||||||
|
if (session) {
|
||||||
|
await lucia.invalidateSession(session.id);
|
||||||
|
}
|
||||||
|
return NextResponse.json({ message: 'Sign out successful', redirect: '/' }, { status: 200 });
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Sign in error:', error);
|
||||||
|
return NextResponse.json({ error: 'Failed to sign in' }, { status: 500 });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ export async function POST(request: Request) {
|
|||||||
first_name,
|
first_name,
|
||||||
username,
|
username,
|
||||||
email,
|
email,
|
||||||
password_hash: hashedPassword,
|
hashedPassword: hashedPassword,
|
||||||
} satisfies typeof users.$inferInsert;
|
} satisfies typeof users.$inferInsert;
|
||||||
|
|
||||||
await db.insert(users).values(newUser);
|
await db.insert(users).values(newUser);
|
||||||
6
src/app/api/webhooks/stripe/package.json
Normal file
6
src/app/api/webhooks/stripe/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"description": "this is required for the lucia-authentication package"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -87,7 +87,7 @@ const navigation = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function PopNav() {
|
export default function PopNav(props:any) {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [user, setUser] = useState<User | null>(null);
|
const [user, setUser] = useState<User | null>(null);
|
||||||
|
|
||||||
@@ -103,6 +103,7 @@ export default function PopNav() {
|
|||||||
return (
|
return (
|
||||||
<div className="bg-white">
|
<div className="bg-white">
|
||||||
{/* Mobile menu */}
|
{/* Mobile menu */}
|
||||||
|
{props.sessionCookie?.user?.email}
|
||||||
<Dialog open={open} onClose={setOpen} className="relative z-40 lg:hidden">
|
<Dialog open={open} onClose={setOpen} className="relative z-40 lg:hidden">
|
||||||
<DialogBackdrop
|
<DialogBackdrop
|
||||||
transition
|
transition
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import { validateRequest } from "@/lib/auth/validate-request";
|
|||||||
import { User } from "lucia";
|
import { User } from "lucia";
|
||||||
import {cookies} from 'next/headers';
|
import {cookies} from 'next/headers';
|
||||||
import PopNavDialog from "../PopNavDialog/page";
|
import PopNavDialog from "../PopNavDialog/page";
|
||||||
|
import { getUserByID } from "@/actions/userActions";
|
||||||
|
|
||||||
const navigation = {
|
const navigation = {
|
||||||
categories: [
|
categories: [
|
||||||
@@ -88,11 +89,13 @@ const navigation = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default async function PopNav() {
|
export default async function PopNav() {
|
||||||
const cookieStore = await cookies();
|
//const cookieStore = await cookies();
|
||||||
const session = cookieStore.get('session');
|
//const sessionValue = cookieStore.get('session')?.value;
|
||||||
|
const session = await validateRequest();
|
||||||
|
//const user = await getUserByID(sessionValue as string);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-white">{session?.value}
|
<div className="bg-white">
|
||||||
<PopNavDialog sessionCookie={session}/>
|
<PopNavDialog sessionCookie={session}/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -93,13 +93,13 @@ export default function PopNavDialog(props:any) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchUser = async () => {
|
const fetchUser = async () => {
|
||||||
const result = null; //(await validateRequest());
|
setUser(props.sessionCookie.user);
|
||||||
/* if (result.user) {
|
|
||||||
setUser(result.user);
|
|
||||||
} */
|
|
||||||
};
|
};
|
||||||
fetchUser();
|
fetchUser();
|
||||||
}, []);
|
}, []);
|
||||||
|
const isSignedIn = user !== null;
|
||||||
|
const linkPath = (isSignedIn) ? "/bugout": "/login";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Mobile menu */}
|
{/* Mobile menu */}
|
||||||
@@ -220,7 +220,7 @@ export default function PopNavDialog(props:any) {
|
|||||||
href="/login"
|
href="/login"
|
||||||
className="-m-2 block p-2 font-medium text-gray-900"
|
className="-m-2 block p-2 font-medium text-gray-900"
|
||||||
>
|
>
|
||||||
Sign In
|
{user == null?"Sign Up": "Sign out"} {user?.email}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div className="flow-root">
|
<div className="flow-root">
|
||||||
@@ -372,10 +372,9 @@ export default function PopNavDialog(props:any) {
|
|||||||
<div className="ml-auto flex items-center">
|
<div className="ml-auto flex items-center">
|
||||||
<div className="hidden lg:flex lg:flex-1 lg:items-center lg:justify-end lg:space-x-6">
|
<div className="hidden lg:flex lg:flex-1 lg:items-center lg:justify-end lg:space-x-6">
|
||||||
<a
|
<a
|
||||||
href="/login"
|
href= {linkPath}
|
||||||
className="text-sm font-medium text-gray-700 hover:text-gray-800"
|
className="text-sm font-medium text-gray-700 hover:text-gray-800" >
|
||||||
>
|
{user == null?"Sign In": "Log Out"}
|
||||||
Sign In
|
|
||||||
</a>
|
</a>
|
||||||
<span aria-hidden="true" className="h-6 w-px bg-gray-200" />
|
<span aria-hidden="true" className="h-6 w-px bg-gray-200" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
6
src/app/fonts/package.json
Normal file
6
src/app/fonts/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"description": "this is required for the lucia-authentication package"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
6
src/components/ui/package.json
Normal file
6
src/components/ui/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"description": "this is required for the lucia-authentication package"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
6
src/config/package.json
Normal file
6
src/config/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"description": "this is required for the lucia-authentication package"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,386 +0,0 @@
|
|||||||
import { pgTable, integer, varchar, text, numeric, timestamp, unique, check, bigserial, date, boolean, uuid, bigint, real, doublePrecision, primaryKey, foreignKey } from "drizzle-orm/pg-core"
|
|
||||||
import { sql } from "drizzle-orm"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const products = pgTable("products", {
|
|
||||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "products_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
|
||||||
name: varchar({ length: 255 }).notNull(),
|
|
||||||
description: text().notNull(),
|
|
||||||
price: numeric().notNull(),
|
|
||||||
resellerId: integer("reseller_id").notNull(),
|
|
||||||
categoryId: integer("category_id").notNull(),
|
|
||||||
stockQty: integer("stock_qty").default(0),
|
|
||||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const users = pgTable("users-keep", {
|
|
||||||
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'),
|
|
||||||
uuid: uuid().defaultRandom(),
|
|
||||||
}, (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])`),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const categories = pgTable("categories", {
|
|
||||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "categories_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
|
||||||
name: varchar({ length: 100 }).notNull(),
|
|
||||||
parentCategoryId: integer("parent_category_id"),
|
|
||||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
|
||||||
uuid: uuid().defaultRandom(),
|
|
||||||
});
|
|
||||||
|
|
||||||
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(),
|
|
||||||
feedUrl: varchar("feed_url", { length: 255 }).notNull(),
|
|
||||||
lastUpdate: timestamp("last_update", { mode: 'string' }),
|
|
||||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
|
||||||
uuid: uuid().defaultRandom(),
|
|
||||||
}, (table) => {
|
|
||||||
return {
|
|
||||||
productFeedsUuidUnique: unique("product_feeds_uuid_unique").on(table.uuid),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const user = pgTable("users", {
|
|
||||||
id: text().primaryKey().notNull(),
|
|
||||||
name: text(),
|
|
||||||
email: text(),
|
|
||||||
emailVerified: timestamp({ mode: 'string' }),
|
|
||||||
image: text(),
|
|
||||||
}, (table) => {
|
|
||||||
return {
|
|
||||||
userEmailUnique: unique("user_email_unique").on(table.email),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const userActivityLog = pgTable("user_activity_log", {
|
|
||||||
// You can use { mode: "bigint" } if numbers are exceeding js number limitations
|
|
||||||
id: bigint({ mode: "number" }).primaryKey().generatedAlwaysAsIdentity({ name: "user_activity_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
|
||||||
// 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`),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const brands = pgTable("brands", {
|
|
||||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "brands_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
|
||||||
name: varchar({ length: 100 }).notNull(),
|
|
||||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
|
||||||
uuid: uuid().defaultRandom(),
|
|
||||||
}, (table) => {
|
|
||||||
return {
|
|
||||||
brandsUuidUnique: unique("brands_uuid_unique").on(table.uuid),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const manufacturer = pgTable("manufacturer", {
|
|
||||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "manufacturer_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
|
||||||
name: varchar({ length: 100 }).notNull(),
|
|
||||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
|
||||||
uuid: uuid().defaultRandom(),
|
|
||||||
}, (table) => {
|
|
||||||
return {
|
|
||||||
manufacturerUuidUnique: unique("manufacturer_uuid_unique").on(table.uuid),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const session = pgTable("sessions", {
|
|
||||||
sessionToken: text().primaryKey().notNull(),
|
|
||||||
userId: text().notNull(),
|
|
||||||
expires: timestamp({ mode: 'string' }).notNull(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const states = pgTable("states", {
|
|
||||||
id: integer().primaryKey().generatedByDefaultAsIdentity({ name: "states_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
|
||||||
state: varchar({ length: 50 }),
|
|
||||||
abbreviation: varchar({ length: 50 }),
|
|
||||||
});
|
|
||||||
|
|
||||||
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(),
|
|
||||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
|
||||||
uuid: uuid().defaultRandom(),
|
|
||||||
}, (table) => {
|
|
||||||
return {
|
|
||||||
componentTypeUuidUnique: unique("component_type_uuid_unique").on(table.uuid),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const aeroPrecision = pgTable("aero_precision", {
|
|
||||||
sku: text().primaryKey().notNull(),
|
|
||||||
manufacturerId: text("manufacturer_id"),
|
|
||||||
brandName: text("brand_name"),
|
|
||||||
productName: text("product_name"),
|
|
||||||
longDescription: text("long_description"),
|
|
||||||
shortDescription: text("short_description"),
|
|
||||||
department: text(),
|
|
||||||
category: text(),
|
|
||||||
subcategory: text(),
|
|
||||||
thumbUrl: text("thumb_url"),
|
|
||||||
imageUrl: text("image_url"),
|
|
||||||
buyLink: text("buy_link"),
|
|
||||||
keywords: text(),
|
|
||||||
reviews: text(),
|
|
||||||
retailPrice: numeric("retail_price"),
|
|
||||||
salePrice: numeric("sale_price"),
|
|
||||||
brandPageLink: text("brand_page_link"),
|
|
||||||
brandLogoImage: text("brand_logo_image"),
|
|
||||||
productPageViewTracking: text("product_page_view_tracking"),
|
|
||||||
variantsXml: text("variants_xml"),
|
|
||||||
mediumImageUrl: text("medium_image_url"),
|
|
||||||
productContentWidget: text("product_content_widget"),
|
|
||||||
googleCategorization: text("google_categorization"),
|
|
||||||
itemBasedCommission: text("item_based_commission"),
|
|
||||||
uuid: uuid().defaultRandom(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const compartment = pgTable("compartment", {
|
|
||||||
id: uuid().defaultRandom().primaryKey().notNull(),
|
|
||||||
name: varchar({ length: 100 }).notNull(),
|
|
||||||
description: varchar({ length: 300 }),
|
|
||||||
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(),
|
|
||||||
name: varchar({ length: 255 }).notNull(),
|
|
||||||
description: text(),
|
|
||||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
|
||||||
uuid: uuid().defaultRandom(),
|
|
||||||
}, (table) => {
|
|
||||||
return {
|
|
||||||
buildsUuidUnique: unique("builds_uuid_unique").on(table.uuid),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const psa = pgTable("psa", {
|
|
||||||
sku: varchar("SKU", { length: 50 }),
|
|
||||||
manufacturerId: varchar("MANUFACTURER_ID", { length: 50 }),
|
|
||||||
brandName: varchar("BRAND_NAME", { length: 50 }),
|
|
||||||
productName: varchar("PRODUCT_NAME", { length: 255 }),
|
|
||||||
longDescription: text("LONG_DESCRIPTION"),
|
|
||||||
shortDescription: varchar("SHORT_DESCRIPTION", { length: 50 }),
|
|
||||||
department: varchar("DEPARTMENT", { length: 50 }),
|
|
||||||
category: varchar("CATEGORY", { length: 50 }),
|
|
||||||
subcategory: varchar("SUBCATEGORY", { length: 50 }),
|
|
||||||
thumbUrl: varchar("THUMB_URL", { length: 50 }),
|
|
||||||
imageUrl: varchar("IMAGE_URL", { length: 50 }),
|
|
||||||
buyLink: varchar("BUY_LINK", { length: 128 }),
|
|
||||||
keywords: varchar("KEYWORDS", { length: 50 }),
|
|
||||||
reviews: varchar("REVIEWS", { length: 50 }),
|
|
||||||
retailPrice: real("RETAIL_PRICE"),
|
|
||||||
salePrice: real("SALE_PRICE"),
|
|
||||||
brandPageLink: varchar("BRAND_PAGE_LINK", { length: 50 }),
|
|
||||||
brandLogoImage: varchar("BRAND_LOGO_IMAGE", { length: 50 }),
|
|
||||||
productPageViewTracking: varchar("PRODUCT_PAGE_VIEW_TRACKING", { length: 256 }),
|
|
||||||
parentGroupId: varchar("PARENT_GROUP_ID", { length: 50 }),
|
|
||||||
fineline: varchar("FINELINE", { length: 50 }),
|
|
||||||
superfineline: varchar("SUPERFINELINE", { length: 200 }),
|
|
||||||
modelnumber: varchar("MODELNUMBER", { length: 50 }),
|
|
||||||
caliber: varchar("CALIBER", { length: 200 }),
|
|
||||||
upc: varchar("UPC", { length: 100 }),
|
|
||||||
mediumImageUrl: varchar("MEDIUM_IMAGE_URL", { length: 50 }),
|
|
||||||
productContentWidget: varchar("PRODUCT_CONTENT_WIDGET", { length: 256 }),
|
|
||||||
googleCategorization: varchar("GOOGLE_CATEGORIZATION", { length: 50 }),
|
|
||||||
itemBasedCommission: varchar("ITEM_BASED_COMMISSION", { length: 50 }),
|
|
||||||
uuid: uuid().defaultRandom(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const lipseycatalog = pgTable("lipseycatalog", {
|
|
||||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "lipseycatalog_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
|
||||||
itemno: varchar({ length: 20 }).notNull(),
|
|
||||||
description1: text(),
|
|
||||||
description2: text(),
|
|
||||||
upc: varchar({ length: 20 }),
|
|
||||||
manufacturermodelno: varchar({ length: 30 }),
|
|
||||||
msrp: doublePrecision(),
|
|
||||||
model: text(),
|
|
||||||
calibergauge: text(),
|
|
||||||
manufacturer: text(),
|
|
||||||
type: text(),
|
|
||||||
action: text(),
|
|
||||||
barrellength: text(),
|
|
||||||
capacity: text(),
|
|
||||||
finish: text(),
|
|
||||||
overalllength: text(),
|
|
||||||
receiver: text(),
|
|
||||||
safety: text(),
|
|
||||||
sights: text(),
|
|
||||||
stockframegrips: text(),
|
|
||||||
magazine: text(),
|
|
||||||
weight: text(),
|
|
||||||
imagename: text(),
|
|
||||||
chamber: text(),
|
|
||||||
drilledandtapped: text(),
|
|
||||||
rateoftwist: text(),
|
|
||||||
itemtype: text(),
|
|
||||||
additionalfeature1: text(),
|
|
||||||
additionalfeature2: text(),
|
|
||||||
additionalfeature3: text(),
|
|
||||||
shippingweight: text(),
|
|
||||||
boundbookmanufacturer: text(),
|
|
||||||
boundbookmodel: text(),
|
|
||||||
boundbooktype: text(),
|
|
||||||
nfathreadpattern: text(),
|
|
||||||
nfaattachmentmethod: text(),
|
|
||||||
nfabaffletype: text(),
|
|
||||||
silencercanbedisassembled: text(),
|
|
||||||
silencerconstructionmaterial: text(),
|
|
||||||
nfadbreduction: text(),
|
|
||||||
silenceroutsidediameter: text(),
|
|
||||||
nfaform3Caliber: text(),
|
|
||||||
opticmagnification: text(),
|
|
||||||
maintubesize: text(),
|
|
||||||
adjustableobjective: text(),
|
|
||||||
objectivesize: text(),
|
|
||||||
opticadjustments: text(),
|
|
||||||
illuminatedreticle: text(),
|
|
||||||
reticle: text(),
|
|
||||||
exclusive: text(),
|
|
||||||
quantity: varchar({ length: 10 }).default(sql`NULL`),
|
|
||||||
allocated: text(),
|
|
||||||
onsale: text(),
|
|
||||||
price: doublePrecision(),
|
|
||||||
currentprice: doublePrecision(),
|
|
||||||
retailmap: doublePrecision(),
|
|
||||||
fflrequired: text(),
|
|
||||||
sotrequired: text(),
|
|
||||||
exclusivetype: text(),
|
|
||||||
scopecoverincluded: text(),
|
|
||||||
special: text(),
|
|
||||||
sightstype: text(),
|
|
||||||
case: text(),
|
|
||||||
choke: text(),
|
|
||||||
dbreduction: text(),
|
|
||||||
family: text(),
|
|
||||||
finishtype: text(),
|
|
||||||
frame: text(),
|
|
||||||
griptype: varchar({ length: 30 }),
|
|
||||||
handgunslidematerial: text(),
|
|
||||||
countryoforigin: varchar({ length: 4 }),
|
|
||||||
itemlength: text(),
|
|
||||||
itemwidth: text(),
|
|
||||||
itemheight: text(),
|
|
||||||
packagelength: doublePrecision(),
|
|
||||||
packagewidth: doublePrecision(),
|
|
||||||
packageheight: doublePrecision(),
|
|
||||||
itemgroup: varchar({ length: 40 }),
|
|
||||||
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' }),
|
|
||||||
uuid: uuid().defaultRandom(),
|
|
||||||
}, (table) => {
|
|
||||||
return {
|
|
||||||
buildsComponentsUuidUnique: unique("builds_components_uuid_unique").on(table.uuid),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const balResellers = pgTable("bal_resellers", {
|
|
||||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "resellers_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
|
||||||
name: varchar({ length: 100 }).notNull(),
|
|
||||||
websiteUrl: varchar("website_url", { length: 255 }),
|
|
||||||
contactEmail: varchar("contact_email", { length: 100 }),
|
|
||||||
updatedAt: timestamp("updated_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
|
||||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
|
||||||
uuid: uuid().defaultRandom(),
|
|
||||||
}, (table) => {
|
|
||||||
return {
|
|
||||||
balResellersUuidUnique: unique("bal_resellers_uuid_unique").on(table.uuid),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const verificationToken = pgTable("verificationTokens", {
|
|
||||||
identifier: text().notNull(),
|
|
||||||
token: text().notNull(),
|
|
||||||
expires: timestamp({ mode: 'string' }).notNull(),
|
|
||||||
}, (table) => {
|
|
||||||
return {
|
|
||||||
verificationTokenIdentifierTokenPk: primaryKey({ columns: [table.identifier, table.token], name: "verificationToken_identifier_token_pk"}),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const authenticator = pgTable("authenticator", {
|
|
||||||
credentialId: text().notNull(),
|
|
||||||
userId: text().notNull(),
|
|
||||||
providerAccountId: text().notNull(),
|
|
||||||
credentialPublicKey: text().notNull(),
|
|
||||||
counter: integer().notNull(),
|
|
||||||
credentialDeviceType: text().notNull(),
|
|
||||||
credentialBackedUp: boolean().notNull(),
|
|
||||||
transports: text(),
|
|
||||||
}, (table) => {
|
|
||||||
return {
|
|
||||||
authenticatorUserIdUserIdFk: foreignKey({
|
|
||||||
columns: [table.userId],
|
|
||||||
foreignColumns: [user.id],
|
|
||||||
name: "authenticator_userId_user_id_fk"
|
|
||||||
}).onDelete("cascade"),
|
|
||||||
authenticatorUserIdCredentialIdPk: primaryKey({ columns: [table.credentialId, table.userId], name: "authenticator_userId_credentialID_pk"}),
|
|
||||||
authenticatorCredentialIdUnique: unique("authenticator_credentialID_unique").on(table.credentialId),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const account = pgTable("accounts", {
|
|
||||||
userId: text().notNull(),
|
|
||||||
type: text().notNull(),
|
|
||||||
provider: text().notNull(),
|
|
||||||
providerAccountId: text().notNull(),
|
|
||||||
refreshToken: text("refresh_token"),
|
|
||||||
accessToken: text("access_token"),
|
|
||||||
expiresAt: integer("expires_at"),
|
|
||||||
tokenType: text("token_type"),
|
|
||||||
scope: text(),
|
|
||||||
idToken: text("id_token"),
|
|
||||||
sessionState: text("session_state"),
|
|
||||||
}, (table) => {
|
|
||||||
return {
|
|
||||||
accountProviderProviderAccountIdPk: primaryKey({ columns: [table.provider, table.providerAccountId], name: "account_provider_providerAccountId_pk"}),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
6
src/lib/auth/package.json
Normal file
6
src/lib/auth/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"description": "this is required for the lucia-authentication package"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
6
src/lib/email/package.json
Normal file
6
src/lib/email/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"description": "this is required for the lucia-authentication package"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
6
src/lib/validators/package.json
Normal file
6
src/lib/validators/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"description": "this is required for the lucia-authentication package"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
6
src/server/api/routers/package.json
Normal file
6
src/server/api/routers/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"description": "this is required for the lucia-authentication package"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
6
src/server/api/routers/post/package.json
Normal file
6
src/server/api/routers/post/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"description": "this is required for the lucia-authentication package"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
6
src/server/api/routers/stripe/package.json
Normal file
6
src/server/api/routers/stripe/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"description": "this is required for the lucia-authentication package"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
30
src/server/api/routers/stripe/shared.ts
Normal file
30
src/server/api/routers/stripe/shared.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { type inferRouterInputs, type inferRouterOutputs } from "@trpc/server";
|
||||||
|
import superjson from "superjson";
|
||||||
|
|
||||||
|
import { type AppRouter } from "@/server/api/root";
|
||||||
|
|
||||||
|
export const transformer = superjson;
|
||||||
|
|
||||||
|
function getBaseUrl() {
|
||||||
|
if (typeof window !== "undefined") return "";
|
||||||
|
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`;
|
||||||
|
return `http://localhost:${process.env.PORT ?? 3000}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getUrl() {
|
||||||
|
return getBaseUrl() + "/api/trpc";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inference helper for inputs.
|
||||||
|
*
|
||||||
|
* @example type HelloInput = RouterInputs['example']['hello']
|
||||||
|
*/
|
||||||
|
export type RouterInputs = inferRouterInputs<AppRouter>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inference helper for outputs.
|
||||||
|
*
|
||||||
|
* @example type HelloOutput = RouterOutputs['example']['hello']
|
||||||
|
*/
|
||||||
|
export type RouterOutputs = inferRouterOutputs<AppRouter>;
|
||||||
6
src/trpc/package.json
Normal file
6
src/trpc/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"description": "this is required for the lucia-authentication package"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user