diff --git a/src/lib/db/access-store.ts b/src/lib/db/access-store.ts index 1649c82d2c..bf55ee7b91 100644 --- a/src/lib/db/access-store.ts +++ b/src/lib/db/access-store.ts @@ -181,7 +181,7 @@ export class AccessStore implements IAccessStore { environment: permission.environment, }; }); - this.db.batchInsert(T.ROLE_PERMISSION, rows); + await this.db.batchInsert(T.ROLE_PERMISSION, rows); } async unlinkUserRoles(userId: number): Promise { diff --git a/src/lib/db/event-store.test.ts b/src/lib/db/event-store.test.ts index d737caf8ab..849703b49d 100644 --- a/src/lib/db/event-store.test.ts +++ b/src/lib/db/event-store.test.ts @@ -2,6 +2,14 @@ import knex from 'knex'; import EventStore from './event-store'; import getLogger from '../../test/fixtures/no-logger'; +beforeAll(() => { + getLogger.setMuteError(true); +}); + +afterAll(() => { + getLogger.setMuteError(false); +}); + test('Trying to get events if db fails should yield empty list', async () => { const db = knex({ client: 'pg', diff --git a/src/lib/services/access-service.ts b/src/lib/services/access-service.ts index 065c2b34cc..b499a79c7e 100644 --- a/src/lib/services/access-service.ts +++ b/src/lib/services/access-service.ts @@ -406,7 +406,7 @@ export class AccessService { const rolePermissions = role.permissions; const newRole = await this.roleStore.create(baseRole); if (rolePermissions) { - this.store.addEnvironmentPermissionsToRole( + await this.store.addEnvironmentPermissionsToRole( newRole.id, rolePermissions, ); @@ -425,8 +425,8 @@ export class AccessService { const rolePermissions = role.permissions; const newRole = await this.roleStore.update(baseRole); if (rolePermissions) { - this.store.wipePermissionsFromRole(newRole.id); - this.store.addEnvironmentPermissionsToRole( + await this.store.wipePermissionsFromRole(newRole.id); + await this.store.addEnvironmentPermissionsToRole( newRole.id, rolePermissions, ); diff --git a/src/lib/services/feature-toggle-service.ts b/src/lib/services/feature-toggle-service.ts index 515fd0a645..becafa1970 100644 --- a/src/lib/services/feature-toggle-service.ts +++ b/src/lib/services/feature-toggle-service.ts @@ -197,7 +197,7 @@ class FeatureToggleService { } if (oneOf(DATE_OPERATORS, operator)) { - validateDate(constraint.value); + await validateDate(constraint.value); } if (