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:
parent
a1214d2eb6
commit
09d5e0b382
2 changed files with 13 additions and 3 deletions
|
@ -5,6 +5,7 @@ import type { ReactNode } from 'react';
|
||||||
import { useCallback, useMemo, createContext, useState } from 'react';
|
import { useCallback, useMemo, createContext, useState } from 'react';
|
||||||
|
|
||||||
import { isCloud } from '@/consts/env';
|
import { isCloud } from '@/consts/env';
|
||||||
|
import { ReservedPlanId } from '@/consts/subscriptions';
|
||||||
import { getUserTenantId } from '@/consts/tenants';
|
import { getUserTenantId } from '@/consts/tenants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,7 +53,13 @@ const { tenantId, indicator } = defaultManagementApi.resource;
|
||||||
*/
|
*/
|
||||||
const initialTenants = Object.freeze(
|
const initialTenants = Object.freeze(
|
||||||
conditionalArray(
|
conditionalArray(
|
||||||
!isCloud && { id: tenantId, name: `tenant_${tenantId}`, tag: TenantTag.Development, indicator }
|
!isCloud && {
|
||||||
|
id: tenantId,
|
||||||
|
name: `tenant_${tenantId}`,
|
||||||
|
tag: TenantTag.Development,
|
||||||
|
indicator,
|
||||||
|
planId: ReservedPlanId.free,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,11 @@ export const Tenants = createModel(
|
||||||
|
|
||||||
export type TenantModel = InferModelType<typeof Tenants>;
|
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')
|
export const tenantInfoGuard = Tenants.guard('model')
|
||||||
.pick({ id: true, name: true, tag: true })
|
.pick({ id: true, name: true, tag: true })
|
||||||
.extend({ indicator: z.string() });
|
.extend({ indicator: z.string(), planId: z.string() });
|
||||||
|
|
Loading…
Reference in a new issue