feat: add toggle on and off status
This commit is contained in:
parent
43d78e7db8
commit
a18d56503d
1 changed files with 4 additions and 2 deletions
|
|
@ -14,7 +14,7 @@ import {
|
||||||
} from "tsoa";
|
} from "tsoa";
|
||||||
import { RequestWithUser } from "../interfaces/user";
|
import { RequestWithUser } from "../interfaces/user";
|
||||||
import prisma from "../db";
|
import prisma from "../db";
|
||||||
import { Prisma } from "@prisma/client";
|
import { Prisma, Status } from "@prisma/client";
|
||||||
import {
|
import {
|
||||||
branchRelationPermInclude,
|
branchRelationPermInclude,
|
||||||
createPermCheck,
|
createPermCheck,
|
||||||
|
|
@ -33,6 +33,7 @@ type WorkflowPayload = {
|
||||||
responsiblePersonId?: string[];
|
responsiblePersonId?: string[];
|
||||||
}[];
|
}[];
|
||||||
registeredBranchId?: string;
|
registeredBranchId?: string;
|
||||||
|
status?: Status;
|
||||||
};
|
};
|
||||||
|
|
||||||
const permissionCondCompany = createPermCondition((_) => true);
|
const permissionCondCompany = createPermCondition((_) => true);
|
||||||
|
|
@ -75,7 +76,7 @@ export class FlowTemplateController extends Controller {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
orderBy: { createdAt: "asc" },
|
orderBy: [{ statusOrder: "asc" }, { createdAt: "asc" }],
|
||||||
take: pageSize,
|
take: pageSize,
|
||||||
skip: (page - 1) * pageSize,
|
skip: (page - 1) * pageSize,
|
||||||
}),
|
}),
|
||||||
|
|
@ -170,6 +171,7 @@ export class FlowTemplateController extends Controller {
|
||||||
where: { id: templateId },
|
where: { id: templateId },
|
||||||
data: {
|
data: {
|
||||||
...body,
|
...body,
|
||||||
|
statusOrder: +(body.status === "INACTIVE"),
|
||||||
step: {
|
step: {
|
||||||
create: body.step.map((v, i) => ({
|
create: body.step.map((v, i) => ({
|
||||||
type: v.type,
|
type: v.type,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue