feat : add appointment apis

This commit is contained in:
ARJUN S THAMPI
2026-03-16 10:16:27 +05:30
parent 9faa512c0b
commit 9ae190754a
5 changed files with 360 additions and 80 deletions

View File

@@ -0,0 +1,21 @@
-- CreateTable
CREATE TABLE "Appointment" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"mobileNumber" TEXT NOT NULL,
"email" TEXT,
"message" TEXT,
"date" TIMESTAMP(3) NOT NULL,
"doctorId" INTEGER NOT NULL,
"departmentId" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Appointment_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "Appointment" ADD CONSTRAINT "Appointment_doctorId_fkey" FOREIGN KEY ("doctorId") REFERENCES "Doctor"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Appointment" ADD CONSTRAINT "Appointment_departmentId_fkey" FOREIGN KEY ("departmentId") REFERENCES "Department"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -0,0 +1,15 @@
-- DropForeignKey
ALTER TABLE "Appointment" DROP CONSTRAINT "Appointment_departmentId_fkey";
-- DropForeignKey
ALTER TABLE "Appointment" DROP CONSTRAINT "Appointment_doctorId_fkey";
-- AlterTable
ALTER TABLE "Appointment" ALTER COLUMN "doctorId" SET DATA TYPE TEXT,
ALTER COLUMN "departmentId" SET DATA TYPE TEXT;
-- AddForeignKey
ALTER TABLE "Appointment" ADD CONSTRAINT "Appointment_doctorId_fkey" FOREIGN KEY ("doctorId") REFERENCES "Doctor"("doctorId") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Appointment" ADD CONSTRAINT "Appointment_departmentId_fkey" FOREIGN KEY ("departmentId") REFERENCES "Department"("departmentId") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -1,4 +1,3 @@
generator client {
provider = "prisma-client-js"
}
@@ -9,144 +8,142 @@ datasource db {
}
model User {
id Int @id @default(autoincrement())
username String @unique
password String
role String? @default("admin")
id Int @id @default(autoincrement())
username String @unique
password String
role String? @default("admin")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Doctor {
id Int @id @default(autoincrement())
doctorId String @unique
id Int @id @default(autoincrement())
doctorId String @unique
name String
designation String?
workingStatus String?
qualification String?
departments DoctorDepartment[]
appointments Appointment[]
departments DoctorDepartment[]
appointments Appointment[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Department {
id Int @id @default(autoincrement())
departmentId String @unique
name String
id Int @id @default(autoincrement())
departmentId String @unique
name String
para1 String?
para2 String?
para3 String?
facilities String?
services String?
para1 String?
para2 String?
para3 String?
facilities String?
services String?
doctors DoctorDepartment[]
appointments Appointment[]
doctors DoctorDepartment[]
appointments Appointment[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model DoctorDepartment {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
doctorId Int
departmentId Int
doctorId Int
departmentId Int
doctor Doctor @relation(fields: [doctorId], references: [id])
department Department @relation(fields: [departmentId], references: [id])
doctor Doctor @relation(fields: [doctorId], references: [id])
department Department @relation(fields: [departmentId], references: [id])
timing DoctorTiming?
timing DoctorTiming?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([doctorId, departmentId])
}
model DoctorTiming {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
doctorDepartmentId Int @unique
doctorDepartment DoctorDepartment @relation(fields: [doctorDepartmentId], references: [id])
doctorDepartmentId Int @unique
doctorDepartment DoctorDepartment @relation(fields: [doctorDepartmentId], references: [id])
monday String?
tuesday String?
wednesday String?
thursday String?
friday String?
saturday String?
sunday String?
additional String?
monday String?
tuesday String?
wednesday String?
thursday String?
friday String?
saturday String?
sunday String?
additional String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Blog {
id Int @id @default(autoincrement())
title String
writer String?
image String?
content Json
isActive Boolean @default(true)
id Int @id @default(autoincrement())
title String
writer String?
image String?
content Json
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Career {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
post String
designation String?
qualification String?
experienceNeed String?
email String?
number String?
status String @default("new")
status String @default("new")
candidates Candidate[]
candidates Candidate[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Candidate {
id Int @id @default(autoincrement())
fullName String
mobile String
email String
subject String
coverLetter String
careerId Int
id Int @id @default(autoincrement())
fullName String
mobile String
email String
subject String
coverLetter String
careerId Int
career Career @relation(fields: [careerId], references: [id])
career Career @relation(fields: [careerId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Appointment {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
name String
mobileNumber String
email String?
message String?
date DateTime
name String
mobileNumber String
email String?
message String?
date DateTime
doctorId Int
departmentId Int
doctorId String
departmentId String
doctor Doctor @relation(fields: [doctorId], references: [id])
department Department @relation(fields: [departmentId], references: [id])
doctor Doctor @relation(fields: [doctorId], references: [doctorId])
department Department @relation(fields: [departmentId], references: [departmentId])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}