major change on how workflow builder works. It now fetches in edit mode all the currently configured workflows

This commit is contained in:
Joao Correia
2025-02-01 22:36:42 +00:00
parent a0229cd971
commit ac539332e6
12 changed files with 159 additions and 56 deletions

View File

@@ -2,7 +2,7 @@
import { ApprovalWorkflow } from "@/interfaces/approval.workflow";
import { sessionOptions } from "@/lib/session";
import { requestUser } from "@/utils/api";
import { deleteApprovalWorkflow, updateApprovalWorkflow } from "@/utils/approval.workflows.be";
import { deleteConfiguredWorkflow, updateConfiguredWorkflow } from "@/utils/approval.workflows.be";
import { withIronSessionApiRoute } from "iron-session/next";
import type { NextApiRequest, NextApiResponse } from "next";
@@ -23,7 +23,7 @@ async function del(req: NextApiRequest, res: NextApiResponse) {
const { id } = req.query as { id?: string };
if (id) return res.status(200).json(await deleteApprovalWorkflow(id));
if (id) return res.status(200).json(await deleteConfiguredWorkflow(id));
}
async function put(req: NextApiRequest, res: NextApiResponse) {
@@ -38,7 +38,7 @@ async function put(req: NextApiRequest, res: NextApiResponse) {
const workflow = req.body;
if (id && workflow) {
await updateApprovalWorkflow(id, workflow);
await updateConfiguredWorkflow(workflow);
return res.status(204).end();
}
}