Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
ProjectsStatusManagement
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hasan.bahjat
ProjectsStatusManagement
Commits
6628ae95
Commit
6628ae95
authored
Jul 13, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restruture application layer.
parent
be66bb06
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
164 additions
and
10 deletions
+164
-10
ICommand.cs
PSManagement.Application/Abstraction/Messaging/ICommand.cs
+8
-0
ICommandHandler.cs
...ment.Application/Abstraction/Messaging/ICommandHandler.cs
+9
-0
IQuery.cs
PSManagement.Application/Abstraction/Messaging/IQuery.cs
+8
-0
IQueryHandler.cs
...gement.Application/Abstraction/Messaging/IQueryHandler.cs
+9
-0
ValidationBehavior.cs
...cation/Behaviors/ValidationBehavior/ValidationBehavior.cs
+55
-0
Class1.cs
PSManagement.Application/Class1.cs
+0
-8
ValidtaitonException.cs
...ent.Application/Common/Exceptions/ValidtaitonException.cs
+14
-0
IDateTimeProvider.cs
...agement.Application/Common/Providers/IDateTimeProvider.cs
+13
-0
AuthenticationResult.cs
...lication/Contracts/Authentication/AuthenticationResult.cs
+18
-0
IAuthenticationService.cs
...cation/Contracts/Authentication/IAuthenticationService.cs
+14
-0
IJwtTokenGenerator.cs
...pplication/Contracts/Authentication/IJwtTokenGenerator.cs
+9
-0
DependencyInjection.cs
PSManagement.Application/DI/DependencyInjection.cs
+1
-0
PSManagement.Application.csproj
PSManagement.Application/PSManagement.Application.csproj
+6
-2
No files found.
PSManagement.Application/Abstraction/Messaging/ICommand.cs
0 → 100644
View file @
6628ae95
using
MediatR
;
namespace
PSManagement.Application.Abstraction.Messaging
{
public
interface
ICommand
<
out
TResponse
>
:
IRequest
<
TResponse
>
{
}
}
PSManagement.Application/Abstraction/Messaging/ICommandHandler.cs
0 → 100644
View file @
6628ae95
using
MediatR
;
namespace
PSManagement.Application.Abstraction.Messaging
{
public
interface
ICommandHandler
<
in
TCommand
,
TResponse
>
:
IRequestHandler
<
TCommand
,
TResponse
>
where
TCommand
:
ICommand
<
TResponse
>
{
}
}
PSManagement.Application/Abstraction/Messaging/IQuery.cs
0 → 100644
View file @
6628ae95
using
MediatR
;
namespace
PSManagement.Application.Abstraction.Messaging
{
public
interface
IQuery
<
out
TResponse
>
:
IRequest
<
TResponse
>
{
}
}
PSManagement.Application/Abstraction/Messaging/IQueryHandler.cs
0 → 100644
View file @
6628ae95
using
MediatR
;
namespace
PSManagement.Application.Abstraction.Messaging
{
public
interface
IQueryHandler
<
in
TQuery
,
TResponse
>
:
IRequestHandler
<
TQuery
,
TResponse
>
where
TQuery
:
IQuery
<
TResponse
>
{
}
}
PSManagement.Application/Behaviors/ValidationBehavior/ValidationBehavior.cs
0 → 100644
View file @
6628ae95
using
MediatR
;
using
PSManagement.Application.Abstraction.Messaging
;
using
PSManagement.Application.Common.Exceptions
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
ValidationException
=
PSManagement
.
Application
.
Common
.
Exceptions
.
ValidationException
;
namespace
PSManagement.Application.Behaviors.ValidationBehavior
{
public
sealed
class
ValidationBehavior
<
TRequest
,
TResponse
>
//: IPipelineBehavior<TRequest, TResponse>
// where TRequest : class, ICommand<TResponse>
{
//private readonly IEnumerable<IValidator<TRequest>> _validators;
//public ValidationBehavior(IEnumerable<IValidator<TRequest>> validators) => _validators = validators;
//public async Task<TResponse> Handle(
// TRequest request,
// CancellationToken cancellationToken,
// RequestHandlerDelegate<TResponse> next)
//{
// if (!_validators.Any())
// {
// return await next();
// }
// var context = new ValidationContext<TRequest>(request);
// var errorsDictionary = _validators
// .Select(x => x.Validate(context))
// .SelectMany(x => x.Errors)
// .Where(x => x != null)
// .GroupBy(
// x => x.PropertyName,
// x => x.ErrorMessage,
// (propertyName, errorMessages) => new
// {
// Key = propertyName,
// Values = errorMessages.Distinct().ToArray()
// })
// .ToDictionary(x => x.Key, x => x.Values);
// if (errorsDictionary.Any())
// {
// throw new ValidationException(errorsDictionary);
// }
// return await next();
//}
}
}
PSManagement.Application/Class1.cs
deleted
100644 → 0
View file @
be66bb06
using
System
;
namespace
PSManagement.Application
{
public
class
Class1
{
}
}
PSManagement.Application/Common/Exceptions/ValidtaitonException.cs
0 → 100644
View file @
6628ae95
using
PSManagement.SharedKernel.DomainException
;
using
System.Collections.Generic
;
namespace
PSManagement.Application.Common.Exceptions
{
public
sealed
class
ValidationException
:
BadRequestException
{
public
ValidationException
(
Dictionary
<
string
,
string
[
]>
errors
)
:
base
(
"Validation errors occurred"
)
=>
Errors
=
errors
;
public
Dictionary
<
string
,
string
[
]>
Errors
{
get
;
}
}
}
PSManagement.Application/Common/Providers/IDateTimeProvider.cs
0 → 100644
View file @
6628ae95
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Application.Common.Services
{
public
interface
IDateTimeProvider
{
public
DateTime
UtcNow
{
get
;
}
}
}
PSManagement.Application/Contracts/Authentication/AuthenticationResult.cs
0 → 100644
View file @
6628ae95
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Application.Contracts.Authentication
{
public
class
AuthenticationResult
{
public
Guid
Id
{
get
;
set
;
}
public
String
Email
{
get
;
set
;
}
public
String
LastName
{
get
;
set
;
}
public
String
FirstName
{
get
;
set
;
}
public
String
Token
{
get
;
set
;
}
}
}
PSManagement.Application/Contracts/Authentication/IAuthenticationService.cs
0 → 100644
View file @
6628ae95
using
System
;
using
System.Threading.Tasks
;
namespace
PSManagement.Application.Contracts.Authentication
{
public
interface
IAuthenticationService
{
public
Task
<
AuthenticationResult
>
Login
(
String
email
,
String
password
);
public
Task
<
AuthenticationResult
>
Register
(
String
email
,
String
firstName
,
String
lastName
,
String
password
);
}
}
PSManagement.Application/Contracts/Authentication/IJwtTokenGenerator.cs
0 → 100644
View file @
6628ae95
using
System
;
namespace
PSManagement.Application.Contracts.Authentication
{
public
interface
IJwtTokenGenerator
{
public
String
GenerateToken
(
Guid
id
,
String
firstName
,
String
lastName
,
String
email
);
}
}
PSManagement.Application/DI/DependencyInjection.cs
View file @
6628ae95
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
PSManagement.Application.Contracts.Authentication
;
namespace
PSManagement.Application.DI
{
...
...
PSManagement.Application/PSManagement.Application.csproj
View file @
6628ae95
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="Common\" />
<Folder Include="Services\" />
<Folder Include="UseCases\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="5.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PSManagement.SharedKernel\PSManagement.SharedKernel.csproj" />
</ItemGroup>
</Project>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment