Skip to content

Commit

Permalink
refactor(core): Upgrade typeorm (no-changelog) (#5423)
Browse files Browse the repository at this point in the history
[Now we can use aggregate functions directly over the repository API](typeorm/typeorm#9737)
  • Loading branch information
netroy authored Feb 9, 2023
1 parent e0c4c25 commit 52cb185
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 67 deletions.
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
"sse-channel": "^4.0.0",
"swagger-ui-express": "^4.3.0",
"syslog-client": "^1.1.1",
"typeorm": "0.3.11",
"typeorm": "^0.3.12",
"uuid": "^8.3.2",
"validator": "13.7.0",
"winston": "^3.3.3",
Expand Down
10 changes: 2 additions & 8 deletions packages/cli/src/license/License.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ import * as Db from '@/Db';

export class LicenseService {
static async getActiveTriggerCount(): Promise<number> {
const qb = Db.collections.Workflow.createQueryBuilder('workflow')
.select('SUM(workflow.triggerCount)', 'triggerCount')
.where('workflow.active = :active', { active: true });
const results: { triggerCount: number } | undefined = await qb.getRawOne();
if (!results) {
throw new Error('Could not get active trigger count');
}
return results.triggerCount ?? 0;
const totalTriggerCount = await Db.collections.Workflow.sum('triggerCount', { active: true });
return totalTriggerCount ?? 0;
}

// Helper for getting the basic license data that we want to return
Expand Down
Loading

0 comments on commit 52cb185

Please sign in to comment.