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
e44cd7d2
Commit
e44cd7d2
authored
Aug 19, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Validation Behavior.
parent
9234a4d5
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
104 additions
and
3 deletions
+104
-3
EmployeesController.cs
...nagement.Api/Controllers/Employees/EmployeesController.cs
+14
-0
AddContactInfoCommandValidator.cs
...Commands/AddContactInfo/AddContactInfoCommandValidator.cs
+18
-0
CreateCustomerCommandValidator.cs
...Commands/CreateCustomer/CreateCustomerCommandValidator.cs
+5
-2
CreateFinancialSpendItemCommandValidator.cs
...cialSpendItem/CreateFinancialSpendItemCommandValidator.cs
+20
-0
AddAttachmentCommandValidator.cs
...s/Commands/AddAttachment/AddAttachmentCommandValidator.cs
+18
-0
AddProjectStepCommandHandler.cs
...s/Commands/AddProjectStep/AddProjectStepCommandHandler.cs
+0
-1
AddProjectStepCommandValidator.cs
...Commands/AddProjectStep/AddProjectStepCommandValidator.cs
+29
-0
No files found.
PSManagement.Api/Controllers/Employees/EmployeesController.cs
View file @
e44cd7d2
...
...
@@ -10,8 +10,10 @@ using PSManagement.Application.Employees.UseCases.Commands.UpdateEmployeeWorkHou
using
PSManagement.Application.Employees.UseCases.Queries.GetAvailableEmployees
;
using
PSManagement.Application.Employees.UseCases.Queries.GetEmployeeById
;
using
PSManagement.Application.Employees.UseCases.Queries.GetEmployeesByFilter
;
using
PSManagement.Application.Employees.UseCases.Queries.GetEmployeeTrackHistory
;
using
PSManagement.Contracts.Employees.Requests
;
using
PSManagement.Contracts.Projects.Response
;
using
PSManagement.Contracts.Tracks.Response
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
@@ -79,6 +81,17 @@ namespace PSManagement.Api.Controllers.Employees
}
[
HttpPost
(
"TrackHistory"
)]
public
async
Task
<
IActionResult
>
GetEmployeeTrackHistory
([
FromForm
]
GetEmployeeTrackHistoryRequest
request
)
{
var
command
=
_mapper
.
Map
<
GetEmployeeTrackHistoryQuery
>(
request
);
var
result
=
await
_sender
.
Send
(
command
);
return
Ok
(
_mapper
.
Map
<
Result
<
IEnumerable
<
EmployeeTrackResponse
>>>(
result
));
}
[
HttpPost
(
"SyncEmployees"
)]
public
async
Task
<
IActionResult
>
Post
()
{
...
...
@@ -98,5 +111,6 @@ namespace PSManagement.Api.Controllers.Employees
return
Ok
(
result
);
}
}
}
PSManagement.Application/Customers/UseCases/Commands/AddContactInfo/AddContactInfoCommandValidator.cs
0 → 100644
View file @
e44cd7d2
using
FluentValidation
;
namespace
PSManagement.Application.Customers.UseCases.Commands.AddContactInfo
{
public
class
AddContactInfoCommandValidator
:
AbstractValidator
<
AddContactInfoCommand
>
{
public
AddContactInfoCommandValidator
()
{
RuleFor
(
x
=>
x
.
ContactType
)
.
NotEmpty
()
.
MinimumLength
(
5
);
RuleFor
(
x
=>
x
.
ContactValue
)
.
MinimumLength
(
5
);
}
}
}
PSManagement.Application/Customers/UseCases/Commands/CreateCustomer/CreateCustomerCommandValidator.cs
View file @
e44cd7d2
...
...
@@ -11,8 +11,11 @@ namespace PSManagement.Application.Customers.UseCases.Commands.CreateCustomer
{
public
CreateCustomerCommandValidator
()
{
RuleFor
(
x
=>
x
.
CustomerName
).
NotEmpty
();
RuleFor
(
x
=>
x
.
Email
).
EmailAddress
();
RuleFor
(
x
=>
x
.
CustomerName
)
.
NotEmpty
()
.
MinimumLength
(
5
);
RuleFor
(
x
=>
x
.
Email
)
.
EmailAddress
();
}
}
}
PSManagement.Application/FinancialSpends/UseCases/Commands/CreateFinancialSpendItem/CreateFinancialSpendItemCommandValidator.cs
0 → 100644
View file @
e44cd7d2
using
FluentValidation
;
namespace
PSManagement.Application.FinancialSpends.UseCases.Commands.CreateFinancialSpendItem
{
public
class
CreateFinancialSpendItemCommandValidator
:
AbstractValidator
<
CreateFinancialSpendItemCommand
>
{
public
CreateFinancialSpendItemCommandValidator
()
{
RuleFor
(
x
=>
x
.
Description
)
.
NotEmpty
()
.
MinimumLength
(
10
);
RuleFor
(
x
=>
x
.
ExternalPurchase
.
Ammount
)
.
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
ExternalPurchase
.
Currency
)
.
NotEmpty
();
}
}
}
PSManagement.Application/Projects/UseCases/Commands/AddAttachment/AddAttachmentCommandValidator.cs
0 → 100644
View file @
e44cd7d2
using
FluentValidation
;
namespace
PSManagement.Application.Projects.UseCases.Commands.AddAttachment
{
public
class
AddAttachmentCommandValidator
:
AbstractValidator
<
AddAttachmentCommand
>
{
public
AddAttachmentCommandValidator
()
{
RuleFor
(
x
=>
x
.
AttachmentDescription
)
.
NotEmpty
()
.
MinimumLength
(
15
);
RuleFor
(
x
=>
x
.
AttachmentName
)
.
NotEmpty
()
.
MinimumLength
(
5
);
}
}
}
PSManagement.Application/Projects/UseCases/Commands/AddProjectStep/AddProjectStepCommandHandler.cs
View file @
e44cd7d2
...
...
@@ -51,5 +51,4 @@ namespace PSManagement.Application.Projects.UseCases.Commands.AddProjectStep
}
}
}
}
PSManagement.Application/Projects/UseCases/Commands/AddProjectStep/AddProjectStepCommandValidator.cs
0 → 100644
View file @
e44cd7d2
using
FluentValidation
;
namespace
PSManagement.Application.Projects.UseCases.Commands.AddProjectStep
{
public
class
AddProjectStepCommandValidator
:
AbstractValidator
<
AddProjectStepCommand
>
{
public
AddProjectStepCommandValidator
()
{
RuleFor
(
x
=>
x
.
Weight
)
.
GreaterThan
(
0
)
.
LessThan
(
101
);
RuleFor
(
x
=>
x
.
StepInfo
.
StartDate
)
.
GreaterThan
(
System
.
DateTime
.
Now
);
RuleFor
(
x
=>
x
.
StepInfo
.
Duration
)
.
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
StepInfo
.
Description
)
.
NotEmpty
()
.
MinimumLength
(
5
);
RuleFor
(
x
=>
x
.
StepInfo
.
StepName
)
.
NotEmpty
()
.
MinimumLength
(
5
);
}
}
}
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