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

feat: add fieldKeys in generated const

This commit is contained in:
Gao Sun 2021-07-04 17:22:59 +08:00
parent 1b0cce6de9
commit fbd8498c25
No known key found for this signature in database
GPG key ID: 0F0EFA2E36639F31
3 changed files with 22 additions and 0 deletions

View file

@ -23,4 +23,14 @@ export const OidcModelInstances = Object.freeze({
uid: 'uid', uid: 'uid',
grantId: 'grant_id', grantId: 'grant_id',
}, },
fieldKeys: [
'modelName',
'id',
'payload',
'expiresAt',
'consumedAt',
'userCode',
'uid',
'grantId',
],
} as const); } as const);

View file

@ -23,4 +23,13 @@ export const Users = Object.freeze({
passwordEncryptionMethod: 'password_encryption_method', passwordEncryptionMethod: 'password_encryption_method',
passwordEncryptionSalt: 'password_encryption_salt', passwordEncryptionSalt: 'password_encryption_salt',
}, },
fieldKeys: [
'id',
'userName',
'primaryEmail',
'primaryPhone',
'passwordEncrypted',
'passwordEncryptionMethod',
'passwordEncryptionSalt',
],
} as const); } as const);

View file

@ -194,6 +194,9 @@ const generate = async () => {
' fields: {', ' fields: {',
...fields.map(({ name }) => ` ${camelcase(name)}: '${name}',`), ...fields.map(({ name }) => ` ${camelcase(name)}: '${name}',`),
' },', ' },',
' fieldKeys: [',
...fields.map(({ name }) => ` '${camelcase(name)}',`),
' ],',
'} as const);', '} as const);',
].join('\n') ].join('\n')
) )