From b230f16369a1b4af5f0321ebb0cf7867e48e8cf6 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Wed, 28 Sep 2022 11:57:58 +0100 Subject: [PATCH] minor renaming --- .../server/src/api/routes/tests/row.spec.js | 7 +++---- packages/types/src/documents/global/quotas.ts | 20 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/server/src/api/routes/tests/row.spec.js b/packages/server/src/api/routes/tests/row.spec.js index c57b675715..62e5509931 100644 --- a/packages/server/src/api/routes/tests/row.spec.js +++ b/packages/server/src/api/routes/tests/row.spec.js @@ -34,13 +34,12 @@ describe("/rows", () => { .expect(status) const getRowUsage = async () => { - return config.doInContext(null, () => - quotas.getCurrentUsageValue(QuotaUsageType.STATIC, StaticQuotaName.ROWS) - ) + const { total } = await config.doInContext(null, () => quotas.getCurrentUsageValues(QuotaUsageType.STATIC, StaticQuotaName.ROWS)) + return total } const getQueryUsage = async () => { - const { total } = await config.doInContext(null, () => quotas.getAllCurrentUsageValue(QuotaUsageType.MONTHLY, MonthlyQuotaName.QUERIES)) + const { total } = await config.doInContext(null, () => quotas.getCurrentUsageValues(QuotaUsageType.MONTHLY, MonthlyQuotaName.QUERIES)) return total } diff --git a/packages/types/src/documents/global/quotas.ts b/packages/types/src/documents/global/quotas.ts index 79d37b4e0e..eb1d77c228 100644 --- a/packages/types/src/documents/global/quotas.ts +++ b/packages/types/src/documents/global/quotas.ts @@ -6,52 +6,52 @@ export enum BreakdownQuotaName { AUTOMATIONS = "automations", } -export const StoredByAppQuotaNames = [ +export const APP_QUOTA_NAMES = [ StaticQuotaName.ROWS, MonthlyQuotaName.QUERIES, MonthlyQuotaName.AUTOMATIONS, ] -export const NamesToBreakdown = [ +export const BREAKDOWN_QUOTA_NAMES = [ MonthlyQuotaName.QUERIES, MonthlyQuotaName.AUTOMATIONS, ] -export interface Breakdown { +export interface UsageBreakdown { parent: MonthlyQuotaName values: { [key: string]: number } } -export type Monthly = { +export type MonthlyUsage = { [MonthlyQuotaName.QUERIES]: number [MonthlyQuotaName.AUTOMATIONS]: number [MonthlyQuotaName.DAY_PASSES]: number breakdown?: { - [key in BreakdownQuotaName]?: Breakdown + [key in BreakdownQuotaName]?: UsageBreakdown } } -export interface UsageInternal { +export interface BaseQuotaUsage { usageQuota: { [key in StaticQuotaName]: number } monthly: { - [key: string]: Monthly + [key: string]: MonthlyUsage } } -export interface QuotaUsage extends UsageInternal { +export interface QuotaUsage extends BaseQuotaUsage { _id: string _rev?: string quotaReset: string apps?: { - [key: string]: UsageInternal + [key: string]: BaseQuotaUsage } } -export type QuotaValues = { +export type UsageValues = { total: number app?: number breakdown?: number