#48 cleaned userService. We will use IdentityService only
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
using System.Dynamic;
|
||||
using Hutopy.Application.Common.Interfaces;
|
||||
using Hutopy.Domain.Entities;
|
||||
using Hutopy.Domain.Interfaces;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Hutopy.Application.Common.Interfaces;
|
||||
|
||||
namespace Hutopy.Application.Users.Commands;
|
||||
public record CreateUserCommand : IRequest<Guid>
|
||||
@@ -17,24 +13,20 @@ public record CreateUserCommand : IRequest<Guid>
|
||||
public class CreateUserCommandHandler : IRequestHandler<CreateUserCommand, Guid>
|
||||
{
|
||||
private readonly IApplicationDbContext _context;
|
||||
private readonly IUserService _userService;
|
||||
private readonly IIdentityService _identityService;
|
||||
|
||||
public CreateUserCommandHandler(IApplicationDbContext context, IUserService userService)
|
||||
public CreateUserCommandHandler(IApplicationDbContext context, IIdentityService identityService)
|
||||
{
|
||||
_context = context;
|
||||
_userService = userService;
|
||||
_identityService = identityService;
|
||||
}
|
||||
|
||||
public async Task<Guid> Handle(CreateUserCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
// Dont really need the handler for the create. The get will work like this :
|
||||
var user = await _userService.FindUserByIdAsync("072ae7d5-8c4a-4a0f-b250-7d39941125cb");
|
||||
// var user2 = await _userService.FindUserByEmailAsync("test10@hotmail.com");
|
||||
|
||||
var tt = user?.FirstName;
|
||||
var user = await _identityService.FindUserByEmailAsync(request.EmailAddress);
|
||||
|
||||
await _context.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return Guid.NewGuid();
|
||||
return new Guid(user?.Id ?? string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user