mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -05:00
fix(schemas): set domain status enum guard (#3958)
This commit is contained in:
parent
d13cb277eb
commit
62d3acfc7b
4 changed files with 17 additions and 10 deletions
|
@ -1,4 +1,9 @@
|
|||
import { type CloudflareData, type Domain, type DomainResponse } from '@logto/schemas';
|
||||
import {
|
||||
DomainStatus,
|
||||
type CloudflareData,
|
||||
type Domain,
|
||||
type DomainResponse,
|
||||
} from '@logto/schemas';
|
||||
|
||||
export const mockNanoIdForDomain = 'random_string';
|
||||
|
||||
|
@ -9,7 +14,7 @@ export const mockTenantIdForHook = 'fake_tenant';
|
|||
export const mockDomainResponse: DomainResponse = {
|
||||
id: mockNanoIdForDomain,
|
||||
domain: 'logto.example.com',
|
||||
status: 'pending',
|
||||
status: DomainStatus.PendingVerification,
|
||||
errorMessage: null,
|
||||
dnsRecords: [],
|
||||
};
|
||||
|
|
|
@ -266,3 +266,12 @@ export const cloudflareDataGuard = z
|
|||
.catchall(z.unknown());
|
||||
|
||||
export type CloudflareData = z.infer<typeof cloudflareDataGuard>;
|
||||
|
||||
export enum DomainStatus {
|
||||
PendingVerification = 'PendingVerification',
|
||||
PendingSsl = 'PendingSsl',
|
||||
Active = 'Active',
|
||||
Error = 'Error',
|
||||
}
|
||||
|
||||
export const domainStatusGuard = z.nativeEnum(DomainStatus);
|
||||
|
|
|
@ -19,10 +19,3 @@ export const domainResponseGuard = Domains.guard.pick({
|
|||
});
|
||||
|
||||
export type DomainResponse = z.infer<typeof domainResponseGuard>;
|
||||
|
||||
export enum DomainStatus {
|
||||
PendingVerification = 'PendingVerification',
|
||||
PendingSsl = 'PendingSsl',
|
||||
Active = 'Active',
|
||||
Error = 'Error',
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ create table domains (
|
|||
references tenants (id) on update cascade on delete cascade,
|
||||
id varchar(21) not null,
|
||||
domain varchar(256) not null,
|
||||
status varchar(32) not null default('PendingVerification'),
|
||||
status varchar(32) /* @use DomainStatus */ not null default('PendingVerification'),
|
||||
error_message varchar(1024),
|
||||
dns_records jsonb /* @use DomainDnsRecords */ not null default '[]'::jsonb,
|
||||
cloudflare_data jsonb /* @use CloudflareData */,
|
||||
|
|
Loading…
Add table
Reference in a new issue