feat: facility and google review crud

This commit is contained in:
Kailasdevdas
2026-06-25 16:59:11 +05:30
parent a88d2e3d8c
commit 99601f9f0d
17 changed files with 2293 additions and 2 deletions
@@ -0,0 +1,49 @@
-- CreateTable
CREATE TABLE "Facility" (
"id" SERIAL NOT NULL,
"facilityId" TEXT NOT NULL,
"name" TEXT NOT NULL,
"slug" TEXT NOT NULL,
"shortDescription" TEXT,
"description" TEXT,
"videoUrl" TEXT,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"isFeatured" BOOLEAN NOT NULL DEFAULT false,
"sortOrder" INTEGER NOT NULL DEFAULT 1000,
"departmentId" INTEGER,
"seoId" INTEGER,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Facility_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "FacilityImage" (
"id" SERIAL NOT NULL,
"url" TEXT NOT NULL,
"altText" TEXT,
"description" TEXT,
"facilityId" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "FacilityImage_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Facility_facilityId_key" ON "Facility"("facilityId");
-- CreateIndex
CREATE UNIQUE INDEX "Facility_slug_key" ON "Facility"("slug");
-- CreateIndex
CREATE UNIQUE INDEX "Facility_seoId_key" ON "Facility"("seoId");
-- AddForeignKey
ALTER TABLE "Facility" ADD CONSTRAINT "Facility_departmentId_fkey" FOREIGN KEY ("departmentId") REFERENCES "Department"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Facility" ADD CONSTRAINT "Facility_seoId_fkey" FOREIGN KEY ("seoId") REFERENCES "Seo"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "FacilityImage" ADD CONSTRAINT "FacilityImage_facilityId_fkey" FOREIGN KEY ("facilityId") REFERENCES "Facility"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,17 @@
-- CreateTable
CREATE TABLE "GoogleReview" (
"id" SERIAL NOT NULL,
"reviewerName" TEXT NOT NULL,
"reviewerImage" TEXT,
"rating" INTEGER NOT NULL,
"review" TEXT NOT NULL,
"reviewDate" TIMESTAMP(3),
"googleReviewUrl" TEXT,
"isFeatured" BOOLEAN NOT NULL DEFAULT false,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"sortOrder" INTEGER NOT NULL DEFAULT 1000,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "GoogleReview_pkey" PRIMARY KEY ("id")
);
+59 -1
View File
@@ -46,12 +46,12 @@ model Department {
name String
image String?
para1 String?
para2 String?
para3 String?
facilities String?
services String?
facilitiesList Facility[]
isActive Boolean @default(true)
sortOrder Int @default(1000)
@@ -300,6 +300,7 @@ model Seo {
id Int @id @default(autoincrement())
doctor Doctor?
healthPackage HealthPackage?
facility Facility?
seoTitle String?
@@ -378,4 +379,61 @@ model Accreditation {
enum AccreditationType {
ACCREDITATION
CERTIFICATION
}
model Facility {
id Int @id @default(autoincrement())
facilityId String @unique
name String
slug String @unique
shortDescription String? @db.Text
description String? @db.Text
videoUrl String?
isActive Boolean @default(true)
isFeatured Boolean @default(false)
sortOrder Int @default(1000)
images FacilityImage[]
departmentId Int?
department Department? @relation(fields: [departmentId], references: [id], onDelete: SetNull)
seoId Int? @unique
seo Seo? @relation(fields: [seoId], references: [id], onDelete: SetNull)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model FacilityImage {
id Int @id @default(autoincrement())
url String
altText String?
description String?
facilityId Int
facility Facility @relation(fields: [facilityId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
}
model GoogleReview {
id Int @id @default(autoincrement())
reviewerName String
reviewerImage String?
rating Int
review String @db.Text
reviewDate DateTime?
googleReviewUrl String?
isFeatured Boolean @default(false)
isActive Boolean @default(true)
sortOrder Int @default(1000)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}