Commit 1ea86041 authored by hasan khaddour's avatar hasan khaddour

Refactor.

parent 1551faff
using MediatR;
namespace PSManagement.Application.Abstraction.Messaging
{
public interface ICommand<out TResponse> : IRequest<TResponse>
{
}
}
using MediatR;
namespace PSManagement.Application.Abstraction.Messaging
{
public interface ICommandHandler<in TCommand, TResponse> : IRequestHandler<TCommand, TResponse>
where TCommand : ICommand<TResponse>
{
}
}
using MediatR;
namespace PSManagement.Application.Abstraction.Messaging
{
public interface IQuery<out TResponse> : IRequest<TResponse>
{
}
}
using MediatR;
namespace PSManagement.Application.Abstraction.Messaging
{
public interface IQueryHandler<in TQuery, TResponse> : IRequestHandler<TQuery, TResponse>
where TQuery : IQuery<TResponse>
{
}
}
using MediatR; using MediatR;
using PSManagement.Application.Abstraction.Messaging;
using PSManagement.Application.Common.Exceptions; using PSManagement.Application.Common.Exceptions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
......
...@@ -8,7 +8,7 @@ namespace PSManagement.Application.Contracts.Authentication ...@@ -8,7 +8,7 @@ namespace PSManagement.Application.Contracts.Authentication
{ {
public class AuthenticationResult public class AuthenticationResult
{ {
public Guid Id { get; set; } public int Id { get; set; }
public String Email { get; set; } public String Email { get; set; }
public String LastName { get; set; } public String LastName { get; set; }
public String FirstName { get; set; } public String FirstName { get; set; }
......
using System; using PSManagement.SharedKernel.Utilities;
using System;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace PSManagement.Application.Contracts.Authentication namespace PSManagement.Application.Contracts.Authentication
{ {
public interface IAuthenticationService public interface IAuthenticationService
{ {
public Task<AuthenticationResult> Login(String email , String password); public Task<Result<AuthenticationResult>> Login(String email , String password);
public Task<AuthenticationResult> Register(String email,String firstName ,String lastName, String password); public Task<Result<AuthenticationResult>> Register(String email,String firstName ,String lastName, String password);
} }
......
using PSManagement.SharedKernel.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Application.Contracts.Authentication
{
public interface IUsersRepository : IRepository<User>
{
public Task<User> GetByEmail(String email);
}
}
using PSManagement.SharedKernel.Entities;
using System;
namespace PSManagement.Application.Contracts.Authentication
{
public class User :BaseEntity
{
public String Email { get; set; }
public String LastName { get; set; }
public String FirstName { get; set; }
public String Password { get; set; }
public String Token { get; set; }
}
}
\ No newline at end of file
using System; using System;
namespace PSManagement.Application.Contracts.Authentication namespace PSManagement.Application.Contracts.Authorization
{ {
public interface IJwtTokenGenerator public interface IJwtTokenGenerator
{ {
public String GenerateToken(Guid id , String firstName , String lastName,String email ); public String GenerateToken(int id , String firstName , String lastName,String email );
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Application.Contracts.Email
{
public interface IEmailService
{
Task SendAsync(String recipient, String subject, String body);
}
}
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Abstraction\" />
<Folder Include="Behaviors\AuthorizationBehavior\" />
<Folder Include="Services\" /> <Folder Include="Services\" />
<Folder Include="UseCases\" /> <Folder Include="UseCases\" />
</ItemGroup> </ItemGroup>
......
...@@ -7,7 +7,7 @@ using System.Threading.Tasks; ...@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace PSManagement.Contracts.Authentication namespace PSManagement.Contracts.Authentication
{ {
public record AuthenticationResponse( public record AuthenticationResponse(
Guid Id , int Id ,
String FirstName, String FirstName,
String LastName , String LastName ,
String Email , String Email ,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment