Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

570 B
Raw Blame
import { eq } from "drizzle-orm";
import { HTTPException } from "hono/http-exception";
import db from "../../database";
import { workflowRuleTable } from "../../database/schema";

async function deleteWorkflowRule(id: string) {
  const existing = await db.query.workflowRuleTable.findFirst({
    where: eq(workflowRuleTable.id, id),
  });

  if (!existing) {
    throw new HTTPException(404, { message: "Workflow rule not found" });
  }

  await db.delete(workflowRuleTable).where(eq(workflowRuleTable.id, id));

  return existing;
}

export default deleteWorkflowRule;