Run code clean and fix messages (#45)
All checks were successful
Game Ideas deploy / build-test-deploy (push) Successful in 1m13s

Reviewed-on: #45
This commit was merged in pull request #45.
This commit is contained in:
2025-05-07 01:28:37 +02:00
parent b58ffe10e0
commit 58da2e6843
38 changed files with 150 additions and 155 deletions

View File

@@ -1,5 +1,4 @@
using FluentValidation;
using GameIdeas.BlazorApp.Shared.Components.Select;
using GameIdeas.BlazorApp.Shared.Components.Select.Models;
using GameIdeas.Shared.Dto;
using Microsoft.AspNetCore.Components;

View File

@@ -37,36 +37,36 @@ public class UserGateway(IHttpClientService httpClient) : IUserGateway
public async Task<IEnumerable<RoleDto>> GetRoles()
{
try
{
return await httpClient.FetchDataAsync<IEnumerable<RoleDto>>(Endpoints.User.Roles)
?? throw new InvalidOperationException(ResourcesKey.ErrorFetchRoles);
}
catch (Exception)
{
throw new RoleNotFoundException(ResourcesKey.ErrorFetchRoles);
try
{
return await httpClient.FetchDataAsync<IEnumerable<RoleDto>>(Endpoints.User.Roles)
?? throw new InvalidOperationException(ResourcesKey.ErrorFetchRoles);
}
catch (Exception)
{
throw new RoleNotFoundException(ResourcesKey.ErrorFetchRoles);
}
}
public async Task<UserListDto> GetUsers(UserFilterParams filterParams, int currentPage)
{
try
{
UserFilterDto filter = new()
{
CurrentPage = currentPage,
Name = filterParams.Name,
RoleIds = filterParams.Roles?.Select(r => r.Id)
};
try
{
UserFilterDto filter = new()
{
CurrentPage = currentPage,
Name = filterParams.Name,
RoleIds = filterParams.Roles?.Select(r => r.Id)
};
var url = Endpoints.User.Fetch(filter);
return await httpClient.FetchDataAsync<UserListDto>(url)
?? throw new InvalidOperationException(ResourcesKey.ErrorFetchUsers);
}
catch (Exception)
{
throw new UserNotFoundException(ResourcesKey.ErrorFetchUsers);
}
var url = Endpoints.User.Fetch(filter);
return await httpClient.FetchDataAsync<UserListDto>(url)
?? throw new InvalidOperationException(ResourcesKey.ErrorFetchUsers);
}
catch (Exception)
{
throw new UserNotFoundException(ResourcesKey.ErrorFetchUsers);
}
}
public async Task<IdDto> UpdateUser(UserDto user)

View File

@@ -17,10 +17,10 @@ public partial class Users
private Popup? Popup;
private bool IsLoading = false;
private UserFilterParams FilterParams = new();
private readonly UserFilterParams FilterParams = new();
private UserListDto UserList = new();
private IEnumerable<RoleDto> Roles = [];
private int CurrentPage = 1;
private readonly int CurrentPage = 1;
private UserDto UserAdd = new();
private UserDto? UserDelete;
private string? currentUserId;
@@ -34,7 +34,7 @@ public partial class Users
NavigationManager.NavigateTo("/Unauthorized");
return;
}
await FetchData();
await base.OnInitializedAsync();
@@ -57,7 +57,7 @@ public partial class Users
}
finally
{
IsLoading = false;
IsLoading = false;
}
}