From fbd8498c25951e6935d15e517ee5ba2332853b87 Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Sun, 4 Jul 2021 17:22:59 +0800 Subject: [PATCH] feat: add `fieldKeys` in generated const --- packages/schemas/src/db-entries/oidc-model-instance.ts | 10 ++++++++++ packages/schemas/src/db-entries/user.ts | 9 +++++++++ packages/schemas/src/gen/index.ts | 3 +++ 3 files changed, 22 insertions(+) diff --git a/packages/schemas/src/db-entries/oidc-model-instance.ts b/packages/schemas/src/db-entries/oidc-model-instance.ts index 125511f47..a083c08eb 100644 --- a/packages/schemas/src/db-entries/oidc-model-instance.ts +++ b/packages/schemas/src/db-entries/oidc-model-instance.ts @@ -23,4 +23,14 @@ export const OidcModelInstances = Object.freeze({ uid: 'uid', grantId: 'grant_id', }, + fieldKeys: [ + 'modelName', + 'id', + 'payload', + 'expiresAt', + 'consumedAt', + 'userCode', + 'uid', + 'grantId', + ], } as const); diff --git a/packages/schemas/src/db-entries/user.ts b/packages/schemas/src/db-entries/user.ts index 4afd6f685..ff31190e9 100644 --- a/packages/schemas/src/db-entries/user.ts +++ b/packages/schemas/src/db-entries/user.ts @@ -23,4 +23,13 @@ export const Users = Object.freeze({ passwordEncryptionMethod: 'password_encryption_method', passwordEncryptionSalt: 'password_encryption_salt', }, + fieldKeys: [ + 'id', + 'userName', + 'primaryEmail', + 'primaryPhone', + 'passwordEncrypted', + 'passwordEncryptionMethod', + 'passwordEncryptionSalt', + ], } as const); diff --git a/packages/schemas/src/gen/index.ts b/packages/schemas/src/gen/index.ts index 42f33c8a5..56b460f71 100644 --- a/packages/schemas/src/gen/index.ts +++ b/packages/schemas/src/gen/index.ts @@ -194,6 +194,9 @@ const generate = async () => { ' fields: {', ...fields.map(({ name }) => ` ${camelcase(name)}: '${name}',`), ' },', + ' fieldKeys: [', + ...fields.map(({ name }) => ` '${camelcase(name)}',`), + ' ],', '} as const);', ].join('\n') )