mirror of
https://github.com/logto-io/logto.git
synced 2025-02-03 21:48:55 -05:00
Generate table metadata
This commit is contained in:
parent
7709f3cb8a
commit
5de0563641
3 changed files with 23 additions and 0 deletions
|
@ -5,7 +5,22 @@ export type OidcModelInstanceDBEntry = {
|
||||||
id: string;
|
id: string;
|
||||||
payload: Record<string, unknown>;
|
payload: Record<string, unknown>;
|
||||||
expiresAt: number;
|
expiresAt: number;
|
||||||
|
consumedAt?: number;
|
||||||
userCode?: string;
|
userCode?: string;
|
||||||
uid?: string;
|
uid?: string;
|
||||||
grantId?: string;
|
grantId?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const OidcModelInstances = {
|
||||||
|
table: 'oidc_model_instances',
|
||||||
|
fields: {
|
||||||
|
modelName: 'model_name',
|
||||||
|
id: 'id',
|
||||||
|
payload: 'payload',
|
||||||
|
expiresAt: 'expires_at',
|
||||||
|
consumedAt: 'consumed_at',
|
||||||
|
userCode: 'user_code',
|
||||||
|
uid: 'uid',
|
||||||
|
grantId: 'grant_id',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
|
@ -95,6 +95,13 @@ const generate = async () => {
|
||||||
)}: ${type}${conditionalString(isArray && '[]')};`
|
)}: ${type}${conditionalString(isArray && '[]')};`
|
||||||
),
|
),
|
||||||
'};',
|
'};',
|
||||||
|
'',
|
||||||
|
`export const ${camelcase(name, { pascalCase: true })} = {`,
|
||||||
|
` table: '${name}',`,
|
||||||
|
` fields: {`,
|
||||||
|
...fields.map(({ name }) => ` ${camelcase(name)}: '${name}',`),
|
||||||
|
` },`,
|
||||||
|
`};`,
|
||||||
].join('\n')
|
].join('\n')
|
||||||
)
|
)
|
||||||
.join('\n') +
|
.join('\n') +
|
||||||
|
|
|
@ -3,6 +3,7 @@ create table oidc_model_instances (
|
||||||
id varchar(128) not null,
|
id varchar(128) not null,
|
||||||
payload jsonb not null,
|
payload jsonb not null,
|
||||||
expires_at bigint not null,
|
expires_at bigint not null,
|
||||||
|
consumed_at bigint,
|
||||||
user_code varchar(128),
|
user_code varchar(128),
|
||||||
uid varchar(128),
|
uid varchar(128),
|
||||||
grant_id varchar(128),
|
grant_id varchar(128),
|
||||||
|
|
Loading…
Add table
Reference in a new issue