0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

feat(schemas,console): add planId to TenantInfo

This commit is contained in:
Darcy Ye 2023-07-20 14:51:18 +08:00
parent a1214d2eb6
commit 09d5e0b382
No known key found for this signature in database
GPG key ID: B46F4C07EDEFC610
2 changed files with 13 additions and 3 deletions

View file

@ -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,
}
)
);

View file

@ -31,8 +31,11 @@ export const Tenants = createModel(
export type TenantModel = InferModelType<typeof Tenants>;
export type TenantInfo = Pick<TenantModel, 'id' | 'name' | 'tag'> & { indicator: string };
export type TenantInfo = Pick<TenantModel, 'id' | 'name' | 'tag'> & {
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() });