Move trigger logic inside pro

This commit is contained in:
Rory Powell 2022-10-07 13:57:10 +01:00
parent af24f72166
commit ed948e6ae7
3 changed files with 24 additions and 24 deletions

View File

@ -3,3 +3,9 @@ import { QuotaUsage } from "../../documents"
export interface GetLicenseRequest { export interface GetLicenseRequest {
quotaUsage: QuotaUsage quotaUsage: QuotaUsage
} }
export interface QuotaTriggeredRequest {
percentage: number
name: string
resetDate?: string
}

View File

@ -50,7 +50,7 @@ export interface Account extends CreateAccount {
licenseKey?: string licenseKey?: string
licenseKeyActivatedAt?: number licenseKeyActivatedAt?: number
licenseOverrides?: LicenseOverrides licenseOverrides?: LicenseOverrides
quotaUsage?: AccountQuotaUsage quotaUsage?: QuotaUsage
} }
export interface PasswordAccount extends Account { export interface PasswordAccount extends Account {
@ -93,26 +93,3 @@ export interface OAuthTokens {
accessToken: string accessToken: string
refreshToken: string refreshToken: string
} }
export type QuotaTriggers = {
[key: string]: string | null
}
export interface AccountStaticUsage extends StaticUsage {
triggers?: {
[key in StaticQuotaName]?: QuotaTriggers
}
}
export interface AccountMonthlyUsage extends MonthlyUsage {
triggers?: {
[key in MonthlyQuotaName]?: QuotaTriggers
}
}
export interface AccountQuotaUsage extends QuotaUsage {
usageQuota: AccountStaticUsage
monthly: {
[key: string]: AccountMonthlyUsage
}
}

View File

@ -24,17 +24,27 @@ export interface UsageBreakdown {
} }
} }
export type QuotaTriggers = {
[key: string]: string | undefined
}
export interface StaticUsage { export interface StaticUsage {
[StaticQuotaName.APPS]: number [StaticQuotaName.APPS]: number
[StaticQuotaName.PLUGINS]: number [StaticQuotaName.PLUGINS]: number
[StaticQuotaName.USER_GROUPS]: number [StaticQuotaName.USER_GROUPS]: number
[StaticQuotaName.ROWS]: number [StaticQuotaName.ROWS]: number
triggers: {
[key in StaticQuotaName]?: QuotaTriggers
}
} }
export interface MonthlyUsage { export interface MonthlyUsage {
[MonthlyQuotaName.QUERIES]: number [MonthlyQuotaName.QUERIES]: number
[MonthlyQuotaName.AUTOMATIONS]: number [MonthlyQuotaName.AUTOMATIONS]: number
[MonthlyQuotaName.DAY_PASSES]: number [MonthlyQuotaName.DAY_PASSES]: number
triggers: {
[key in MonthlyQuotaName]?: QuotaTriggers
}
breakdown?: { breakdown?: {
[key in BreakdownQuotaName]?: UsageBreakdown [key in BreakdownQuotaName]?: UsageBreakdown
} }
@ -56,6 +66,13 @@ export interface QuotaUsage extends BaseQuotaUsage {
} }
} }
export type SetUsageValues = {
total: number
app?: number
breakdown?: number
triggers?: QuotaTriggers
}
export type UsageValues = { export type UsageValues = {
total: number total: number
app?: number app?: number