-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from LibardiFelipe/teste
Teste
- Loading branch information
Showing
81 changed files
with
758 additions
and
1,689 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[*.cs] | ||
|
||
# CS8618: O campo não anulável precisa conter um valor não nulo ao sair do construtor. Considere declará-lo como anulável. | ||
dotnet_diagnostic.CS8618.severity = none |
34 changes: 0 additions & 34 deletions
34
TemplateBase.Application/Commands/Auth/AuthCommandHandler.cs
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
TemplateBase.Application/Commands/Auth/UserLoginCommand.cs
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
TemplateBase.Application/Commands/TemplatesEmail/CreateEmailTemplateCommand.cs
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
TemplateBase.Application/Commands/TemplatesEmail/DeleteEmailTemplateCommand.cs
This file was deleted.
Oops, something went wrong.
62 changes: 0 additions & 62 deletions
62
TemplateBase.Application/Commands/TemplatesEmail/EmailTemplateCommandHandler.cs
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
TemplateBase.Application/Commands/TemplatesEmail/UpdateTemplateEmailCommand.cs
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
TemplateBase.Application/Commands/Users/RegisterUserCommand.cs
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
TemplateBase.Application/Commands/Users/SetupUserCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.Collections.Generic; | ||
using System.Security.Claims; | ||
using TemplateBase.Application.Commands.Base; | ||
|
||
namespace TemplateBase.Application.Commands.Users | ||
{ | ||
public class SetupUserCommand : Command | ||
{ | ||
public SetupUserCommand(IEnumerable<Claim> claims) | ||
{ | ||
Claims = claims; | ||
} | ||
|
||
public IEnumerable<Claim> Claims { get; private set; } | ||
|
||
public override void Validate() | ||
{ | ||
|
||
} | ||
} | ||
} |
38 changes: 11 additions & 27 deletions
38
TemplateBase.Application/Commands/Users/UserCommandHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,34 @@ | ||
using MediatR; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using TemplateBase.Application.Commands.Auth; | ||
using TemplateBase.Application.Commands.Base; | ||
using TemplateBase.Application.Models; | ||
using TemplateBase.Domain.Resources; | ||
using TemplateBase.Domain.Services.Contracts; | ||
|
||
namespace TemplateBase.Application.Commands.Persons | ||
namespace TemplateBase.Application.Commands.Users | ||
{ | ||
public class UserCommandHandler : CommandHandler, | ||
IRequestHandler<RegisterUserCommand, Result>, | ||
IRequestHandler<VerifyUserCommand, Result> | ||
IRequestHandler<SetupUserCommand, Result> | ||
{ | ||
private readonly IUserService _userService; | ||
private readonly IUserService _userServices; | ||
|
||
public UserCommandHandler(IUserService userService) | ||
public UserCommandHandler(IUserService userServices) | ||
{ | ||
_userService = userService; | ||
_userServices = userServices; | ||
} | ||
|
||
public async Task<Result> Handle(RegisterUserCommand request, CancellationToken cancellationToken) | ||
public async Task<Result> Handle(SetupUserCommand request, CancellationToken cancellationToken) | ||
{ | ||
if (request.IsInvalid()) | ||
return new Result(DefaultMessages.Handler_ComandoInvalido, false, request.Notifications); | ||
return new Result(Mensagens.Handler_ComandoInvalido, false, request.Notifications); | ||
|
||
var entity = await _userService.RegisterUserAsync(request.Name, request.Email, | ||
request.Password, request.BirthDate, request.ProfilePicture, cancellationToken); | ||
var entity = await _userServices.SetupUserAsync(request.Claims, cancellationToken); | ||
|
||
if (_userService.IsInvalid()) | ||
return new Result(DefaultMessages.Handler_FalhaAoExecutarComando, false, _userService.GetNotifications()); | ||
if (_userServices.IsInvalid()) | ||
return new Result(Mensagens.Handler_FalhaAoExecutarComando, false, _userServices.GetNotifications()); | ||
|
||
return new Result(DefaultMessages.Handler_ComandoExecutado, true, entity); | ||
} | ||
|
||
public async Task<Result> Handle(VerifyUserCommand request, CancellationToken cancellationToken) | ||
{ | ||
if (request.IsInvalid()) | ||
return new Result(DefaultMessages.Handler_ComandoInvalido, false, request.Notifications); | ||
|
||
var entity = await _userService.VerifyUserAsync(request.Hash, cancellationToken); | ||
|
||
if (_userService.IsInvalid()) | ||
return new Result(DefaultMessages.Handler_FalhaAoExecutarComando, false, _userService.GetNotifications()); | ||
|
||
return new Result(DefaultMessages.Handler_ComandoExecutado, true, entity); | ||
return new Result(Mensagens.Handler_ComandoExecutado, true, entity); | ||
} | ||
} | ||
} |
23 changes: 0 additions & 23 deletions
23
TemplateBase.Application/Commands/Users/VerifyUserCommand.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.