geraete/prisma/create-test-user.ts
2025-11-14 11:28:24 +01:00

42 lines
883 B
TypeScript

// prisma/create-test-user.ts
import { PrismaClient } from '@prisma/client';
import { hash } from 'bcryptjs';
const prisma = new PrismaClient();
async function main() {
const email = 'christoph.rother@polizei.nrw.de';
const username = 'admin';
const password = 'tegvideo7010!';
const passwordHash = await hash(password, 10);
const user = await prisma.user.upsert({
where: { email },
update: {
username,
passwordHash,
},
create: {
email,
username,
name: 'Test User',
passwordHash,
},
});
console.log('Test-User angelegt/aktualisiert:');
console.log(` Email: ${user.email}`);
console.log(` Username: ${user.username}`);
console.log(` Passwort: ${password}`);
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});