fix: make category slug optional
This commit is contained in:
@@ -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) },
|
||||
|
||||
Reference in New Issue
Block a user