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
37f508dc
Commit
37f508dc
authored
Aug 28, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Proejct Completion Endpoint
parent
93a3b9aa
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
1 deletion
+80
-1
GetCompletionContributionQueryHandler.cs
...tionContribution/GetCompletionContributionQueryHandler.cs
+1
-1
GetProjectCompletionQuery.cs
...Queries/GetProjectCompletion/GetProjectCompletionQuery.cs
+11
-0
GetProjectCompletionQueryHandler.cs
.../GetProjectCompletion/GetProjectCompletionQueryHandler.cs
+57
-0
ProjectsController.cs
...t.Presentation/Controllers/Projects/ProjectsController.cs
+11
-0
No files found.
PSManagement.Application/Projects/UseCases/Queries/GetCompletionContribution/GetCompletionContributionQueryHandler.cs
View file @
37f508dc
...
@@ -46,7 +46,7 @@ namespace PSManagement.Application.Projects.UseCases.Queries.GetCompletionContri
...
@@ -46,7 +46,7 @@ namespace PSManagement.Application.Projects.UseCases.Queries.GetCompletionContri
_trackSpecification
.
AddInclude
(
"EmployeeTracks.Employee"
);
_trackSpecification
.
AddInclude
(
"EmployeeTracks.Employee"
);
_trackSpecification
.
Criteria
=
e
=>
e
.
ProjectId
==
request
.
ProjectId
;
_trackSpecification
.
Criteria
=
e
=>
e
.
ProjectId
==
request
.
ProjectId
;
_projectSpecification
.
AddInclude
(
e
=>
e
.
ProjectCompletion
);
Project
project
=
await
_projectsRepository
.
GetByIdAsync
(
request
.
ProjectId
,
_projectSpecification
);
Project
project
=
await
_projectsRepository
.
GetByIdAsync
(
request
.
ProjectId
,
_projectSpecification
);
if
(
project
is
null
)
if
(
project
is
null
)
...
...
PSManagement.Application/Projects/UseCases/Queries/GetProjectCompletion/GetProjectCompletionQuery.cs
0 → 100644
View file @
37f508dc
using
Ardalis.Result
;
using
PSManagement.Application.Projects.Common
;
using
PSManagement.SharedKernel.CQRS.Query
;
using
System.Collections.Generic
;
namespace
PSManagement.Application.Projects.UseCases.Queries.GetProjectCompletion
{
public
record
GetProjectCompletionQuery
(
int
ProjectId
)
:
IQuery
<
Result
<
ProjectCompletionDTO
>>;
}
PSManagement.Application/Projects/UseCases/Queries/GetProjectCompletion/GetProjectCompletionQueryHandler.cs
0 → 100644
View file @
37f508dc
using
Ardalis.Result
;
using
AutoMapper
;
using
PSManagement.Application.Projects.Common
;
using
PSManagement.Domain.Projects
;
using
PSManagement.Domain.Projects.DomainErrors
;
using
PSManagement.Domain.Projects.Entities
;
using
PSManagement.Domain.Projects.Repositories
;
using
PSManagement.SharedKernel.CQRS.Query
;
using
PSManagement.SharedKernel.Specification
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
PSManagement.Application.Projects.UseCases.Queries.GetProjectCompletion
{
public
class
GetProjectCompletionQueryHandler
:
IQueryHandler
<
GetProjectCompletionQuery
,
Result
<
ProjectCompletionDTO
>>
{
private
readonly
IProjectsRepository
_projectsRepository
;
private
readonly
BaseSpecification
<
Project
>
_projectSpecification
;
private
readonly
IMapper
_mapper
;
public
GetProjectCompletionQueryHandler
(
IProjectsRepository
projectsRepository
,
IMapper
mapper
)
{
_projectSpecification
=
new
ProjectSpecification
();
_projectsRepository
=
projectsRepository
;
_mapper
=
mapper
;
}
public
async
Task
<
Result
<
ProjectCompletionDTO
>>
Handle
(
GetProjectCompletionQuery
request
,
CancellationToken
cancellationToken
)
{
_projectSpecification
.
AddInclude
(
e
=>
e
.
ProjectCompletion
);
Project
project
=
await
_projectsRepository
.
GetByIdAsync
(
request
.
ProjectId
,
_projectSpecification
);
if
(
project
is
null
)
{
return
Result
.
Invalid
(
ProjectsErrors
.
InvalidEntryError
);
}
else
{
if
(
project
.
ProjectCompletion
is
null
)
{
return
Result
.
Invalid
(
ProjectsErrors
.
UnCompletedError
);
}
var
result
=
_mapper
.
Map
<
ProjectCompletionDTO
>(
project
.
ProjectCompletion
);
return
Result
.
Success
(
result
);
}
}
}
}
PSManagement.Presentation/Controllers/Projects/ProjectsController.cs
View file @
37f508dc
...
@@ -27,6 +27,7 @@ using PSManagement.Presentation.Controllers.ApiBase;
...
@@ -27,6 +27,7 @@ using PSManagement.Presentation.Controllers.ApiBase;
using
PSManagement.Application.Projects.UseCases.Queries.GetParticipationChangeHistory
;
using
PSManagement.Application.Projects.UseCases.Queries.GetParticipationChangeHistory
;
using
PSManagement.Application.Projects.UseCases.Queries.GetCompletionContribution
;
using
PSManagement.Application.Projects.UseCases.Queries.GetCompletionContribution
;
using
PSManagement.Application.Projects.UseCases.Commands.RemoveAttachment
;
using
PSManagement.Application.Projects.UseCases.Commands.RemoveAttachment
;
using
PSManagement.Application.Projects.UseCases.Queries.GetProjectCompletion
;
namespace
PSManagement.Presentation.Controllers.Projects
namespace
PSManagement.Presentation.Controllers.Projects
{
{
...
@@ -78,6 +79,16 @@ namespace PSManagement.Presentation.Controllers.Projects
...
@@ -78,6 +79,16 @@ namespace PSManagement.Presentation.Controllers.Projects
}
}
[
HttpGet
(
"Completion{id}"
)]
public
async
Task
<
IActionResult
>
GetProjectCompletion
(
int
id
)
{
var
query
=
new
GetProjectCompletionQuery
(
id
);
var
result
=
await
_sender
.
Send
(
query
);
return
HandleResult
(
_mapper
.
Map
<
Result
<
ProjectCompletionResponse
>>(
result
));
}
[
HttpGet
(
"ParticipationChangeHistory/{id}"
)]
[
HttpGet
(
"ParticipationChangeHistory/{id}"
)]
...
...
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