feat: health checkup CRUD apis #30

Merged
kailasdevdas merged 5 commits from feat/healthcheckup-crud into dev 2026-05-18 06:26:27 +00:00
3 changed files with 6 additions and 2 deletions
Showing only changes of commit d92e0538bd - Show all commits
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "HealthCheckCategory" ALTER COLUMN "slug" DROP NOT NULL;
+1 -1
View File
@@ -224,7 +224,7 @@ model NewsImage {
model HealthCheckCategory { model HealthCheckCategory {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
name String @unique name String @unique
slug String @unique slug String? @unique
description String? description String?
isActive Boolean @default(true) isActive Boolean @default(true)
sortOrder Int @default(1000) sortOrder Int @default(1000)
@@ -28,7 +28,7 @@ export const createCategory = async (req, res) => {
const category = await prisma.healthCheckCategory.create({ const category = await prisma.healthCheckCategory.create({
data: { data: {
name, name,
slug, slug: slug || null,
description, description,
isActive: isActive ?? true, isActive: isActive ?? true,
sortOrder: sortOrder ? Number(sortOrder) : 1000, sortOrder: sortOrder ? Number(sortOrder) : 1000,
@@ -58,6 +58,8 @@ export const updateCategory = async (req, res) => {
if (data.sortOrder !== undefined) data.sortOrder = Number(data.sortOrder); if (data.sortOrder !== undefined) data.sortOrder = Number(data.sortOrder);
if (data.slug === "") data.slug = null;
const updatedCategory = await prisma.$transaction(async (tx) => { const updatedCategory = await prisma.$transaction(async (tx) => {
const category = await tx.healthCheckCategory.update({ const category = await tx.healthCheckCategory.update({
where: { id: Number(id) }, where: { id: Number(id) },