fix: correct db port, localhost defaults, hashed passwords in seed
This commit is contained in:
@@ -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
|
||||
DATABASE_URL=postgresql://postgres:mypassword@localhost:5432/dentalapp
|
||||
@@ -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
|
||||
VITE_API_BASE_URL_BACKEND=http://localhost:5000
|
||||
@@ -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")),
|
||||
|
||||
Reference in New Issue
Block a user