fix: make category slug optional

This commit is contained in:
Kailasdevdas
2026-05-18 10:58:14 +05:30
parent 8d60afdc49
commit d92e0538bd
3 changed files with 6 additions and 2 deletions
@@ -28,7 +28,7 @@ export const createCategory = async (req, res) => {
const category = await prisma.healthCheckCategory.create({
data: {
name,
slug,
slug: slug || null,
description,
isActive: isActive ?? true,
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.slug === "") data.slug = null;
const updatedCategory = await prisma.$transaction(async (tx) => {
const category = await tx.healthCheckCategory.update({
where: { id: Number(id) },