#48 cleaned userService. We will use IdentityService only
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Hutopy.Application.Common.Interfaces;
|
||||
using Hutopy.Domain.Interfaces;
|
||||
|
||||
namespace Hutopy.Application.Users.Queries.GetCurrentUser;
|
||||
|
||||
@@ -8,13 +7,13 @@ public record GetCurrentUserQuery : IRequest<UserDto>;
|
||||
public class GetCurrentUserQueryHandler(
|
||||
IApplicationDbContext context,
|
||||
IMapper mapper,
|
||||
IUserService userService
|
||||
IIdentityService identityService
|
||||
)
|
||||
: IRequestHandler<GetCurrentUserQuery, UserDto>
|
||||
{
|
||||
public async Task<UserDto> Handle(GetCurrentUserQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var identityUser = await userService.GetCurrentUserAsync();
|
||||
var identityUser = await identityService.GetCurrentUserAsync();
|
||||
var currentUserId = new Guid(identityUser?.Id ?? "");
|
||||
|
||||
var transactions = await context.UserTransactions
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Hutopy.Domain.Interfaces;
|
||||
using Hutopy.Application.Common.Interfaces;
|
||||
|
||||
namespace Hutopy.Application.Users.Queries.GetMinimalUser;
|
||||
|
||||
@@ -8,15 +8,15 @@ public record GetMinimalUserQuery : IRequest<MinimalUserDto>
|
||||
};
|
||||
|
||||
public class GetMinimalUserQueryHandler(
|
||||
IUserService userService
|
||||
IIdentityService identityService
|
||||
)
|
||||
: IRequestHandler<GetMinimalUserQuery, MinimalUserDto>
|
||||
{
|
||||
public async Task<MinimalUserDto> Handle(GetMinimalUserQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var identityUser = await userService.FindUserByIdAsync(request.UserId);
|
||||
var identityUser = await identityService.FindUserByIdAsync(request.UserId);
|
||||
|
||||
var user = new MinimalUserDto()
|
||||
var user = new MinimalUserDto
|
||||
{
|
||||
FirstName = identityUser?.FirstName ?? "",
|
||||
LastName = identityUser?.LastName ?? "",
|
||||
|
||||
Reference in New Issue
Block a user