refactor(core): Continue moving typeorm operators to repositories (no-changelog) (#8186)

Follow-up to: #8163
This commit is contained in:
Iván Ovejero
2024-01-02 17:53:24 +01:00
committed by GitHub
parent 0ca2759d75
commit 40c1eeeddd
35 changed files with 341 additions and 354 deletions

View File

@@ -198,4 +198,16 @@ export class WorkflowRepository extends Repository<WorkflowEntity> {
.innerJoin(WebhookEntity, 'webhook_entity', 'workflow.id = webhook_entity.workflowId')
.execute() as Promise<Array<{ id: string; name: string }>>;
}
async updateActiveState(workflowId: string, newState: boolean) {
return this.update({ id: workflowId }, { active: newState });
}
async deactivateAll() {
return this.update({ active: true }, { active: false });
}
async findByActiveState(activeState: boolean) {
return this.findBy({ active: activeState });
}
}