From 608a577b1c6411c2e082d90aa92f19cb6e453155 Mon Sep 17 00:00:00 2001 From: ff Date: Sat, 4 Apr 2026 23:30:05 -0400 Subject: [PATCH] fix: correct db port, localhost defaults, hashed passwords in seed --- apps/Backend/.env.example | 6 ++---- apps/Frontend/.env.example | 3 +-- packages/db/prisma/seed.ts | 19 ++++++++++++------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/apps/Backend/.env.example b/apps/Backend/.env.example index 1a7e0fe..27c4f39 100755 --- a/apps/Backend/.env.example +++ b/apps/Backend/.env.example @@ -1,13 +1,11 @@ NODE_ENV="development" HOST=0.0.0.0 PORT=5000 -# FRONTEND_URLS=http://localhost:3000,http://192.168.1.8:3000 -# FRONTEND_URLS=http://localhost:3000 -FRONTEND_URLS=http://192.168.1.37:3000 +FRONTEND_URLS=http://localhost:3000 SELENIUM_AGENT_BASE_URL=http://localhost:5002 JWT_SECRET = 'dentalsecret' DB_HOST=localhost DB_USER=postgres DB_PASSWORD=mypassword DB_NAME=dentalapp -DATABASE_URL=postgresql://postgres:mypassword@localhost:5433/dentalapp \ No newline at end of file +DATABASE_URL=postgresql://postgres:mypassword@localhost:5432/dentalapp \ No newline at end of file diff --git a/apps/Frontend/.env.example b/apps/Frontend/.env.example index 2d3681b..acfe8ff 100755 --- a/apps/Frontend/.env.example +++ b/apps/Frontend/.env.example @@ -1,5 +1,4 @@ NODE_ENV=development HOST=0.0.0.0 PORT=3000 -VITE_API_BASE_URL_BACKEND=http://192.168.1.37:5000 -# VITE_API_BASE_URL_BACKEND=http://localhost:5000 \ No newline at end of file +VITE_API_BASE_URL_BACKEND=http://localhost:5000 \ No newline at end of file diff --git a/packages/db/prisma/seed.ts b/packages/db/prisma/seed.ts index ac5a22f..7524045 100755 --- a/packages/db/prisma/seed.ts +++ b/packages/db/prisma/seed.ts @@ -1,4 +1,5 @@ import { PrismaClient } from "../generated/prisma"; +import bcrypt from "bcrypt"; const prisma = new PrismaClient(); function formatTime(date: Date): string { @@ -6,28 +7,30 @@ function formatTime(date: Date): string { } async function main() { + const hashedPassword = await bcrypt.hash("123456", 10); + // Create multiple users - const users = await prisma.user.createMany({ + await prisma.user.createMany({ data: [ - { username: "admin2", password: "123456" }, - { username: "bob", password: "123456" }, + { username: "admin2", password: hashedPassword }, + { username: "bob", password: hashedPassword }, ], }); const createdUsers = await prisma.user.findMany(); - // Creatin staff + // Create staff (userId links staff to a user account) await prisma.staff.createMany({ data: [ - { name: "Dr. Kai Gao", role: "Doctor" }, - { name: "Dr. Jane Smith", role: "Doctor" }, + { 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 - const patients = await prisma.patient.createMany({ + await prisma.patient.createMany({ data: [ { firstName: "Emily", @@ -64,6 +67,7 @@ async function main() { { 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")), @@ -73,6 +77,7 @@ async function main() { { 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")),