all ui done

This commit is contained in:
2025-05-15 20:22:04 +05:30
parent bebe6cff83
commit ffe239783f
15 changed files with 480 additions and 520 deletions

View File

@@ -1,13 +1,16 @@
import { PrismaClient } from '../generated/prisma';
import { PrismaClient } from "../generated/prisma";
const prisma = new PrismaClient();
console.log("Here")
function formatTime(date: Date): string {
return date.toTimeString().slice(0, 5); // "HH:MM"
}
async function main() {
// Create multiple users
const users = await prisma.user.createMany({
data: [
{ username: 'admin2', password: '123456' },
{ username: 'bob', password: '123456' },
{ username: "admin2", password: "123456" },
{ username: "bob", password: "123456" },
],
});
@@ -16,8 +19,8 @@ async function main() {
// Creatin staff
await prisma.staff.createMany({
data: [
{ name: 'Dr. Kai Gao', role: 'Doctor' },
{ name: 'Dr. Jane Smith', role: 'Doctor' },
{ name: "Dr. Kai Gao", role: "Doctor" },
{ name: "Dr. Jane Smith", role: "Doctor" },
],
});
@@ -27,27 +30,27 @@ async function main() {
const 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',
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',
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,
},
],
@@ -61,25 +64,23 @@ async function main() {
{
patientId: createdPatients[0].id,
userId: createdUsers[0].id,
title: 'Initial Consultation',
date: new Date('2025-06-01'),
startTime: new Date('2025-06-01T10:00:00'),
endTime: new Date('2025-06-01T10:30:00'),
type: 'consultation',
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,
title: 'Follow-up',
date: new Date('2025-06-02'),
startTime: new Date('2025-06-02T14:00:00'),
endTime: new Date('2025-06-02T14:30:00'),
type: 'checkup',
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('✅ Seeded multiple users, patients, and appointments.');
}
main()
@@ -88,6 +89,5 @@ main()
process.exit(1);
})
.finally(async () => {
console.log("Done seeding logged.")
await prisma.$disconnect();
});