Add login and register
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import { hash } from 'argon2';
|
||||
import { randomUUID } from 'node:crypto';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
@@ -6,6 +7,7 @@ const prisma = new PrismaClient();
|
||||
async function main() {
|
||||
await prisma.$transaction(async (tx) => {
|
||||
// region Users
|
||||
const password = await hash('12345678');
|
||||
const admin = await tx.user.upsert({
|
||||
where: { email: 'admin@mail.com' },
|
||||
update: {},
|
||||
@@ -13,6 +15,7 @@ async function main() {
|
||||
email: 'admin@mail.com',
|
||||
name: 'Admin user',
|
||||
role: 'ADMIN',
|
||||
password,
|
||||
emailConfirmedAt: new Date()
|
||||
}
|
||||
});
|
||||
@@ -23,6 +26,7 @@ async function main() {
|
||||
email: 'team@mail.com',
|
||||
name: 'Hunt member',
|
||||
role: 'ADMIN',
|
||||
password,
|
||||
emailConfirmedAt: new Date()
|
||||
}
|
||||
});
|
||||
@@ -34,6 +38,7 @@ async function main() {
|
||||
email: 'user@mail.com',
|
||||
name: 'User',
|
||||
role: 'USER',
|
||||
password,
|
||||
emailConfirmedAt: new Date()
|
||||
}
|
||||
});
|
||||
@@ -44,6 +49,7 @@ async function main() {
|
||||
email: 'member@mail.com',
|
||||
name: 'Team Member',
|
||||
role: 'USER',
|
||||
password,
|
||||
emailConfirmedAt: new Date()
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user