Add login and register

This commit is contained in:
2025-08-04 20:23:19 +02:00
parent 8aa8be7e9f
commit 9320adb6cd
11 changed files with 524 additions and 21 deletions
+6
View File
@@ -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()
}
});