minor renaming
This commit is contained in:
parent
9af16738e5
commit
59527b29f0
|
@ -34,13 +34,12 @@ describe("/rows", () => {
|
||||||
.expect(status)
|
.expect(status)
|
||||||
|
|
||||||
const getRowUsage = async () => {
|
const getRowUsage = async () => {
|
||||||
return config.doInContext(null, () =>
|
const { total } = await config.doInContext(null, () => quotas.getCurrentUsageValues(QuotaUsageType.STATIC, StaticQuotaName.ROWS))
|
||||||
quotas.getCurrentUsageValue(QuotaUsageType.STATIC, StaticQuotaName.ROWS)
|
return total
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getQueryUsage = async () => {
|
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
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,52 +6,52 @@ export enum BreakdownQuotaName {
|
||||||
AUTOMATIONS = "automations",
|
AUTOMATIONS = "automations",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const StoredByAppQuotaNames = [
|
export const APP_QUOTA_NAMES = [
|
||||||
StaticQuotaName.ROWS,
|
StaticQuotaName.ROWS,
|
||||||
MonthlyQuotaName.QUERIES,
|
MonthlyQuotaName.QUERIES,
|
||||||
MonthlyQuotaName.AUTOMATIONS,
|
MonthlyQuotaName.AUTOMATIONS,
|
||||||
]
|
]
|
||||||
|
|
||||||
export const NamesToBreakdown = [
|
export const BREAKDOWN_QUOTA_NAMES = [
|
||||||
MonthlyQuotaName.QUERIES,
|
MonthlyQuotaName.QUERIES,
|
||||||
MonthlyQuotaName.AUTOMATIONS,
|
MonthlyQuotaName.AUTOMATIONS,
|
||||||
]
|
]
|
||||||
|
|
||||||
export interface Breakdown {
|
export interface UsageBreakdown {
|
||||||
parent: MonthlyQuotaName
|
parent: MonthlyQuotaName
|
||||||
values: {
|
values: {
|
||||||
[key: string]: number
|
[key: string]: number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Monthly = {
|
export type MonthlyUsage = {
|
||||||
[MonthlyQuotaName.QUERIES]: number
|
[MonthlyQuotaName.QUERIES]: number
|
||||||
[MonthlyQuotaName.AUTOMATIONS]: number
|
[MonthlyQuotaName.AUTOMATIONS]: number
|
||||||
[MonthlyQuotaName.DAY_PASSES]: number
|
[MonthlyQuotaName.DAY_PASSES]: number
|
||||||
breakdown?: {
|
breakdown?: {
|
||||||
[key in BreakdownQuotaName]?: Breakdown
|
[key in BreakdownQuotaName]?: UsageBreakdown
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UsageInternal {
|
export interface BaseQuotaUsage {
|
||||||
usageQuota: {
|
usageQuota: {
|
||||||
[key in StaticQuotaName]: number
|
[key in StaticQuotaName]: number
|
||||||
}
|
}
|
||||||
monthly: {
|
monthly: {
|
||||||
[key: string]: Monthly
|
[key: string]: MonthlyUsage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface QuotaUsage extends UsageInternal {
|
export interface QuotaUsage extends BaseQuotaUsage {
|
||||||
_id: string
|
_id: string
|
||||||
_rev?: string
|
_rev?: string
|
||||||
quotaReset: string
|
quotaReset: string
|
||||||
apps?: {
|
apps?: {
|
||||||
[key: string]: UsageInternal
|
[key: string]: BaseQuotaUsage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QuotaValues = {
|
export type UsageValues = {
|
||||||
total: number
|
total: number
|
||||||
app?: number
|
app?: number
|
||||||
breakdown?: number
|
breakdown?: number
|
||||||
|
|
Loading…
Reference in New Issue