Skip to content

Commit

Permalink
fix(cli): Make it possible to activate inactive workflows (#4753)
Browse files Browse the repository at this point in the history
  • Loading branch information
schroedan committed Jul 27, 2023
1 parent feac369 commit 2c38559
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions packages/cli/src/commands/update/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,27 @@ export class UpdateWorkflowCommand extends BaseCommand {
return;
}

updateQuery.active = flags.active === 'true';

const findQuery: FindOptionsWhere<WorkflowEntity> = {};
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);
Expand Down

0 comments on commit 2c38559

Please sign in to comment.