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
9f943cfa
Commit
9f943cfa
authored
Aug 25, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix paginaton issues
parent
626a2c9b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
34 additions
and
36 deletions
+34
-36
GetAvailableEmployeesQueryHandler.cs
...etAvailableEmployees/GetAvailableEmployeesQueryHandler.cs
+4
-3
GetEmployeeParticipationQueryHandler.cs
...yeeParticipations/GetEmployeeParticipationQueryHandler.cs
+1
-3
GetEmployeeTrackHistoryQueryHandler.cs
...ployeeTrackHistory/GetEmployeeTrackHistoryQueryHandler.cs
+2
-4
GetEmployeesByFilterQueryHandler.cs
.../GetEmployeesByFilter/GetEmployeesByFilterQueryHandler.cs
+1
-3
GetFinancialSpendItemByProjectQueryHandler.cs
...ngByProject/GetFinancialSpendItemByProjectQueryHandler.cs
+1
-6
GetProjectAttachmentsQueryHandler.cs
...etProjectAttachments/GetProjectAttachmentsQueryHandler.cs
+9
-1
GetProjectsByFilterQueryHandler.cs
...es/GetProjectsByFilter/GetProjectsByFilterQueryHandler.cs
+1
-5
ListAllProjectsQueryHandler.cs
...ses/Queries/ListAllProject/ListAllProjectsQueryHandler.cs
+2
-5
GetTracksByProjectQueryHandler.cs
...ries/GetTracksByProject/GetTracksByProjectQueryHandler.cs
+2
-6
BaseSpecification.cs
PSManagement.SharedKernel/Specification/BaseSpecification.cs
+11
-0
No files found.
PSManagement.Application/Employees/UseCases/Queries/GetAvailableEmployees/GetAvailableEmployeesQueryHandler.cs
View file @
9f943cfa
...
@@ -29,11 +29,12 @@ namespace PSManagement.Application.Employees.UseCases.Queries.GetAvailableEmploy
...
@@ -29,11 +29,12 @@ namespace PSManagement.Application.Employees.UseCases.Queries.GetAvailableEmploy
public
async
Task
<
Result
<
IEnumerable
<
EmployeeDTO
>>>
Handle
(
GetAvailableEmployeesQuery
request
,
CancellationToken
cancellationToken
)
public
async
Task
<
Result
<
IEnumerable
<
EmployeeDTO
>>>
Handle
(
GetAvailableEmployeesQuery
request
,
CancellationToken
cancellationToken
)
{
{
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
_specification
.
AddInclude
(
e
=>
e
.
Department
);
_specification
.
AddInclude
(
e
=>
e
.
Department
);
_specification
.
AddInclude
(
e
=>
e
.
User
);
_specification
.
AddInclude
(
e
=>
e
.
User
);
return
Result
.
Success
(
_mapper
.
Map
<
IEnumerable
<
EmployeeDTO
>>(
await
_employeesRepository
.
ListAsync
(
_specification
)));
return
Result
.
Success
(
_mapper
.
Map
<
IEnumerable
<
EmployeeDTO
>>(
await
_employeesRepository
.
ListAsync
(
_specification
)));
}
}
}
}
...
...
PSManagement.Application/Employees/UseCases/Queries/GetEmployeeParticipations/GetEmployeeParticipationQueryHandler.cs
View file @
9f943cfa
...
@@ -30,9 +30,7 @@ namespace PSManagement.Application.Employees.UseCases.Queries.GetEmployeeById
...
@@ -30,9 +30,7 @@ namespace PSManagement.Application.Employees.UseCases.Queries.GetEmployeeById
public
async
Task
<
Result
<
IEnumerable
<
EmployeeParticipateDTO
>>>
Handle
(
GetEmployeeParticipationQuery
request
,
CancellationToken
cancellationToken
)
public
async
Task
<
Result
<
IEnumerable
<
EmployeeParticipateDTO
>>>
Handle
(
GetEmployeeParticipationQuery
request
,
CancellationToken
cancellationToken
)
{
{
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
_specification
.
AddInclude
(
e
=>
e
.
Project
);
_specification
.
AddInclude
(
e
=>
e
.
Project
);
_specification
.
AddInclude
(
"Employee.User"
);
_specification
.
AddInclude
(
"Employee.User"
);
...
...
PSManagement.Application/Employees/UseCases/Queries/GetEmployeeTrackHistory/GetEmployeeTrackHistoryQueryHandler.cs
View file @
9f943cfa
...
@@ -30,15 +30,13 @@ namespace PSManagement.Application.Employees.UseCases.Queries.GetEmployeeTrackHi
...
@@ -30,15 +30,13 @@ namespace PSManagement.Application.Employees.UseCases.Queries.GetEmployeeTrackHi
public
async
Task
<
Result
<
IEnumerable
<
EmployeeTrackDTO
>>>
Handle
(
GetEmployeeTrackHistoryQuery
request
,
CancellationToken
cancellationToken
)
public
async
Task
<
Result
<
IEnumerable
<
EmployeeTrackDTO
>>>
Handle
(
GetEmployeeTrackHistoryQuery
request
,
CancellationToken
cancellationToken
)
{
{
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
AddInclude
(
e
=>
e
.
Track
);
_specification
.
AddInclude
(
e
=>
e
.
Track
);
_specification
.
AddInclude
(
e
=>
e
.
Employee
);
_specification
.
AddInclude
(
e
=>
e
.
Employee
);
_specification
.
AddInclude
(
e
=>
e
.
Employee
.
User
);
_specification
.
AddInclude
(
e
=>
e
.
Employee
.
User
);
_specification
.
Criteria
=
e
=>
e
.
EmployeeId
==
request
.
EmployeeId
&&
e
.
Track
.
ProjectId
==
request
.
ProjectId
;
_specification
.
Criteria
=
e
=>
e
.
EmployeeId
==
request
.
EmployeeId
&&
e
.
Track
.
ProjectId
==
request
.
ProjectId
;
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
IEnumerable
<
EmployeeTrack
>
employeeTracks
=
await
_employeeTracksRepository
.
ListAsync
(
_specification
);
IEnumerable
<
EmployeeTrack
>
employeeTracks
=
await
_employeeTracksRepository
.
ListAsync
(
_specification
);
return
Result
.
Success
(
_mapper
.
Map
<
IEnumerable
<
EmployeeTrackDTO
>>(
employeeTracks
));
return
Result
.
Success
(
_mapper
.
Map
<
IEnumerable
<
EmployeeTrackDTO
>>(
employeeTracks
));
...
...
PSManagement.Application/Employees/UseCases/Queries/GetEmployeesByFilter/GetEmployeesByFilterQueryHandler.cs
View file @
9f943cfa
...
@@ -29,9 +29,7 @@ namespace PSManagement.Application.Employees.UseCases.Queries.GetEmployeesByFilt
...
@@ -29,9 +29,7 @@ namespace PSManagement.Application.Employees.UseCases.Queries.GetEmployeesByFilt
public
async
Task
<
Result
<
IEnumerable
<
EmployeeDTO
>>>
Handle
(
GetEmployeesByFilterQuery
request
,
CancellationToken
cancellationToken
)
public
async
Task
<
Result
<
IEnumerable
<
EmployeeDTO
>>>
Handle
(
GetEmployeesByFilterQuery
request
,
CancellationToken
cancellationToken
)
{
{
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
_specification
.
AddInclude
(
e
=>
e
.
Department
);
_specification
.
AddInclude
(
e
=>
e
.
Department
);
_specification
.
AddInclude
(
e
=>
e
.
User
);
_specification
.
AddInclude
(
e
=>
e
.
User
);
...
...
PSManagement.Application/FinancialSpends/UseCases/Queries/GetFinancialSpendingByProject/GetFinancialSpendItemByProjectQueryHandler.cs
View file @
9f943cfa
...
@@ -31,12 +31,7 @@ namespace PSManagement.Application.FinancialSpends.UseCases.Queries.GetFinancial
...
@@ -31,12 +31,7 @@ namespace PSManagement.Application.FinancialSpends.UseCases.Queries.GetFinancial
public
async
Task
<
Result
<
IEnumerable
<
FinancialSpendingDTO
>>>
Handle
(
GetFinancialSpendItemByProjectQuery
request
,
CancellationToken
cancellationToken
)
public
async
Task
<
Result
<
IEnumerable
<
FinancialSpendingDTO
>>>
Handle
(
GetFinancialSpendItemByProjectQuery
request
,
CancellationToken
cancellationToken
)
{
{
_specification
.
Criteria
=
p
=>
p
.
ProjectId
==
request
.
ProjectId
;
_specification
.
Criteria
=
p
=>
p
.
ProjectId
==
request
.
ProjectId
;
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
IEnumerable
<
FinancialSpending
>
spending
=
await
_spendRepository
.
ListAsync
(
_specification
);
IEnumerable
<
FinancialSpending
>
spending
=
await
_spendRepository
.
ListAsync
(
_specification
);
if
(
spending
is
null
)
if
(
spending
is
null
)
...
...
PSManagement.Application/Projects/UseCases/Queries/GetProjectAttachments/GetProjectAttachmentsQueryHandler.cs
View file @
9f943cfa
...
@@ -32,7 +32,15 @@ namespace PSManagement.Application.Projects.UseCases.Queries.GetProjectAttachmen
...
@@ -32,7 +32,15 @@ namespace PSManagement.Application.Projects.UseCases.Queries.GetProjectAttachmen
var
attachments
=
await
_attachmentRepository
.
ListAsync
();
var
attachments
=
await
_attachmentRepository
.
ListAsync
();
attachments
=
attachments
.
Where
(
e
=>
e
.
ProjectId
==
request
.
ProjectId
).
Skip
((
pageNumber
-
1
)
*
pageSize
).
Take
(
pageSize
);
if
(
request
.
PageSize
.
HasValue
&&
request
.
PageNumber
.
HasValue
)
{
attachments
=
attachments
.
Where
(
e
=>
e
.
ProjectId
==
request
.
ProjectId
).
Skip
((
pageNumber
-
1
)
*
pageSize
).
Take
(
pageSize
);
}
else
{
attachments
=
attachments
.
Where
(
e
=>
e
.
ProjectId
==
request
.
ProjectId
);
}
return
Result
.
Success
(
_mapper
.
Map
<
IEnumerable
<
AttachmentDTO
>>(
attachments
));
return
Result
.
Success
(
_mapper
.
Map
<
IEnumerable
<
AttachmentDTO
>>(
attachments
));
}
}
...
...
PSManagement.Application/Projects/UseCases/Queries/GetProjectsByFilter/GetProjectsByFilterQueryHandler.cs
View file @
9f943cfa
...
@@ -34,11 +34,7 @@ namespace PSManagement.Application.Projects.UseCases.Queries.ListAllProject
...
@@ -34,11 +34,7 @@ namespace PSManagement.Application.Projects.UseCases.Queries.ListAllProject
_specification
.
AddInclude
(
e
=>
e
.
TeamLeader
);
_specification
.
AddInclude
(
e
=>
e
.
TeamLeader
);
_specification
.
AddInclude
(
e
=>
e
.
Executer
);
_specification
.
AddInclude
(
e
=>
e
.
Executer
);
_specification
.
AddInclude
(
e
=>
e
.
Proposer
);
_specification
.
AddInclude
(
e
=>
e
.
Proposer
);
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
IEnumerable
<
Project
>
projects
=
await
_projectsRepository
.
ListAsync
(
_specification
);
IEnumerable
<
Project
>
projects
=
await
_projectsRepository
.
ListAsync
(
_specification
);
...
...
PSManagement.Application/Projects/UseCases/Queries/ListAllProject/ListAllProjectsQueryHandler.cs
View file @
9f943cfa
...
@@ -29,9 +29,7 @@ namespace PSManagement.Application.Projects.UseCases.Queries.ListAllProject
...
@@ -29,9 +29,7 @@ namespace PSManagement.Application.Projects.UseCases.Queries.ListAllProject
public
async
Task
<
Result
<
IEnumerable
<
ProjectDetailsDTO
>>>
Handle
(
ListAllProjectsQuery
request
,
CancellationToken
cancellationToken
)
public
async
Task
<
Result
<
IEnumerable
<
ProjectDetailsDTO
>>>
Handle
(
ListAllProjectsQuery
request
,
CancellationToken
cancellationToken
)
{
{
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
AddInclude
(
e
=>
e
.
ProjectManager
);
_specification
.
AddInclude
(
e
=>
e
.
ProjectManager
);
_specification
.
AddInclude
(
e
=>
e
.
Proposer
);
_specification
.
AddInclude
(
e
=>
e
.
Proposer
);
_specification
.
AddInclude
(
e
=>
e
.
TeamLeader
);
_specification
.
AddInclude
(
e
=>
e
.
TeamLeader
);
...
@@ -39,8 +37,7 @@ namespace PSManagement.Application.Projects.UseCases.Queries.ListAllProject
...
@@ -39,8 +37,7 @@ namespace PSManagement.Application.Projects.UseCases.Queries.ListAllProject
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
var
projects
=
await
_projectsRepository
.
ListAsync
(
_specification
);
var
projects
=
await
_projectsRepository
.
ListAsync
(
_specification
);
return
Result
.
Success
(
_mapper
.
Map
<
IEnumerable
<
ProjectDetailsDTO
>>(
projects
));
return
Result
.
Success
(
_mapper
.
Map
<
IEnumerable
<
ProjectDetailsDTO
>>(
projects
));
...
...
PSManagement.Application/Tracks/UseCaes/Queries/GetTracksByProject/GetTracksByProjectQueryHandler.cs
View file @
9f943cfa
...
@@ -34,13 +34,9 @@ namespace PSManagement.Application.Tracks.UseCaes.Queries.GetTracksByProject
...
@@ -34,13 +34,9 @@ namespace PSManagement.Application.Tracks.UseCaes.Queries.GetTracksByProject
public
async
Task
<
Result
<
IEnumerable
<
TrackDTO
>>>
Handle
(
GetTracksByProjectQuery
request
,
CancellationToken
cancellationToken
)
public
async
Task
<
Result
<
IEnumerable
<
TrackDTO
>>>
Handle
(
GetTracksByProjectQuery
request
,
CancellationToken
cancellationToken
)
{
{
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
AddInclude
(
e
=>
e
.
Project
);
_specification
.
AddInclude
(
e
=>
e
.
Project
);
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
_specification
.
Criteria
=
t
=>
t
.
ProjectId
==
request
.
ProjectId
;
_specification
.
Criteria
=
t
=>
t
.
ProjectId
==
request
.
ProjectId
;
var
project
=
await
_projectsRepository
.
GetByIdAsync
(
request
.
ProjectId
);
var
project
=
await
_projectsRepository
.
GetByIdAsync
(
request
.
ProjectId
);
...
...
PSManagement.SharedKernel/Specification/BaseSpecification.cs
View file @
9f943cfa
...
@@ -46,5 +46,16 @@ namespace PSManagement.SharedKernel.Specification
...
@@ -46,5 +46,16 @@ namespace PSManagement.SharedKernel.Specification
OrderByDescending
=
orderByDescendingExpression
;
OrderByDescending
=
orderByDescendingExpression
;
}
}
public
void
ApplyOptionalPagination
(
int
?
pageSize
,
int
?
pageNumber
)
{
int
actPageNumber
=
pageNumber
.
HasValue
&&
pageNumber
.
Value
>
0
?
pageNumber
.
Value
:
1
;
int
actPageSize
=
pageSize
.
HasValue
&&
pageSize
.
Value
>
0
&&
pageSize
.
Value
<=
30
?
pageSize
.
Value
:
30
;
if
(
pageNumber
.
HasValue
&&
pageSize
.
HasValue
)
{
ApplyPaging
((
actPageNumber
-
1
)
*
actPageSize
,
actPageSize
);
}
}
}
}
}
}
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