feat: basic api setup and boilerplate

This commit is contained in:
ARJUN S THAMPI
2026-03-12 14:15:44 +05:30
commit 521a1fea79
24 changed files with 684 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
-- CreateTable
CREATE TABLE "Doctor" (
"id" SERIAL NOT NULL,
"doctorId" TEXT NOT NULL,
"name" TEXT NOT NULL,
"designation" TEXT,
"workingStatus" TEXT,
"qualification" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Doctor_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Department" (
"id" SERIAL NOT NULL,
"departmentId" TEXT NOT NULL,
"name" TEXT NOT NULL,
"para1" TEXT,
"para2" TEXT,
"para3" TEXT,
"facilities" TEXT,
"services" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Department_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "DoctorDepartment" (
"id" SERIAL NOT NULL,
"doctorId" INTEGER NOT NULL,
"departmentId" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "DoctorDepartment_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "DoctorTiming" (
"id" SERIAL NOT NULL,
"doctorDepartmentId" INTEGER NOT NULL,
"monday" TEXT,
"tuesday" TEXT,
"wednesday" TEXT,
"thursday" TEXT,
"friday" TEXT,
"saturday" TEXT,
"sunday" TEXT,
"additional" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "DoctorTiming_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Doctor_doctorId_key" ON "Doctor"("doctorId");
-- CreateIndex
CREATE UNIQUE INDEX "Department_departmentId_key" ON "Department"("departmentId");
-- CreateIndex
CREATE UNIQUE INDEX "DoctorDepartment_doctorId_departmentId_key" ON "DoctorDepartment"("doctorId", "departmentId");
-- CreateIndex
CREATE UNIQUE INDEX "DoctorTiming_doctorDepartmentId_key" ON "DoctorTiming"("doctorDepartmentId");
-- AddForeignKey
ALTER TABLE "DoctorDepartment" ADD CONSTRAINT "DoctorDepartment_doctorId_fkey" FOREIGN KEY ("doctorId") REFERENCES "Doctor"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "DoctorDepartment" ADD CONSTRAINT "DoctorDepartment_departmentId_fkey" FOREIGN KEY ("departmentId") REFERENCES "Department"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "DoctorTiming" ADD CONSTRAINT "DoctorTiming_doctorDepartmentId_fkey" FOREIGN KEY ("doctorDepartmentId") REFERENCES "DoctorDepartment"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -0,0 +1,14 @@
-- CreateTable
CREATE TABLE "User" (
"id" SERIAL NOT NULL,
"username" TEXT NOT NULL,
"password" TEXT NOT NULL,
"role" TEXT DEFAULT 'admin',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");

View File

@@ -0,0 +1,13 @@
-- CreateTable
CREATE TABLE "Blog" (
"id" SERIAL NOT NULL,
"title" TEXT NOT NULL,
"writer" TEXT,
"image" TEXT,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"content" JSONB NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Blog_pkey" PRIMARY KEY ("id")
);

View File

@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"

View File

@@ -0,0 +1,100 @@
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
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
name String
designation String?
workingStatus String?
qualification String?
departments DoctorDepartment[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Department {
id Int @id @default(autoincrement())
departmentId String @unique
name String
para1 String?
para2 String?
para3 String?
facilities String?
services String?
doctors DoctorDepartment[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model DoctorDepartment {
id Int @id @default(autoincrement())
doctorId Int
departmentId Int
doctor Doctor @relation(fields: [doctorId], references: [id])
department Department @relation(fields: [departmentId], references: [id])
timing DoctorTiming?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([doctorId, departmentId])
}
model DoctorTiming {
id Int @id @default(autoincrement())
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?
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)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}