mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
nothing
This commit is contained in:
103
src/components/UserRegistration/index.tsx
Normal file
103
src/components/UserRegistration/index.tsx
Normal file
@@ -0,0 +1,103 @@
|
||||
// components/UserRegistration.js
|
||||
import { useState } from 'react';
|
||||
import { useToast } from '@chakra-ui/react';
|
||||
import {
|
||||
FormControl,
|
||||
FormLabel,
|
||||
Input,
|
||||
Button,
|
||||
Stack,
|
||||
Heading,
|
||||
} from '@chakra-ui/react';
|
||||
import { drizzle } from 'drizzle-orm';
|
||||
|
||||
export default function UserRegistration() {
|
||||
const [formData, setFormData] = useState({
|
||||
username: '',
|
||||
email: '',
|
||||
password: '',
|
||||
});
|
||||
|
||||
const toast = useToast();
|
||||
|
||||
const handleChange = (e) => {
|
||||
const { name, value } = e.target;
|
||||
setFormData({ ...formData, [name]: value });
|
||||
};
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
// Example of database interaction using drizzle-orm:
|
||||
const db = drizzle(/* your database connection logic */);
|
||||
|
||||
try {
|
||||
// Replace 'users' with your actual table name
|
||||
await db.insert('users').values(formData);
|
||||
toast({
|
||||
title: 'Account created.',
|
||||
description: "We've created your account successfully!",
|
||||
status: 'success',
|
||||
duration: 5000,
|
||||
isClosable: true,
|
||||
});
|
||||
|
||||
// Reset the form
|
||||
setFormData({ username: '', email: '', password: '' });
|
||||
} catch (error) {
|
||||
toast({
|
||||
title: 'An error occurred.',
|
||||
description: error.message,
|
||||
status: 'error',
|
||||
duration: 5000,
|
||||
isClosable: true,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Stack spacing={4} w="400px" mx="auto" mt={10}>
|
||||
<Heading as="h2" size="lg">User Registration</Heading>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<FormControl isRequired>
|
||||
<FormLabel>Username</FormLabel>
|
||||
<Input
|
||||
name="username"
|
||||
value={formData.username}
|
||||
onChange={handleChange}
|
||||
placeholder="Enter your username"
|
||||
/>
|
||||
</FormControl>
|
||||
|
||||
<FormControl isRequired>
|
||||
<FormLabel>Email</FormLabel>
|
||||
<Input
|
||||
type="email"
|
||||
name="email"
|
||||
value={formData.email}
|
||||
onChange={handleChange}
|
||||
placeholder="Enter your email"
|
||||
/>
|
||||
</FormControl>
|
||||
|
||||
<FormControl isRequired>
|
||||
<FormLabel>Password</FormLabel>
|
||||
<Input
|
||||
type="password"
|
||||
name="password"
|
||||
value={formData.password}
|
||||
onChange={handleChange}
|
||||
placeholder="Enter your password"
|
||||
/>
|
||||
</FormControl>
|
||||
|
||||
<Button
|
||||
mt={4}
|
||||
colorScheme="teal"
|
||||
type="submit">
|
||||
Create Account
|
||||
</Button>
|
||||
</form>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { pgTable, integer, varchar, timestamp, text, numeric, unique, foreignKey, doublePrecision } from "drizzle-orm/pg-core"
|
||||
import { pgTable, integer, varchar, timestamp, text, numeric, unique, foreignKey, doublePrecision, real } from "drizzle-orm/pg-core"
|
||||
import { sql } from "drizzle-orm"
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ export const balAccounts = pgTable("bal_accounts", {
|
||||
email: varchar({ length: 100 }),
|
||||
username: varchar({ length: 50 }).notNull(),
|
||||
passwordHash: varchar("password_hash", { length: 255 }).notNull(),
|
||||
}, (self) => {
|
||||
}, (table) => {
|
||||
return {
|
||||
balAccountsUsernameUnique: unique("bal_accounts_username_unique").on(table.username),
|
||||
balAccountsPasswordHashUnique: unique("bal_accounts_password_hash_unique").on(table.passwordHash),
|
||||
@@ -202,3 +202,35 @@ export const balResellers = pgTable("bal_resellers", {
|
||||
createdAt: timestamp("created_at", { mode: 'string' }).defaultNow().notNull(),
|
||||
deletedAt: timestamp("deleted_at", { mode: 'string' }),
|
||||
});
|
||||
|
||||
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: 256 }),
|
||||
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: 150 }),
|
||||
imageUrl: varchar("Image URL", { length: 150 }),
|
||||
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: 250 }),
|
||||
modelNumber: varchar("ModelNumber", { length: 50 }),
|
||||
caliber: varchar("Caliber", { length: 255 }),
|
||||
upc: varchar("UPC", { length: 75 }),
|
||||
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 }),
|
||||
});
|
||||
|
||||
10
src/pages/register.tsx
Normal file
10
src/pages/register.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
// pages/register.js
|
||||
import UserRegistration from '../components/UserRegistration';
|
||||
|
||||
export default function Register() {
|
||||
return (
|
||||
<div>
|
||||
<UserRegistration />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user