feat: basic api setup and boilerplate
This commit is contained in:
79
backend/prisma/migrations/20260223061336_init/migration.sql
Normal file
79
backend/prisma/migrations/20260223061336_init/migration.sql
Normal 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;
|
||||
@@ -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");
|
||||
13
backend/prisma/migrations/20260311120120_blog/migration.sql
Normal file
13
backend/prisma/migrations/20260311120120_blog/migration.sql
Normal 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")
|
||||
);
|
||||
3
backend/prisma/migrations/migration_lock.toml
Normal file
3
backend/prisma/migrations/migration_lock.toml
Normal 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"
|
||||
100
backend/prisma/schema.prisma
Normal file
100
backend/prisma/schema.prisma
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user