From c0df3e67b38528a89b3c81bf9bb9037d4439f7b5 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 5 Dec 2024 15:01:48 +0000 Subject: [PATCH] Licensing API typing. --- packages/types/src/api/web/global/license.ts | 4 ++++ packages/worker/src/api/controllers/global/license.ts | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/types/src/api/web/global/license.ts b/packages/types/src/api/web/global/license.ts index 21d8876412..344ab829c2 100644 --- a/packages/types/src/api/web/global/license.ts +++ b/packages/types/src/api/web/global/license.ts @@ -1,5 +1,7 @@ // LICENSE KEY +import { QuotaUsage } from "../../../documents" + export interface ActivateLicenseKeyRequest { licenseKey: string } @@ -23,3 +25,5 @@ export interface GetOfflineLicenseTokenResponse { export interface GetOfflineIdentifierResponse { identifierBase64: string } + +export interface GetQuotaUsageResponse extends QuotaUsage {} diff --git a/packages/worker/src/api/controllers/global/license.ts b/packages/worker/src/api/controllers/global/license.ts index 111cb5cea3..04f76a6593 100644 --- a/packages/worker/src/api/controllers/global/license.ts +++ b/packages/worker/src/api/controllers/global/license.ts @@ -5,6 +5,7 @@ import { GetLicenseKeyResponse, GetOfflineIdentifierResponse, GetOfflineLicenseTokenResponse, + GetQuotaUsageResponse, UserCtx, } from "@budibase/types" @@ -36,7 +37,7 @@ export async function deleteLicenseKey(ctx: UserCtx) { // OFFLINE LICENSE export async function activateOfflineLicenseToken( - ctx: UserCtx + ctx: UserCtx ) { const { offlineLicenseToken } = ctx.request.body await licensing.offline.activateOfflineLicenseToken(offlineLicenseToken) @@ -70,14 +71,16 @@ export async function getOfflineLicenseIdentifier( // LICENSES -export const refresh = async (ctx: any) => { +export const refresh = async (ctx: UserCtx) => { await licensing.cache.refresh() ctx.status = 200 } // USAGE -export const getQuotaUsage = async (ctx: any) => { +export const getQuotaUsage = async ( + ctx: UserCtx +) => { ctx.body = await quotas.getQuotaUsage() ctx.status = 200 }