fix(core): Remove unnecessary info from GET /workflows response (#5311)

* fix(core): Remove unnecessary info from `GET /workflows` response

* fix(core): Remove unnecessary info from `GET /workflows` response

* fix(core): Remove credentials from `GET /workflows` response

* fix(core): Update unit tests for `GET /workflows` response

* fix(core): Remove `usedCredentials` from `GET /workflows` response

* fix(core): Update unit tests for `GET /workflows` response

* fix(core): remove nodes from getMany

* fix(core): remove unnecessary owner props from workflow list items

* fix(core): fix lint error

* fix(core): remove unused function

* fix(core): simplifying ownerId usage

* fix(core): trim down the query for workflow listing
This commit is contained in:
Csaba Tuncsik
2023-02-16 10:36:24 +01:00
committed by GitHub
parent 1a20fd9f46
commit a2c6ea9e11
5 changed files with 51 additions and 117 deletions

View File

@@ -203,12 +203,16 @@ EEWorkflowController.post(
EEWorkflowController.get(
'/',
ResponseHelper.send(async (req: WorkflowRequest.GetAll) => {
const workflows = await EEWorkflows.getMany(req.user, req.query.filter);
await EEWorkflows.addCredentialsToWorkflows(workflows, req.user);
const [workflows, workflowOwnerRole] = await Promise.all([
EEWorkflows.getMany(req.user, req.query.filter),
Db.collections.Role.findOneOrFail({
select: ['id'],
where: { name: 'owner', scope: 'workflow' },
}),
]);
return workflows.map((workflow) => {
EEWorkflows.addOwnerAndSharings(workflow);
workflow.nodes = [];
EEWorkflows.addOwnerId(workflow, workflowOwnerRole);
return workflow;
});
}),