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
8000595b
Commit
8000595b
authored
Aug 19, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update api authentiacation controller , add current user provider
parent
40cb6832
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
19 deletions
+63
-19
AuthenticationController.cs
...pi/Controllers/Authentication/AuthenticationController.cs
+4
-2
CustomersController.cs
...nagement.Api/Controllers/Customers/CustomersController.cs
+1
-1
ProjectsController.cs
PSManagement.Api/Controllers/Projects/ProjectsController.cs
+57
-15
Startup.cs
PSManagement.Api/Startup.cs
+1
-1
No files found.
PSManagement.Api/Controllers/Authentication/AuthenticationController.cs
View file @
8000595b
...
...
@@ -25,10 +25,11 @@ namespace PSManagement.Api.Controllers.Authentication
if
(
result
.
IsSuccess
)
{
AuthenticationResponse
response
=
new
(
result
.
Value
.
Id
,
result
.
Value
.
Employee
Id
,
result
.
Value
.
FirstName
,
result
.
Value
.
LastName
,
result
.
Value
.
Email
,
result
.
Value
.
Roles
,
result
.
Value
.
Token
);
return
Ok
(
response
);
}
...
...
@@ -47,10 +48,11 @@ namespace PSManagement.Api.Controllers.Authentication
if
(
result
.
IsSuccess
)
{
AuthenticationResponse
response
=
new
(
result
.
Value
.
Id
,
result
.
Value
.
Employee
Id
,
result
.
Value
.
FirstName
,
result
.
Value
.
LastName
,
result
.
Value
.
Email
,
result
.
Value
.
Roles
,
result
.
Value
.
Token
);
return
Ok
(
response
);
}
...
...
PSManagement.Api/Controllers/Customers/CustomersController.cs
View file @
8000595b
...
...
@@ -69,7 +69,7 @@ namespace PSManagement.Api.Controllers.Customers
var
response
=
await
_sender
.
Send
(
query
);
return
Ok
(
_mapper
.
Map
<
CustomerResponse
>(
response
));
return
Ok
(
_mapper
.
Map
<
Result
<
CustomerResponse
>
>(
response
));
}
else
...
...
PSManagement.Api/Controllers/Projects/ProjectsController.cs
View file @
8000595b
...
...
@@ -18,6 +18,11 @@ using PSManagement.Application.Projects.UseCases.Commands.ChangeProjectTeamLeade
using
PSManagement.Application.Projects.UseCases.Commands.ApproveProject
;
using
PSManagement.Application.Projects.UseCases.Queries.GetParticipants
;
using
PSManagement.Application.Projects.UseCases.Queries.GetProjectAttachments
;
using
PSManagement.Application.Projects.UseCases.Queries.GetProjectById
;
using
PSManagement.Application.Projects.UseCases.Commands.CompleteProgressProject
;
using
PSManagement.Application.Projects.UseCases.Commands.CompletePlaningProject
;
using
PSManagement.Application.Contracts.Providers
;
using
PSManagement.Application.Projects.UseCases.Commands.CancelProject
;
namespace
PSManagement.Api.Controllers.Projects
{
...
...
@@ -27,11 +32,17 @@ namespace PSManagement.Api.Controllers.Projects
{
private
readonly
IMediator
_sender
;
private
readonly
IMapper
_mapper
;
private
readonly
ICurrentUserProvider
_currentUserProvider
;
public
ProjectsController
(
IMapper
mapper
,
IMediator
sender
)
public
ProjectsController
(
IMapper
mapper
,
IMediator
sender
,
ICurrentUserProvider
currentUserProvider
)
{
_mapper
=
mapper
;
_sender
=
sender
;
_currentUserProvider
=
currentUserProvider
;
}
...
...
@@ -57,7 +68,7 @@ namespace PSManagement.Api.Controllers.Projects
}
[
HttpGet
(
"ByProjectManager"
)]
public
async
Task
<
IActionResult
>
GetBy
Br
ojectManager
([
FromQuery
]
GetProjectsByProjectManagerRequest
request
)
public
async
Task
<
IActionResult
>
GetBy
P
ojectManager
([
FromQuery
]
GetProjectsByProjectManagerRequest
request
)
{
GetProjectsByFilterQuery
query
=
_mapper
.
Map
<
GetProjectsByFilterQuery
>(
request
);
...
...
@@ -66,7 +77,7 @@ namespace PSManagement.Api.Controllers.Projects
return
Ok
(
_mapper
.
Map
<
Result
<
IEnumerable
<
ProjectResponse
>>>(
result
));
}
[
HttpGet
(
"GetParticipants{id}"
)]
[
HttpGet
(
"GetParticipants
/
{id}"
)]
public
async
Task
<
IActionResult
>
GetParticipants
(
int
id
)
{
GetProjectParticipantsQuery
query
=
new
(
id
);
...
...
@@ -77,16 +88,6 @@ namespace PSManagement.Api.Controllers.Projects
}
[
HttpPost
(
"ApproveProject"
)]
public
async
Task
<
IActionResult
>
PostApproveProjectRequest
(
ApproveProjectRequest
request
)
{
var
query
=
_mapper
.
Map
<
ApproveProjectCommand
>(
request
);
var
result
=
await
_sender
.
Send
(
query
);
return
Ok
(
result
);
}
[
HttpPut
(
"ChangeTeamLeader"
)]
public
async
Task
<
IActionResult
>
PuttChangeTeamLeader
(
ChangeProjectTeamLeaderRequest
request
)
{
...
...
@@ -130,7 +131,48 @@ namespace PSManagement.Api.Controllers.Projects
return
Ok
(
result
);
}
#
region
project
state
operations
[
HttpPost
(
"ApproveProject"
)]
public
async
Task
<
IActionResult
>
PostApproveProjectRequest
(
ApproveProjectRequest
request
)
{
var
query
=
_mapper
.
Map
<
ApproveProjectCommand
>(
request
);
var
result
=
await
_sender
.
Send
(
query
);
return
Ok
(
result
);
}
[
HttpPost
(
"CancelProject/{id}"
)]
public
async
Task
<
IActionResult
>
PostCancelProjectRequest
(
int
id
)
{
if
(
_currentUserProvider
.
EmployeeId
is
not
null
)
{
int
employeeId
=
_currentUserProvider
.
EmployeeId
.
Value
;
var
query
=
new
CancelProjectCommand
(
id
,
employeeId
);
var
result
=
await
_sender
.
Send
(
query
);
return
Ok
(
result
);
}
return
BadRequest
();
}
[
HttpPost
(
"CompleteProject/{id}"
)]
public
async
Task
<
IActionResult
>
PostCompleteProjectRequest
(
int
id
)
{
var
query
=
new
CompleteProgressProjectCommand
(
id
);
var
result
=
await
_sender
.
Send
(
query
);
return
Ok
(
result
);
}
#
endregion
project
state
operations
[
HttpGet
(
"{id}"
)]
public
async
Task
<
IActionResult
>
Get
(
int
id
)
...
...
@@ -155,7 +197,7 @@ namespace PSManagement.Api.Controllers.Projects
var
query
=
new
GetProjectByIdQuery
(
result
.
Value
);
var
response
=
await
_sender
.
Send
(
query
);
return
Ok
(
_mapper
.
Map
<
ProjectResponse
>(
response
));
return
Ok
(
_mapper
.
Map
<
Result
<
ProjectResponse
>
>(
response
));
}
else
{
...
...
@@ -174,7 +216,7 @@ namespace PSManagement.Api.Controllers.Projects
return
Ok
(
result
);
}
[
HttpGet
(
"Attachments{id}"
)]
[
HttpGet
(
"Attachments
/
{id}"
)]
public
async
Task
<
IActionResult
>
GetAttachments
([
FromQuery
]
GetProjectAttachmentsRequest
request
)
{
var
query
=
_mapper
.
Map
<
GetProjectAttachmentsQuery
>(
request
);
...
...
PSManagement.Api/Startup.cs
View file @
8000595b
...
...
@@ -52,7 +52,7 @@ namespace PSManagement.Api
}
app
.
UseHttpsRedirection
();
app
.
UseStaticFiles
();
app
.
UseRouting
();
app
.
UseCors
(
"AllowFrontend"
);
app
.
UseAuthentication
();
...
...
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