-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.ts
39 lines (35 loc) · 856 Bytes
/
script.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { PrismaClient } from '@prisma/client'
import { compareSync } from 'bcrypt'
const prisma = new PrismaClient()
// const saltRounds = 10
// const users = [
// {
// email: '[email protected]',
// password: hashSync('alicePWD', saltRounds),
// },
// {
// email: '[email protected]',
// password: hashSync('bobPWD', saltRounds),
// },
// ]
// A `main` function so that you can use async/await
async function main() {
const bob = await prisma.user.findUnique({
where: {
email: '[email protected]'
}
})
// use `console.dir` to print nested objects
console.dir(bob, { depth: null })
if (bob) {
const passwordCheck = compareSync('bobPWD', bob.password)
console.dir({ passwordCheck }, { depth: null })
}
}
main()
.catch(e => {
throw e
})
.finally(async () => {
await prisma.$disconnect()
})