feat: Include totalUsers in usage metrics during license renewal (no-changelog) (#8598)

This commit is contained in:
Cornelius Suermann
2024-02-09 14:15:05 +01:00
committed by GitHub
parent 79b09fdf84
commit cd151f1ba9
3 changed files with 8 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ export class UsageMetricsRepository extends Repository<UsageMetrics> {
async getLicenseRenewalMetrics() {
type Row = {
enabled_user_count: string | number;
total_user_count: string | number;
active_workflow_count: string | number;
total_workflow_count: string | number;
total_credentials_count: string | number;
@@ -44,6 +45,7 @@ export class UsageMetricsRepository extends Repository<UsageMetrics> {
const [
{
enabled_user_count: enabledUsers,
total_user_count: totalUsers,
active_workflow_count: activeWorkflows,
total_workflow_count: totalWorkflows,
total_credentials_count: totalCredentials,
@@ -53,6 +55,7 @@ export class UsageMetricsRepository extends Repository<UsageMetrics> {
] = (await this.query(`
SELECT
(SELECT COUNT(*) FROM ${userTable} WHERE disabled = false) AS enabled_user_count,
(SELECT COUNT(*) FROM ${userTable}) AS total_user_count,
(SELECT COUNT(*) FROM ${workflowTable} WHERE active = true) AS active_workflow_count,
(SELECT COUNT(*) FROM ${workflowTable}) AS total_workflow_count,
(SELECT COUNT(*) FROM ${credentialTable}) AS total_credentials_count,
@@ -65,6 +68,7 @@ export class UsageMetricsRepository extends Repository<UsageMetrics> {
return {
enabledUsers: toNumber(enabledUsers),
totalUsers: toNumber(totalUsers),
activeWorkflows: toNumber(activeWorkflows),
totalWorkflows: toNumber(totalWorkflows),
totalCredentials: toNumber(totalCredentials),