From 6e2e75e21b59a81dcb6a4ad6709445828b991c7a Mon Sep 17 00:00:00 2001 From: chronark Date: Wed, 4 Sep 2024 08:58:50 +0200 Subject: [PATCH] refactor(v1_keys_createKey.ts): improve code formatting for inserting role and permission mappings into the database --- apps/api/src/routes/v1_keys_createKey.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/api/src/routes/v1_keys_createKey.ts b/apps/api/src/routes/v1_keys_createKey.ts index 491a397b95..006feb7caf 100644 --- a/apps/api/src/routes/v1_keys_createKey.ts +++ b/apps/api/src/routes/v1_keys_createKey.ts @@ -413,21 +413,21 @@ export const registerV1KeysCreateKey = (app: App) => await Promise.all([ roleIds.length > 0 ? db.primary.insert(schema.keysRoles).values( - roleIds.map((roleId) => ({ - keyId: newKey.id, - roleId, - workspaceId: authorizedWorkspaceId, - })), - ) + roleIds.map((roleId) => ({ + keyId: newKey.id, + roleId, + workspaceId: authorizedWorkspaceId, + })), + ) : Promise.resolve(), permissionIds.length > 0 ? db.primary.insert(schema.keysPermissions).values( - permissionIds.map((permissionId) => ({ - keyId: newKey.id, - permissionId, - workspaceId: authorizedWorkspaceId, - })), - ) + permissionIds.map((permissionId) => ({ + keyId: newKey.id, + permissionId, + workspaceId: authorizedWorkspaceId, + })), + ) : Promise.resolve(), ]);