From 09d5e0b382b06ff4efd2718a4bd25319cdea0cc7 Mon Sep 17 00:00:00 2001 From: Darcy Ye Date: Thu, 20 Jul 2023 14:51:18 +0800 Subject: [PATCH] feat(schemas,console): add planId to TenantInfo --- packages/console/src/contexts/TenantsProvider.tsx | 9 ++++++++- packages/schemas/src/models/tenants.ts | 7 +++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/console/src/contexts/TenantsProvider.tsx b/packages/console/src/contexts/TenantsProvider.tsx index e69192561..5d85b0848 100644 --- a/packages/console/src/contexts/TenantsProvider.tsx +++ b/packages/console/src/contexts/TenantsProvider.tsx @@ -5,6 +5,7 @@ import type { ReactNode } from 'react'; import { useCallback, useMemo, createContext, useState } from 'react'; import { isCloud } from '@/consts/env'; +import { ReservedPlanId } from '@/consts/subscriptions'; import { getUserTenantId } from '@/consts/tenants'; /** @@ -52,7 +53,13 @@ const { tenantId, indicator } = defaultManagementApi.resource; */ const initialTenants = Object.freeze( conditionalArray( - !isCloud && { id: tenantId, name: `tenant_${tenantId}`, tag: TenantTag.Development, indicator } + !isCloud && { + id: tenantId, + name: `tenant_${tenantId}`, + tag: TenantTag.Development, + indicator, + planId: ReservedPlanId.free, + } ) ); diff --git a/packages/schemas/src/models/tenants.ts b/packages/schemas/src/models/tenants.ts index 2c43d4804..2278cb8e5 100644 --- a/packages/schemas/src/models/tenants.ts +++ b/packages/schemas/src/models/tenants.ts @@ -31,8 +31,11 @@ export const Tenants = createModel( export type TenantModel = InferModelType; -export type TenantInfo = Pick & { indicator: string }; +export type TenantInfo = Pick & { + indicator: string; + planId: string; +}; export const tenantInfoGuard = Tenants.guard('model') .pick({ id: true, name: true, tag: true }) - .extend({ indicator: z.string() }); + .extend({ indicator: z.string(), planId: z.string() });