Added Auth

This commit is contained in:
2025-12-22 10:47:15 +07:00
parent 2c244b77fb
commit fa029365d0
79 changed files with 19643 additions and 2830 deletions

View File

@@ -1,6 +1,6 @@
import { PrismaClient } from '../src/generated/prisma/client.js'
import { PrismaPg } from '@prisma/adapter-pg'
import { PrismaClient } from '../src/generated/prisma/client.js'
import { auth } from '@/lib/auth'
const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL!,
@@ -11,19 +11,29 @@ const prisma = new PrismaClient({ adapter })
async function main() {
console.log('🌱 Seeding database...')
// Clear existing todos
await prisma.todo.deleteMany()
// Create example todos
const todos = await prisma.todo.createMany({
data: [
{ title: 'Buy groceries' },
{ title: 'Read a book' },
{ title: 'Workout' },
],
// add admin user
await auth.api.createUser({
body: {
email: 'luu.dat.tham@gmail.com',
password: 'Th@m!S@m!040390',
name: 'Sam',
role: 'admin',
},
})
console.log(` Created ${todos.count} todos`)
// // Clear existing todos
// await prisma.todo.deleteMany()
// // Create example todos
// const todos = await prisma.todo.createMany({
// data: [
// { title: 'Buy groceries' },
// { title: 'Read a book' },
// { title: 'Workout' },
// ],
// })
// console.log(`✅ Created ${todos.count} todos`)
}
main()