chore(codebase): full cleanup pass

This commit is contained in:
2025-06-21 01:58:48 -04:00
parent 8323477cd0
commit 81b5db34ef
92 changed files with 529 additions and 452 deletions

View File

@@ -10,19 +10,22 @@ public class IdentityService(
{
public async Task<UserModel?> GetCurrentUserAsync()
{
var currentUserId = contextAccessor.HttpContext?.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
string? currentUserId = contextAccessor.HttpContext?.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
if (string.IsNullOrEmpty(currentUserId))
{
return null;
}
UserModel? ret;
var user = await userManager.FindByIdAsync(currentUserId);
User? user = await userManager.FindByIdAsync(currentUserId);
if (user == null) ret = null;
if (user == null)
{
ret = null;
}
else
{
var userModel = new UserModel
UserModel userModel = new()
{
Id = user.Id,
Username = user.UserName ?? string.Empty,
@@ -44,17 +47,22 @@ public class IdentityService(
public async Task<IList<string>> GetCurrentUserRolesAsync()
{
var currentUserModel = await GetCurrentUserAsync();
UserModel? currentUserModel = await GetCurrentUserAsync();
if (currentUserModel is null) return [];
var currentUser = await userManager.FindByIdAsync(currentUserModel.Id.ToString());
if (currentUserModel is null)
{
return [];
}
if (currentUser is null) return [];
User? currentUser = await userManager.FindByIdAsync(currentUserModel.Id.ToString());
var userRoles = await userManager.GetRolesAsync(currentUser);
if (currentUser is null)
{
return [];
}
IList<string> userRoles = await userManager.GetRolesAsync(currentUser);
return userRoles;
}
}