From 2c385595bb6218c2bce66ffe1f2b1521b08c6b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Schro=CC=88der?= Date: Thu, 27 Jul 2023 12:06:40 +0200 Subject: [PATCH] fix(cli): Make it possible to activate inactive workflows (#4753) --- packages/cli/src/commands/update/workflow.ts | 26 ++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/commands/update/workflow.ts b/packages/cli/src/commands/update/workflow.ts index a13721ce66a091..680cfeacaf6dc4 100644 --- a/packages/cli/src/commands/update/workflow.ts +++ b/packages/cli/src/commands/update/workflow.ts @@ -56,15 +56,27 @@ export class UpdateWorkflowCommand extends BaseCommand { return; } - updateQuery.active = flags.active === 'true'; - const findQuery: FindOptionsWhere = {}; - if (flags.id) { - this.logger.info(`Deactivating workflow with ID: ${flags.id}`); - findQuery.id = flags.id; + if (flags.active === 'true') { + updateQuery.active = true; + + if (flags.id) { + this.logger.info(`Activating workflow with ID: ${flags.id}`); + findQuery.id = flags.id; + } else { + this.logger.info('Activating all workflows'); + findQuery.active = false; + } } else { - this.logger.info('Deactivating all workflows'); - findQuery.active = true; + updateQuery.active = false; + + if (flags.id) { + this.logger.info(`Deactivating workflow with ID: ${flags.id}`); + findQuery.id = flags.id; + } else { + this.logger.info('Deactivating all workflows'); + findQuery.active = true; + } } await Db.collections.Workflow.update(findQuery, updateQuery);