Took care of SonarCloud code issues (#1041)

This commit is contained in:
Joseph Milazzo 2022-02-07 05:30:28 -08:00 committed by GitHub
parent 5b32a958dc
commit 0e2fafe396
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 27 additions and 69 deletions

View file

@ -93,12 +93,9 @@ namespace API.Data
await context.Database.EnsureCreatedAsync();
var users = await context.AppUser.ToListAsync();
foreach (var user in users)
foreach (var user in users.Where(user => string.IsNullOrEmpty(user.ApiKey)))
{
if (string.IsNullOrEmpty(user.ApiKey))
{
user.ApiKey = HashUtil.ApiKey();
}
user.ApiKey = HashUtil.ApiKey();
}
await context.SaveChangesAsync();
}