updated route and schema
This commit is contained in:
parent
e160eb676c
commit
d15ff5b03e
@ -27,6 +27,7 @@ export async function POST(request: Request) {
|
|||||||
// console.log({message:'hash is', hashedPassword})
|
// console.log({message:'hash is', hashedPassword})
|
||||||
|
|
||||||
const response = await db.insert(users).values({
|
const response = await db.insert(users).values({
|
||||||
|
id: '1',
|
||||||
email: email,
|
email: email,
|
||||||
password: hashedPassword,
|
password: hashedPassword,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import {
|
|||||||
|
|
||||||
export const users = mysqlTable("users", {
|
export const users = mysqlTable("users", {
|
||||||
// id: int("id").primaryKey().autoincrement(),
|
// id: int("id").primaryKey().autoincrement(),
|
||||||
|
// id must be a varchar in order to use it with next auth
|
||||||
id: varchar("id", { length: 255 }).notNull().primaryKey(),
|
id: varchar("id", { length: 255 }).notNull().primaryKey(),
|
||||||
email: varchar("email", { length: 256 }).notNull(),
|
email: varchar("email", { length: 256 }).notNull(),
|
||||||
password: varchar("password", { length: 256 }).notNull(),
|
password: varchar("password", { length: 256 }).notNull(),
|
||||||
@ -25,67 +26,3 @@ export const users = mysqlTable("users", {
|
|||||||
// itemName: varchar("item_name", { length: 256 }),
|
// itemName: varchar("item_name", { length: 256 }),
|
||||||
// itemDescription: varchar("item_description", { length: 256 }),
|
// itemDescription: varchar("item_description", { length: 256 }),
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// import {
|
|
||||||
// int,
|
|
||||||
// timestamp,
|
|
||||||
// mysqlTable,
|
|
||||||
// primaryKey,
|
|
||||||
// varchar,
|
|
||||||
// } from "drizzle-orm/mysql-core";
|
|
||||||
// import type { AdapterAccount } from "@auth/core/adapters";
|
|
||||||
|
|
||||||
// export const users = mysqlTable("user", {
|
|
||||||
// id: varchar("id", { length: 255 }).notNull().primaryKey(),
|
|
||||||
// name: varchar("name", { length: 255 }),
|
|
||||||
// email: varchar("email", { length: 255 }).notNull(),
|
|
||||||
// emailVerified: timestamp("emailVerified", {
|
|
||||||
// mode: "date",
|
|
||||||
// fsp: 3,
|
|
||||||
// }).defaultNow(),
|
|
||||||
// image: varchar("image", { length: 255 }),
|
|
||||||
// });
|
|
||||||
|
|
||||||
// export const accounts = mysqlTable(
|
|
||||||
// "account",
|
|
||||||
// {
|
|
||||||
// userId: varchar("userId", { length: 255 })
|
|
||||||
// .notNull()
|
|
||||||
// .references(() => users.id, { onDelete: "cascade" }),
|
|
||||||
// type: varchar("type", { length: 255 })
|
|
||||||
// .$type<AdapterAccount["type"]>()
|
|
||||||
// .notNull(),
|
|
||||||
// provider: varchar("provider", { length: 255 }).notNull(),
|
|
||||||
// providerAccountId: varchar("providerAccountId", { length: 255 }).notNull(),
|
|
||||||
// refresh_token: varchar("refresh_token", { length: 255 }),
|
|
||||||
// access_token: varchar("access_token", { length: 255 }),
|
|
||||||
// expires_at: int("expires_at"),
|
|
||||||
// token_type: varchar("token_type", { length: 255 }),
|
|
||||||
// scope: varchar("scope", { length: 255 }),
|
|
||||||
// id_token: varchar("id_token", { length: 2048 }),
|
|
||||||
// session_state: varchar("session_state", { length: 255 }),
|
|
||||||
// },
|
|
||||||
// (account) => ({
|
|
||||||
// compoundKey: primaryKey(account.provider, account.providerAccountId),
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
|
|
||||||
// export const sessions = mysqlTable("session", {
|
|
||||||
// sessionToken: varchar("sessionToken", { length: 255 }).notNull().primaryKey(),
|
|
||||||
// userId: varchar("userId", { length: 255 })
|
|
||||||
// .notNull()
|
|
||||||
// .references(() => users.id, { onDelete: "cascade" }),
|
|
||||||
// expires: timestamp("expires", { mode: "date" }).notNull(),
|
|
||||||
// });
|
|
||||||
|
|
||||||
// export const verificationTokens = mysqlTable(
|
|
||||||
// "verificationToken",
|
|
||||||
// {
|
|
||||||
// identifier: varchar("identifier", { length: 255 }).notNull(),
|
|
||||||
// token: varchar("token", { length: 255 }).notNull(),
|
|
||||||
// expires: timestamp("expires", { mode: "date" }).notNull(),
|
|
||||||
// },
|
|
||||||
// (vt) => ({
|
|
||||||
// compoundKey: primaryKey(vt.identifier, vt.token),
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user