-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
86 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import prismadb from '@/lib/prismadb'; | ||
|
||
export async function getUserByEmail(email: string) { | ||
try { | ||
const user = await prismadb.user.findUnique({ | ||
where: { | ||
} | ||
}); | ||
|
||
return user; | ||
} catch { | ||
return null; | ||
} | ||
} | ||
|
||
export async function getUserById(id: string) { | ||
try { | ||
const user = await prismadb.user.findUnique({ | ||
where: { | ||
id | ||
} | ||
}); | ||
|
||
return user; | ||
} catch { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as z from 'zod'; | ||
|
||
export const LoginSchema = z.object({ | ||
email: z.string().email({ message: 'Please enter valid email address.' }), | ||
password: z.string().min(1, { message: 'Please enter password.' }), | ||
code: z.optional(z.string()) | ||
}); | ||
|
||
export const RegisterSchema = z | ||
.object({ | ||
name: z.string().min(1, { message: 'Please enter name.' }), | ||
email: z.string().email({ message: 'Please enter valid email address.' }), | ||
password: z | ||
.string() | ||
.min(8, { message: 'Please enter at least 8 characters.' }), | ||
confirm: z | ||
.string() | ||
.min(8, { message: 'Please enter at least 8 characters.' }) | ||
}) | ||
.refine((data) => data.password === data.confirm, { | ||
message: 'Passwords does not match.', | ||
path: ['confirm'] | ||
}); |