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
89ab6587
Commit
89ab6587
authored
Jul 26, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cqrs for cutomers domain
parent
86ff4de9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
16 deletions
+61
-16
User.cs
PSManagement.Application/Contracts/Authentication/User.cs
+0
-15
CreateCustomerCommand.cs
...UseCases/Commands/CreateCustomer/CreateCustomerCommand.cs
+18
-0
CreateCustomerCommandHandler.cs
...s/Commands/CreateCustomer/CreateCustomerCommandHandler.cs
+30
-0
CreateCustomerCommandValidator.cs
...Commands/CreateCustomer/CreateCustomerCommandValidator.cs
+12
-0
PSManagement.Application.csproj
PSManagement.Application/PSManagement.Application.csproj
+1
-1
No files found.
PSManagement.Application/Contracts/Authentication/User.cs
deleted
100644 → 0
View file @
86ff4de9
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
PSManagement.Application/Customers/UseCases/Commands/CreateCustomer/CreateCustomerCommand.cs
0 → 100644
View file @
89ab6587
using
FluentResults
;
using
PSManagement.Domain.Customers.Aggregate
;
using
PSManagement.Domain.Customers.ValueObjects
;
using
PSManagement.SharedKernel.CQRS.Command
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Application.Customers.UseCases.Commands.CreateCustomer
{
public
record
CreateCustomerCommand
(
String
CustomerName
,
Address
Address
)
:
ICommand
<
Result
<
int
>>;
}
PSManagement.Application/Customers/UseCases/Commands/CreateCustomer/CreateCustomerCommandHandler.cs
0 → 100644
View file @
89ab6587
using
FluentResults
;
using
PSManagement.Domain.Customers.Aggregate
;
using
PSManagement.Domain.Customers.Repositories
;
using
PSManagement.SharedKernel.CQRS.Command
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
PSManagement.Application.Customers.UseCases.Commands.CreateCustomer
{
public
class
CreateCustomerCommandHandler
:
ICommandHandler
<
CreateCustomerCommand
,
Result
<
int
>>
{
private
readonly
ICustomersRepository
_customerRepository
;
public
CreateCustomerCommandHandler
()
{
}
public
async
Task
<
Result
<
int
>>
Handle
(
CreateCustomerCommand
request
,
CancellationToken
cancellationToken
)
{
Customer
customer
=
new
Customer
(
request
.
CustomerName
,
request
.
Address
);
await
_customerRepository
.
AddAsync
(
customer
);
return
Result
.
Ok
(
customer
.
Id
);
}
}
}
PSManagement.Application/C
ontracts/Authentication/IUsersRepository
.cs
→
PSManagement.Application/C
ustomers/UseCases/Commands/CreateCustomer/CreateCustomerCommandValidator
.cs
View file @
89ab6587
using
PSManagement.SharedKernel.Repositories
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Application.C
ontracts.Authentication
namespace
PSManagement.Application.C
ustomers.UseCases.Commands.CreateCustomer
{
public
interface
IUsersRepository
:
IRepository
<
User
>
class
CreateCustomerCommandValidator
{
public
Task
<
User
>
GetByEmail
(
String
email
);
}
}
PSManagement.Application/PSManagement.Application.csproj
View file @
89ab6587
...
...
@@ -8,7 +8,6 @@
<Folder Include="Abstraction\" />
<Folder Include="Behaviors\AuthorizationBehavior\" />
<Folder Include="Services\" />
<Folder Include="UseCases\" />
</ItemGroup>
<ItemGroup>
...
...
@@ -18,6 +17,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PSManagement.Domain\PSManagement.Domain.csproj" />
<ProjectReference Include="..\PSManagement.SharedKernel\PSManagement.SharedKernel.csproj" />
</ItemGroup>
...
...
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