From 2287893bf4ae4a9132529658a5ae30ef3e9ce112 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Sat, 11 Mar 2023 23:00:57 +0100 Subject: [PATCH] Also querying devs when creating def. admin user --- src/backend/model/database/SQLConnection.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/model/database/SQLConnection.ts b/src/backend/model/database/SQLConnection.ts index 97ce343c..1da14657 100644 --- a/src/backend/model/database/SQLConnection.ts +++ b/src/backend/model/database/SQLConnection.ts @@ -125,7 +125,8 @@ export class SQLConnection { // Add dummy Admin to the db const admins = await userRepository.findBy({role: UserRoles.Admin}); - if (admins.length === 0) { + const devs = await userRepository.findBy({role: UserRoles.Developer}); + if (admins.length === 0 && devs.length === 0) { const a = new UserEntity(); a.name = 'admin'; a.password = PasswordHelper.cryptPassword('admin');