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

feat: settings DB schema (#165)

* feat: fix settings design schema
This commit is contained in:
Darcy Ye 2022-01-11 11:15:10 +08:00 committed by GitHub
parent bf165644c9
commit 14d8b18c1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 0 deletions

View file

@ -6,5 +6,6 @@ export * from './connector';
export * from './oidc-model-instance';
export * from './resource-scope';
export * from './resource';
export * from './setting';
export * from './user-log';
export * from './user';

View file

@ -0,0 +1,40 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { z } from 'zod';
import {
AdminConsoleConfig,
adminConsoleConfigGuard,
GeneratedSchema,
Guard,
} from '../foundations';
export type SettingDBEntry = {
id: string;
customDomain?: string | null;
adminConsole: AdminConsoleConfig;
};
export type Setting = {
id: string;
customDomain: string | null;
adminConsole: AdminConsoleConfig;
};
const guard: Guard<SettingDBEntry> = z.object({
id: z.string(),
customDomain: z.string().optional(),
adminConsole: adminConsoleConfigGuard,
});
export const Settings: GeneratedSchema<SettingDBEntry> = Object.freeze({
table: 'settings',
tableSingular: 'setting',
fields: {
id: 'id',
customDomain: 'custom_domain',
adminConsole: 'admin_console',
},
fieldKeys: ['id', 'customDomain', 'adminConsole'],
guard,
});

View file

@ -36,3 +36,9 @@ export type UserLogPayload = z.infer<typeof userLogPayloadGuard>;
export const connectorConfigGuard = z.object({});
export type ConnectorConfig = z.infer<typeof connectorConfigGuard>;
export const adminConsoleConfigGuard = z.object({
applicationSkipGetStarted: z.boolean(),
});
export type AdminConsoleConfig = z.infer<typeof adminConsoleConfigGuard>;

View file

@ -0,0 +1,6 @@
create table settings (
id varchar(128) not null,
custom_domain text,
admin_console jsonb /* @use AdminConsoleConfig */ not null,
primary key (id)
);