import { deleteCategoryMultipleId } from "@/models/term";
import { response } from "@/utils/helper";

export async function POST(request) {
  try {
    const body = await request.json();

    if (!Array.isArray(body?.data))
      return response(400, "Bad Request", null, {
        error: "Data type must be array",
      });

    const result = await deleteCategoryMultipleId(body.data);

    return response(200, "Delete category successfully", result);
  } catch (error) {
    return response(500, "Internal Server Error", null, {
      error: "Failed to delete data",
    });
  }
}
