show credential pw

This commit is contained in:
ff
2026-04-07 23:52:05 -04:00
parent cb97e249d0
commit b9edd6a5e6
16 changed files with 1846 additions and 318 deletions

View File

@@ -9,90 +9,16 @@ import bcrypt from "bcrypt";
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
const prisma = new PrismaClient({ adapter } as any);
function formatTime(date: Date): string {
return date.toTimeString().slice(0, 5); // "HH:MM"
}
async function main() {
const hashedPassword = await bcrypt.hash("123456", 10);
// Create multiple users
await prisma.user.createMany({
data: [
{ username: "admin2", password: hashedPassword },
{ username: "bob", password: hashedPassword },
],
await prisma.user.upsert({
where: { username: "admin" },
update: {},
create: { username: "admin", password: hashedPassword },
});
const createdUsers = await prisma.user.findMany();
// Create staff (userId links staff to a user account)
await prisma.staff.createMany({
data: [
{ name: "Dr. Kai Gao", role: "Doctor", userId: createdUsers[0].id },
{ name: "Dr. Jane Smith", role: "Doctor", userId: createdUsers[1].id },
],
});
const staffMembers = await prisma.staff.findMany();
// Create multiple patients
await prisma.patient.createMany({
data: [
{
firstName: "Emily",
lastName: "Clark",
dateOfBirth: new Date("1985-06-15"),
gender: "female",
phone: "555-0001",
email: "emily@example.com",
address: "101 Apple Rd",
city: "Newtown",
zipCode: "10001",
userId: createdUsers[0].id,
},
{
firstName: "Michael",
lastName: "Brown",
dateOfBirth: new Date("1979-09-10"),
gender: "male",
phone: "555-0002",
email: "michael@example.com",
address: "202 Banana Ave",
city: "Oldtown",
zipCode: "10002",
userId: createdUsers[1].id,
},
],
});
const createdPatients = await prisma.patient.findMany();
// Create multiple appointments
await prisma.appointment.createMany({
data: [
{
patientId: createdPatients[0].id,
userId: createdUsers[0].id,
staffId: staffMembers[0].id,
title: "Initial Consultation",
date: new Date("2025-06-01"),
startTime: formatTime(new Date("2025-06-01T10:00:00")),
endTime: formatTime(new Date("2025-06-01T10:30:00")),
type: "consultation",
},
{
patientId: createdPatients[1].id,
userId: createdUsers[1].id,
staffId: staffMembers[1].id,
title: "Follow-up",
date: new Date("2025-06-02"),
startTime: formatTime(new Date("2025-06-01T10:00:00")),
endTime: formatTime(new Date("2025-06-01T10:30:00")),
type: "checkup",
},
],
});
console.log("Seed complete: admin user created (username: admin, password: 123456)");
}
main()

View File

@@ -1,8 +1,8 @@
{
"version": "1.0",
"generatorVersion": "1.0.0",
"generatedAt": "2026-04-03T21:49:35.498Z",
"outputPath": "/home/gg/Desktop/DentalManagement/packages/db/shared",
"generatedAt": "2026-04-05T02:53:07.525Z",
"outputPath": "/home/ff/Desktop/DentalManagementMHAprilgg/packages/db/shared",
"files": [
"schemas/enums/TransactionIsolationLevel.schema.ts",
"schemas/enums/UserScalarFieldEnum.schema.ts",

File diff suppressed because it is too large Load Diff