implemented inital nextAuth logic

This commit is contained in:
PxlLoewe
2025-01-18 23:19:16 +01:00
parent 2f8424e56c
commit 58277ba819
21 changed files with 295 additions and 172 deletions

View File

@@ -1,3 +0,0 @@
import NextAuth from 'next-auth';
export default NextAuth();

View File

@@ -0,0 +1,13 @@
import { Provider } from 'next-auth/providers/index';
import { getProviders } from 'next-auth/react';
export default async () => {
const providers = await getProviders();
console.log(providers);
return (
<div>
<h1 className="text-5xl">Login</h1>
</div>
);
};

View File

@@ -0,0 +1,12 @@
'use client';
import { SessionProvider } from 'next-auth/react';
import { Session } from 'next-auth';
export const NextAuthSessionProvider = ({
children,
session,
}: {
children: React.ReactNode;
session: Session | null;
}) => <SessionProvider session={session}>{children}</SessionProvider>;

View File

@@ -0,0 +1,53 @@
import NextAuth, { AuthOptions } from 'next-auth';
import { PrismaAdapter } from '@next-auth/prisma-adapter';
import Credentials from 'next-auth/providers/credentials';
import { prisma } from '@repo/db';
import bcrypt from 'bcryptjs';
export const options = {
providers: [
Credentials({
credentials: {
email: { label: 'Email', type: 'email', placeholder: 'E-Mail' },
password: { label: 'Password', type: 'password' },
},
async authorize(credentials, req) {
try {
if (!credentials) throw new Error('No credentials provided');
const user = await prisma.user.findFirstOrThrow({
where: { email: credentials.email },
});
if (bcrypt.compareSync(credentials.password, user.password)) {
return user;
}
return null;
} catch (error) {
return null;
}
},
}),
],
secret: process.env.SECRET,
session: {
strategy: 'jwt',
maxAge: 30 * 24 * 60 * 60,
},
adapter: PrismaAdapter(prisma),
events: {
async signIn(message) {
console.log('Signed in!', { message });
},
async signOut(message) {
console.log('Signed out!', { message });
},
async createUser(message) {
console.log('User created!', { message });
},
},
pages: {
signIn: '/login',
signOut: '/logout',
error: '/authError',
newUser: '/register',
},
} satisfies AuthOptions;

View File

@@ -0,0 +1,6 @@
import NextAuth from 'next-auth';
import { options } from './auth';
const handler = NextAuth(options);
export { handler as GET, handler as POST };

View File

@@ -1,34 +1,40 @@
import type { Metadata } from "next"; import type { Metadata } from 'next';
import { Geist, Geist_Mono } from "next/font/google"; import { Geist, Geist_Mono } from 'next/font/google';
import "./globals.css"; import './globals.css';
import { getServerSession } from 'next-auth';
import { NextAuthSessionProvider } from './_components/AuthSessionProvider';
const geistSans = Geist({ const geistSans = Geist({
variable: "--font-geist-sans", variable: '--font-geist-sans',
subsets: ["latin"], subsets: ['latin'],
}); });
const geistMono = Geist_Mono({ const geistMono = Geist_Mono({
variable: "--font-geist-mono", variable: '--font-geist-mono',
subsets: ["latin"], subsets: ['latin'],
}); });
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Create Next App", title: 'Create Next App',
description: "Generated by create next app", description: 'Generated by create next app',
}; };
export default function RootLayout({ export default async function RootLayout({
children, children,
}: Readonly<{ }: Readonly<{
children: React.ReactNode; children: React.ReactNode;
}>) { }>) {
const session = await getServerSession();
return ( return (
<html lang="en"> <html lang="en">
<body <NextAuthSessionProvider session={session}>
className={`${geistSans.variable} ${geistMono.variable} antialiased`} <body
> className={`${geistSans.variable} ${geistMono.variable} antialiased`}
{children} >
</body> {children}
</body>
</NextAuthSessionProvider>
</html> </html>
); );
} }

View File

@@ -1,4 +1,10 @@
'use client';
import { useSession } from 'next-auth/react';
export default function Home() { export default function Home() {
const { data: session, status } = useSession();
console.log(session, status);
return ( return (
<div> <div>
<h1 className="text-5xl">Hub</h1> <h1 className="text-5xl">Hub</h1>

View File

@@ -1,15 +0,0 @@
import { AuthOptions } from 'next-auth';
import { PrismaAdapter } from '@next-auth/prisma-adapter';
import Email from 'next-auth/providers/email';
import { prisma } from '@repo/db';
export const options = {
providers: [
Email({
server: process.env.EMAIL_SERVER,
from: process.env.EMAIL_FROM,
}),
],
secret: process.env.SECRET,
adapter: PrismaAdapter(prisma),
} satisfies AuthOptions;

View File

@@ -11,6 +11,7 @@
"dependencies": { "dependencies": {
"@next-auth/prisma-adapter": "^1.0.7", "@next-auth/prisma-adapter": "^1.0.7",
"@repo/ui": "*", "@repo/ui": "*",
"bcryptjs": "^2.4.3",
"next": "15.1.4", "next": "15.1.4",
"next-auth": "^4.24.11", "next-auth": "^4.24.11",
"react": "^19.0.0", "react": "^19.0.0",
@@ -18,6 +19,7 @@
}, },
"devDependencies": { "devDependencies": {
"@eslint/eslintrc": "^3", "@eslint/eslintrc": "^3",
"@types/bcryptjs": "^2.4.6",
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^19", "@types/react": "^19",
"@types/react-dom": "^19", "@types/react-dom": "^19",

13
package-lock.json generated
View File

@@ -40,6 +40,7 @@
"dependencies": { "dependencies": {
"@next-auth/prisma-adapter": "^1.0.7", "@next-auth/prisma-adapter": "^1.0.7",
"@repo/ui": "*", "@repo/ui": "*",
"bcryptjs": "^2.4.3",
"next": "15.1.4", "next": "15.1.4",
"next-auth": "^4.24.11", "next-auth": "^4.24.11",
"react": "^19.0.0", "react": "^19.0.0",
@@ -47,6 +48,7 @@
}, },
"devDependencies": { "devDependencies": {
"@eslint/eslintrc": "^3", "@eslint/eslintrc": "^3",
"@types/bcryptjs": "^2.4.6",
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^19", "@types/react": "^19",
"@types/react-dom": "^19", "@types/react-dom": "^19",
@@ -1219,6 +1221,12 @@
"workspaces": "dist/cli.js" "workspaces": "dist/cli.js"
} }
}, },
"node_modules/@types/bcryptjs": {
"version": "2.4.6",
"resolved": "https://registry.npmjs.org/@types/bcryptjs/-/bcryptjs-2.4.6.tgz",
"integrity": "sha512-9xlo6R2qDs5uixm0bcIqCeMCE6HiQsIyel9KQySStiyqNl2tnj2mP3DX1Nf56MD6KMenNNlBBsy3LJ7gUEQPXQ==",
"dev": true
},
"node_modules/@types/estree": { "node_modules/@types/estree": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
@@ -1921,6 +1929,11 @@
"node": ">=10.0.0" "node": ">=10.0.0"
} }
}, },
"node_modules/bcryptjs": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz",
"integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ=="
},
"node_modules/binary-extensions": { "node_modules/binary-extensions": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",

File diff suppressed because one or more lines are too long

View File

@@ -143,8 +143,10 @@ exports.Prisma.SessionScalarFieldEnum = {
exports.Prisma.UserScalarFieldEnum = { exports.Prisma.UserScalarFieldEnum = {
id: 'id', id: 'id',
name: 'name', firstname: 'firstname',
lastname: 'lastname',
email: 'email', email: 'email',
password: 'password',
emailVerified: 'emailVerified', emailVerified: 'emailVerified',
image: 'image', image: 'image',
createdAt: 'createdAt', createdAt: 'createdAt',

View File

@@ -3291,24 +3291,16 @@ export namespace Prisma {
export type AggregateUser = { export type AggregateUser = {
_count: UserCountAggregateOutputType | null _count: UserCountAggregateOutputType | null
_avg: UserAvgAggregateOutputType | null
_sum: UserSumAggregateOutputType | null
_min: UserMinAggregateOutputType | null _min: UserMinAggregateOutputType | null
_max: UserMaxAggregateOutputType | null _max: UserMaxAggregateOutputType | null
} }
export type UserAvgAggregateOutputType = {
id: number | null
}
export type UserSumAggregateOutputType = {
id: number | null
}
export type UserMinAggregateOutputType = { export type UserMinAggregateOutputType = {
id: number | null id: string | null
name: string | null firstname: string | null
lastname: string | null
email: string | null email: string | null
password: string | null
emailVerified: Date | null emailVerified: Date | null
image: string | null image: string | null
createdAt: Date | null createdAt: Date | null
@@ -3316,9 +3308,11 @@ export namespace Prisma {
} }
export type UserMaxAggregateOutputType = { export type UserMaxAggregateOutputType = {
id: number | null id: string | null
name: string | null firstname: string | null
lastname: string | null
email: string | null email: string | null
password: string | null
emailVerified: Date | null emailVerified: Date | null
image: string | null image: string | null
createdAt: Date | null createdAt: Date | null
@@ -3327,8 +3321,10 @@ export namespace Prisma {
export type UserCountAggregateOutputType = { export type UserCountAggregateOutputType = {
id: number id: number
name: number firstname: number
lastname: number
email: number email: number
password: number
emailVerified: number emailVerified: number
image: number image: number
createdAt: number createdAt: number
@@ -3337,18 +3333,12 @@ export namespace Prisma {
} }
export type UserAvgAggregateInputType = {
id?: true
}
export type UserSumAggregateInputType = {
id?: true
}
export type UserMinAggregateInputType = { export type UserMinAggregateInputType = {
id?: true id?: true
name?: true firstname?: true
lastname?: true
email?: true email?: true
password?: true
emailVerified?: true emailVerified?: true
image?: true image?: true
createdAt?: true createdAt?: true
@@ -3357,8 +3347,10 @@ export namespace Prisma {
export type UserMaxAggregateInputType = { export type UserMaxAggregateInputType = {
id?: true id?: true
name?: true firstname?: true
lastname?: true
email?: true email?: true
password?: true
emailVerified?: true emailVerified?: true
image?: true image?: true
createdAt?: true createdAt?: true
@@ -3367,8 +3359,10 @@ export namespace Prisma {
export type UserCountAggregateInputType = { export type UserCountAggregateInputType = {
id?: true id?: true
name?: true firstname?: true
lastname?: true
email?: true email?: true
password?: true
emailVerified?: true emailVerified?: true
image?: true image?: true
createdAt?: true createdAt?: true
@@ -3411,18 +3405,6 @@ export namespace Prisma {
* Count returned Users * Count returned Users
**/ **/
_count?: true | UserCountAggregateInputType _count?: true | UserCountAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to average
**/
_avg?: UserAvgAggregateInputType
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
*
* Select which fields to sum
**/
_sum?: UserSumAggregateInputType
/** /**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
* *
@@ -3456,23 +3438,21 @@ export namespace Prisma {
take?: number take?: number
skip?: number skip?: number
_count?: UserCountAggregateInputType | true _count?: UserCountAggregateInputType | true
_avg?: UserAvgAggregateInputType
_sum?: UserSumAggregateInputType
_min?: UserMinAggregateInputType _min?: UserMinAggregateInputType
_max?: UserMaxAggregateInputType _max?: UserMaxAggregateInputType
} }
export type UserGroupByOutputType = { export type UserGroupByOutputType = {
id: number id: string
name: string | null firstname: string
email: string | null lastname: string
email: string
password: string
emailVerified: Date | null emailVerified: Date | null
image: string | null image: string | null
createdAt: Date createdAt: Date
updatedAt: Date updatedAt: Date
_count: UserCountAggregateOutputType | null _count: UserCountAggregateOutputType | null
_avg: UserAvgAggregateOutputType | null
_sum: UserSumAggregateOutputType | null
_min: UserMinAggregateOutputType | null _min: UserMinAggregateOutputType | null
_max: UserMaxAggregateOutputType | null _max: UserMaxAggregateOutputType | null
} }
@@ -3493,8 +3473,10 @@ export namespace Prisma {
export type UserSelect<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetSelect<{ export type UserSelect<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetSelect<{
id?: boolean id?: boolean
name?: boolean firstname?: boolean
lastname?: boolean
email?: boolean email?: boolean
password?: boolean
emailVerified?: boolean emailVerified?: boolean
image?: boolean image?: boolean
createdAt?: boolean createdAt?: boolean
@@ -3503,8 +3485,10 @@ export namespace Prisma {
export type UserSelectCreateManyAndReturn<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetSelect<{ export type UserSelectCreateManyAndReturn<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetSelect<{
id?: boolean id?: boolean
name?: boolean firstname?: boolean
lastname?: boolean
email?: boolean email?: boolean
password?: boolean
emailVerified?: boolean emailVerified?: boolean
image?: boolean image?: boolean
createdAt?: boolean createdAt?: boolean
@@ -3513,8 +3497,10 @@ export namespace Prisma {
export type UserSelectUpdateManyAndReturn<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetSelect<{ export type UserSelectUpdateManyAndReturn<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetSelect<{
id?: boolean id?: boolean
name?: boolean firstname?: boolean
lastname?: boolean
email?: boolean email?: boolean
password?: boolean
emailVerified?: boolean emailVerified?: boolean
image?: boolean image?: boolean
createdAt?: boolean createdAt?: boolean
@@ -3523,23 +3509,27 @@ export namespace Prisma {
export type UserSelectScalar = { export type UserSelectScalar = {
id?: boolean id?: boolean
name?: boolean firstname?: boolean
lastname?: boolean
email?: boolean email?: boolean
password?: boolean
emailVerified?: boolean emailVerified?: boolean
image?: boolean image?: boolean
createdAt?: boolean createdAt?: boolean
updatedAt?: boolean updatedAt?: boolean
} }
export type UserOmit<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetOmit<"id" | "name" | "email" | "emailVerified" | "image" | "createdAt" | "updatedAt", ExtArgs["result"]["user"]> export type UserOmit<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetOmit<"id" | "firstname" | "lastname" | "email" | "password" | "emailVerified" | "image" | "createdAt" | "updatedAt", ExtArgs["result"]["user"]>
export type $UserPayload<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = { export type $UserPayload<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = {
name: "User" name: "User"
objects: {} objects: {}
scalars: $Extensions.GetPayloadResult<{ scalars: $Extensions.GetPayloadResult<{
id: number id: string
name: string | null firstname: string
email: string | null lastname: string
email: string
password: string
emailVerified: Date | null emailVerified: Date | null
image: string | null image: string | null
createdAt: Date createdAt: Date
@@ -3967,9 +3957,11 @@ export namespace Prisma {
* Fields of the User model * Fields of the User model
*/ */
interface UserFieldRefs { interface UserFieldRefs {
readonly id: FieldRef<"User", 'Int'> readonly id: FieldRef<"User", 'String'>
readonly name: FieldRef<"User", 'String'> readonly firstname: FieldRef<"User", 'String'>
readonly lastname: FieldRef<"User", 'String'>
readonly email: FieldRef<"User", 'String'> readonly email: FieldRef<"User", 'String'>
readonly password: FieldRef<"User", 'String'>
readonly emailVerified: FieldRef<"User", 'DateTime'> readonly emailVerified: FieldRef<"User", 'DateTime'>
readonly image: FieldRef<"User", 'String'> readonly image: FieldRef<"User", 'String'>
readonly createdAt: FieldRef<"User", 'DateTime'> readonly createdAt: FieldRef<"User", 'DateTime'>
@@ -4168,7 +4160,7 @@ export namespace Prisma {
/** /**
* The data needed to create a User. * The data needed to create a User.
*/ */
data?: XOR<UserCreateInput, UserUncheckedCreateInput> data: XOR<UserCreateInput, UserUncheckedCreateInput>
} }
/** /**
@@ -5404,8 +5396,10 @@ export namespace Prisma {
export const UserScalarFieldEnum: { export const UserScalarFieldEnum: {
id: 'id', id: 'id',
name: 'name', firstname: 'firstname',
lastname: 'lastname',
email: 'email', email: 'email',
password: 'password',
emailVerified: 'emailVerified', emailVerified: 'emailVerified',
image: 'image', image: 'image',
createdAt: 'createdAt', createdAt: 'createdAt',
@@ -5667,9 +5661,11 @@ export namespace Prisma {
AND?: UserWhereInput | UserWhereInput[] AND?: UserWhereInput | UserWhereInput[]
OR?: UserWhereInput[] OR?: UserWhereInput[]
NOT?: UserWhereInput | UserWhereInput[] NOT?: UserWhereInput | UserWhereInput[]
id?: IntFilter<"User"> | number id?: StringFilter<"User"> | string
name?: StringNullableFilter<"User"> | string | null firstname?: StringFilter<"User"> | string
email?: StringNullableFilter<"User"> | string | null lastname?: StringFilter<"User"> | string
email?: StringFilter<"User"> | string
password?: StringFilter<"User"> | string
emailVerified?: DateTimeNullableFilter<"User"> | Date | string | null emailVerified?: DateTimeNullableFilter<"User"> | Date | string | null
image?: StringNullableFilter<"User"> | string | null image?: StringNullableFilter<"User"> | string | null
createdAt?: DateTimeFilter<"User"> | Date | string createdAt?: DateTimeFilter<"User"> | Date | string
@@ -5678,8 +5674,10 @@ export namespace Prisma {
export type UserOrderByWithRelationInput = { export type UserOrderByWithRelationInput = {
id?: SortOrder id?: SortOrder
name?: SortOrderInput | SortOrder firstname?: SortOrder
email?: SortOrderInput | SortOrder lastname?: SortOrder
email?: SortOrder
password?: SortOrder
emailVerified?: SortOrderInput | SortOrder emailVerified?: SortOrderInput | SortOrder
image?: SortOrderInput | SortOrder image?: SortOrderInput | SortOrder
createdAt?: SortOrder createdAt?: SortOrder
@@ -5687,12 +5685,14 @@ export namespace Prisma {
} }
export type UserWhereUniqueInput = Prisma.AtLeast<{ export type UserWhereUniqueInput = Prisma.AtLeast<{
id?: number id?: string
email?: string email?: string
AND?: UserWhereInput | UserWhereInput[] AND?: UserWhereInput | UserWhereInput[]
OR?: UserWhereInput[] OR?: UserWhereInput[]
NOT?: UserWhereInput | UserWhereInput[] NOT?: UserWhereInput | UserWhereInput[]
name?: StringNullableFilter<"User"> | string | null firstname?: StringFilter<"User"> | string
lastname?: StringFilter<"User"> | string
password?: StringFilter<"User"> | string
emailVerified?: DateTimeNullableFilter<"User"> | Date | string | null emailVerified?: DateTimeNullableFilter<"User"> | Date | string | null
image?: StringNullableFilter<"User"> | string | null image?: StringNullableFilter<"User"> | string | null
createdAt?: DateTimeFilter<"User"> | Date | string createdAt?: DateTimeFilter<"User"> | Date | string
@@ -5701,26 +5701,28 @@ export namespace Prisma {
export type UserOrderByWithAggregationInput = { export type UserOrderByWithAggregationInput = {
id?: SortOrder id?: SortOrder
name?: SortOrderInput | SortOrder firstname?: SortOrder
email?: SortOrderInput | SortOrder lastname?: SortOrder
email?: SortOrder
password?: SortOrder
emailVerified?: SortOrderInput | SortOrder emailVerified?: SortOrderInput | SortOrder
image?: SortOrderInput | SortOrder image?: SortOrderInput | SortOrder
createdAt?: SortOrder createdAt?: SortOrder
updatedAt?: SortOrder updatedAt?: SortOrder
_count?: UserCountOrderByAggregateInput _count?: UserCountOrderByAggregateInput
_avg?: UserAvgOrderByAggregateInput
_max?: UserMaxOrderByAggregateInput _max?: UserMaxOrderByAggregateInput
_min?: UserMinOrderByAggregateInput _min?: UserMinOrderByAggregateInput
_sum?: UserSumOrderByAggregateInput
} }
export type UserScalarWhereWithAggregatesInput = { export type UserScalarWhereWithAggregatesInput = {
AND?: UserScalarWhereWithAggregatesInput | UserScalarWhereWithAggregatesInput[] AND?: UserScalarWhereWithAggregatesInput | UserScalarWhereWithAggregatesInput[]
OR?: UserScalarWhereWithAggregatesInput[] OR?: UserScalarWhereWithAggregatesInput[]
NOT?: UserScalarWhereWithAggregatesInput | UserScalarWhereWithAggregatesInput[] NOT?: UserScalarWhereWithAggregatesInput | UserScalarWhereWithAggregatesInput[]
id?: IntWithAggregatesFilter<"User"> | number id?: StringWithAggregatesFilter<"User"> | string
name?: StringNullableWithAggregatesFilter<"User"> | string | null firstname?: StringWithAggregatesFilter<"User"> | string
email?: StringNullableWithAggregatesFilter<"User"> | string | null lastname?: StringWithAggregatesFilter<"User"> | string
email?: StringWithAggregatesFilter<"User"> | string
password?: StringWithAggregatesFilter<"User"> | string
emailVerified?: DateTimeNullableWithAggregatesFilter<"User"> | Date | string | null emailVerified?: DateTimeNullableWithAggregatesFilter<"User"> | Date | string | null
image?: StringNullableWithAggregatesFilter<"User"> | string | null image?: StringNullableWithAggregatesFilter<"User"> | string | null
createdAt?: DateTimeWithAggregatesFilter<"User"> | Date | string createdAt?: DateTimeWithAggregatesFilter<"User"> | Date | string
@@ -5949,8 +5951,11 @@ export namespace Prisma {
} }
export type UserCreateInput = { export type UserCreateInput = {
name?: string | null id?: string
email?: string | null firstname: string
lastname: string
email: string
password: string
emailVerified?: Date | string | null emailVerified?: Date | string | null
image?: string | null image?: string | null
createdAt?: Date | string createdAt?: Date | string
@@ -5958,9 +5963,11 @@ export namespace Prisma {
} }
export type UserUncheckedCreateInput = { export type UserUncheckedCreateInput = {
id?: number id?: string
name?: string | null firstname: string
email?: string | null lastname: string
email: string
password: string
emailVerified?: Date | string | null emailVerified?: Date | string | null
image?: string | null image?: string | null
createdAt?: Date | string createdAt?: Date | string
@@ -5968,8 +5975,11 @@ export namespace Prisma {
} }
export type UserUpdateInput = { export type UserUpdateInput = {
name?: NullableStringFieldUpdateOperationsInput | string | null id?: StringFieldUpdateOperationsInput | string
email?: NullableStringFieldUpdateOperationsInput | string | null firstname?: StringFieldUpdateOperationsInput | string
lastname?: StringFieldUpdateOperationsInput | string
email?: StringFieldUpdateOperationsInput | string
password?: StringFieldUpdateOperationsInput | string
emailVerified?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null emailVerified?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null
image?: NullableStringFieldUpdateOperationsInput | string | null image?: NullableStringFieldUpdateOperationsInput | string | null
createdAt?: DateTimeFieldUpdateOperationsInput | Date | string createdAt?: DateTimeFieldUpdateOperationsInput | Date | string
@@ -5977,9 +5987,11 @@ export namespace Prisma {
} }
export type UserUncheckedUpdateInput = { export type UserUncheckedUpdateInput = {
id?: IntFieldUpdateOperationsInput | number id?: StringFieldUpdateOperationsInput | string
name?: NullableStringFieldUpdateOperationsInput | string | null firstname?: StringFieldUpdateOperationsInput | string
email?: NullableStringFieldUpdateOperationsInput | string | null lastname?: StringFieldUpdateOperationsInput | string
email?: StringFieldUpdateOperationsInput | string
password?: StringFieldUpdateOperationsInput | string
emailVerified?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null emailVerified?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null
image?: NullableStringFieldUpdateOperationsInput | string | null image?: NullableStringFieldUpdateOperationsInput | string | null
createdAt?: DateTimeFieldUpdateOperationsInput | Date | string createdAt?: DateTimeFieldUpdateOperationsInput | Date | string
@@ -5987,9 +5999,11 @@ export namespace Prisma {
} }
export type UserCreateManyInput = { export type UserCreateManyInput = {
id?: number id?: string
name?: string | null firstname: string
email?: string | null lastname: string
email: string
password: string
emailVerified?: Date | string | null emailVerified?: Date | string | null
image?: string | null image?: string | null
createdAt?: Date | string createdAt?: Date | string
@@ -5997,8 +6011,11 @@ export namespace Prisma {
} }
export type UserUpdateManyMutationInput = { export type UserUpdateManyMutationInput = {
name?: NullableStringFieldUpdateOperationsInput | string | null id?: StringFieldUpdateOperationsInput | string
email?: NullableStringFieldUpdateOperationsInput | string | null firstname?: StringFieldUpdateOperationsInput | string
lastname?: StringFieldUpdateOperationsInput | string
email?: StringFieldUpdateOperationsInput | string
password?: StringFieldUpdateOperationsInput | string
emailVerified?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null emailVerified?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null
image?: NullableStringFieldUpdateOperationsInput | string | null image?: NullableStringFieldUpdateOperationsInput | string | null
createdAt?: DateTimeFieldUpdateOperationsInput | Date | string createdAt?: DateTimeFieldUpdateOperationsInput | Date | string
@@ -6006,9 +6023,11 @@ export namespace Prisma {
} }
export type UserUncheckedUpdateManyInput = { export type UserUncheckedUpdateManyInput = {
id?: IntFieldUpdateOperationsInput | number id?: StringFieldUpdateOperationsInput | string
name?: NullableStringFieldUpdateOperationsInput | string | null firstname?: StringFieldUpdateOperationsInput | string
email?: NullableStringFieldUpdateOperationsInput | string | null lastname?: StringFieldUpdateOperationsInput | string
email?: StringFieldUpdateOperationsInput | string
password?: StringFieldUpdateOperationsInput | string
emailVerified?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null emailVerified?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null
image?: NullableStringFieldUpdateOperationsInput | string | null image?: NullableStringFieldUpdateOperationsInput | string | null
createdAt?: DateTimeFieldUpdateOperationsInput | Date | string createdAt?: DateTimeFieldUpdateOperationsInput | Date | string
@@ -6317,22 +6336,22 @@ export namespace Prisma {
export type UserCountOrderByAggregateInput = { export type UserCountOrderByAggregateInput = {
id?: SortOrder id?: SortOrder
name?: SortOrder firstname?: SortOrder
lastname?: SortOrder
email?: SortOrder email?: SortOrder
password?: SortOrder
emailVerified?: SortOrder emailVerified?: SortOrder
image?: SortOrder image?: SortOrder
createdAt?: SortOrder createdAt?: SortOrder
updatedAt?: SortOrder updatedAt?: SortOrder
} }
export type UserAvgOrderByAggregateInput = {
id?: SortOrder
}
export type UserMaxOrderByAggregateInput = { export type UserMaxOrderByAggregateInput = {
id?: SortOrder id?: SortOrder
name?: SortOrder firstname?: SortOrder
lastname?: SortOrder
email?: SortOrder email?: SortOrder
password?: SortOrder
emailVerified?: SortOrder emailVerified?: SortOrder
image?: SortOrder image?: SortOrder
createdAt?: SortOrder createdAt?: SortOrder
@@ -6341,18 +6360,16 @@ export namespace Prisma {
export type UserMinOrderByAggregateInput = { export type UserMinOrderByAggregateInput = {
id?: SortOrder id?: SortOrder
name?: SortOrder firstname?: SortOrder
lastname?: SortOrder
email?: SortOrder email?: SortOrder
password?: SortOrder
emailVerified?: SortOrder emailVerified?: SortOrder
image?: SortOrder image?: SortOrder
createdAt?: SortOrder createdAt?: SortOrder
updatedAt?: SortOrder updatedAt?: SortOrder
} }
export type UserSumOrderByAggregateInput = {
id?: SortOrder
}
export type VerificationRequestCountOrderByAggregateInput = { export type VerificationRequestCountOrderByAggregateInput = {
id?: SortOrder id?: SortOrder
identifier?: SortOrder identifier?: SortOrder

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
{ {
"name": "prisma-client-9c17f8cb04532af79797432ff37d662dfecbed92d0f99ae2e0477ea71381eed4", "name": "prisma-client-c7fdd0dfe7b541db0276548838969aa318b26f0ac7912a69d0a6f15415695df6",
"main": "index.js", "main": "index.js",
"types": "index.d.ts", "types": "index.d.ts",
"browser": "index-browser.js", "browser": "index-browser.js",

View File

@@ -46,9 +46,11 @@ model Session {
} }
model User { model User {
id Int @id @default(autoincrement()) id String @id @default(uuid())
name String? firstname String
email String? @unique lastname String
email String @unique
password String
emailVerified DateTime? @map(name: "email_verified") emailVerified DateTime? @map(name: "email_verified")
image String? image String?
createdAt DateTime @default(now()) @map(name: "created_at") createdAt DateTime @default(now()) @map(name: "created_at")

View File

@@ -143,8 +143,10 @@ exports.Prisma.SessionScalarFieldEnum = {
exports.Prisma.UserScalarFieldEnum = { exports.Prisma.UserScalarFieldEnum = {
id: 'id', id: 'id',
name: 'name', firstname: 'firstname',
lastname: 'lastname',
email: 'email', email: 'email',
password: 'password',
emailVerified: 'emailVerified', emailVerified: 'emailVerified',
image: 'image', image: 'image',
createdAt: 'createdAt', createdAt: 'createdAt',

View File

@@ -9,7 +9,7 @@
"db:deploy": "npx prisma migrate deploy" "db:deploy": "npx prisma migrate deploy"
}, },
"exports": { "exports": {
".": "./src/index.ts" ".": "./index.ts"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",

View File

@@ -46,9 +46,11 @@ model Session {
} }
model User { model User {
id Int @id @default(autoincrement()) id String @id @default(uuid())
name String? firstname String
email String? @unique lastname String
email String @unique
password String
emailVerified DateTime? @map(name: "email_verified") emailVerified DateTime? @map(name: "email_verified")
image String? image String?
createdAt DateTime @default(now()) @map(name: "created_at") createdAt DateTime @default(now()) @map(name: "created_at")

View File

@@ -1,8 +1,8 @@
import js from "@eslint/js"; import js from '@eslint/js';
import eslintConfigPrettier from "eslint-config-prettier"; import eslintConfigPrettier from 'eslint-config-prettier';
import turboPlugin from "eslint-plugin-turbo"; import turboPlugin from 'eslint-plugin-turbo';
import tseslint from "typescript-eslint"; import tseslint from 'typescript-eslint';
import onlyWarn from "eslint-plugin-only-warn"; import onlyWarn from 'eslint-plugin-only-warn';
/** /**
* A shared ESLint configuration for the repository. * A shared ESLint configuration for the repository.
@@ -18,7 +18,7 @@ export const config = [
turbo: turboPlugin, turbo: turboPlugin,
}, },
rules: { rules: {
"turbo/no-undeclared-env-vars": "warn", 'turbo/no-undeclared-env-vars': ['error', { allowList: true }],
}, },
}, },
{ {
@@ -27,6 +27,6 @@ export const config = [
}, },
}, },
{ {
ignores: ["dist/**"], ignores: ['dist/**'],
}, },
]; ];

View File

@@ -1,9 +1,19 @@
{ {
"$schema": "https://turbo.build/schema.json", "$schema": "https://turbo.build/schema.json",
"globalDependencies": ["**/.env.*local"],
"globalEnv": ["EMAIL_SERVER", "EMAIL_FROM", "SECRET"],
"ui": "tui", "ui": "tui",
"tasks": { "tasks": {
"db:generate": {
"cache": false,
"persistent": true
},
"db:migrate": {
"cache": false,
"persistent": true
},
"build": { "build": {
"dependsOn": ["^build"], "dependsOn": ["^build", "db:generate", "db:migrate"],
"inputs": ["$TURBO_DEFAULT$", ".env*"], "inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": [".next/**", "!.next/cache/**"] "outputs": [".next/**", "!.next/cache/**"]
}, },
@@ -14,19 +24,10 @@
"dependsOn": ["^check-types"] "dependsOn": ["^check-types"]
}, },
"dev": { "dev": {
"dependsOn": ["^db:generate"],
"cache": false, "cache": false,
"persistent": true "persistent": true
},
"db:generate": {
"cache": false,
"persistent": true
},
"db:migrate": {
"cache": false,
"persistent": true
},
"db:deploy": {
"cache": false
} }
} }
} }