From 026f7e48bc73cc6b5c5ea591b07a8d06bcb9dfcd Mon Sep 17 00:00:00 2001 From: Darcy Ye Date: Thu, 10 Oct 2024 11:10:56 +0800 Subject: [PATCH] refactor: align cloud API response type definition (#6665) --- packages/console/src/cloud/types/router.ts | 4 ++-- packages/core/src/utils/subscription/types.ts | 13 +++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/packages/console/src/cloud/types/router.ts b/packages/console/src/cloud/types/router.ts index c96b32347..6d14bee37 100644 --- a/packages/console/src/cloud/types/router.ts +++ b/packages/console/src/cloud/types/router.ts @@ -15,13 +15,13 @@ export type Subscription = GuardedResponse; -/** The response of `GET /api/tenants/my/subscription/quota` has the same response type. */ + export type NewSubscriptionQuota = Omit< NewSubscriptionUsageResponse['quota'], // Since we are deprecation the `organizationsEnabled` key soon (use `organizationsLimit` instead), we exclude it from the quota keys for now to avoid confusion. 'organizationsEnabled' >; -/** The response of `GET /api/tenants/my/subscription/usage` has the same response type. */ + export type NewSubscriptionCountBasedUsage = Omit< NewSubscriptionUsageResponse['usage'], // Since we are deprecation the `organizationsEnabled` key soon (use `organizationsLimit` instead), we exclude it from the usage keys for now to avoid confusion. diff --git a/packages/core/src/utils/subscription/types.ts b/packages/core/src/utils/subscription/types.ts index 1d8dfd104..e5f2153d7 100644 --- a/packages/core/src/utils/subscription/types.ts +++ b/packages/core/src/utils/subscription/types.ts @@ -10,27 +10,20 @@ type RouteResponseType = z.infer>; -export type Subscription = RouteResponseType; +export type Subscription = RouteResponseType; /** - * The type of the response of the `GET /api/tenants/:tenantId/subscription/quota` endpoint. - * It is the same as the response type of `GET /api/tenants/my/subscription/quota` endpoint. - * * @remarks * The `auditLogsRetentionDays` will be handled by cron job in Azure Functions, outdated audit logs will be removed automatically. */ export type SubscriptionQuota = Omit< - RouteResponseType, + RouteResponseType, // Since we are deprecation the `organizationsEnabled` key soon (use `organizationsLimit` instead), we exclude it from the usage keys for now to avoid confusion. 'auditLogsRetentionDays' | 'organizationsEnabled' >; -/** - * The type of the response of the `GET /api/tenants/:tenantId/subscription/usage` endpoint. - * It is the same as the response type of `GET /api/tenants/my/subscription/usage` endpoint. - */ export type SubscriptionUsage = Omit< - RouteResponseType, + RouteResponseType, // Since we are deprecation the `organizationsEnabled` key soon (use `organizationsLimit` instead), we exclude it from the usage keys for now to avoid confusion. 'organizationsEnabled' >;