fix: Add email uniqueness check to admin user seeding process

This commit is contained in:
Ayman
2026-07-08 07:17:39 +01:00
parent 7fbc2ea737
commit 2f5252faad
2 changed files with 17 additions and 2 deletions
+6
View File
@@ -76,6 +76,12 @@ exports.seed = async (knex) => {
);
}
const existingEmailUser = await knex('user_account').where('email', defaultAdminEmail).first();
if (existingEmailUser) {
throw new Error(`User with DEFAULT_ADMIN_EMAIL "${defaultAdminEmail}" already exists.`);
}
const userData = buildUserData();
if (userData.username) {