Added Auth
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user