-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-auth.ts
More file actions
50 lines (44 loc) · 1.49 KB
/
debug-auth.ts
File metadata and controls
50 lines (44 loc) · 1.49 KB
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
40
41
42
43
44
45
46
47
48
49
50
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
async function main() {
try {
const email = 'test@test.com'
const password = '@1112'
console.log(`Checking for user: ${email}`)
const existingUser = await prisma.user.findUnique({
where: { email }
})
if (existingUser) {
console.log('User already exists:', existingUser)
// Check password match (plain text as per current logic)
if (existingUser.password === password) {
console.log('Password matches!')
} else {
console.log('Password does NOT match.')
console.log('Updating password...')
const updated = await prisma.user.update({
where: { email },
data: { password }
})
console.log('User password updated:', updated)
}
} else {
console.log("Creating new user...")
const user = await prisma.user.create({
data: {
name: 'Test User',
email,
password,
planType: 'FREE',
resumesGeneratedCount: 0
},
})
console.log('User created successfully:', user)
}
} catch (e) {
console.error('Error operation failed:', e)
} finally {
await prisma.$disconnect()
}
}
main()