Skip to content
GitLab
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Samuel Kulíšek
pa165-secret-service-archive
Commits
d223dcfd
Commit
d223dcfd
authored
May 18, 2022
by
Samuel Kulisek
Committed by
Jiri Novotny
May 19, 2022
Browse files
Add get report by id endpoint
parent
09f3a473
Changes
3
Hide whitespace changes
Inline
Side-by-side
ssa-api/src/main/java/cz/muni/fi/pa165/facade/ReportFacade.java
View file @
d223dcfd
...
...
@@ -7,4 +7,5 @@ public interface ReportFacade {
Page
<
ReportDetailDto
>
getAllMissionReports
(
Long
missionId
,
int
page
,
int
pageSize
);
Page
<
ReportDetailDto
>
getAllAgentReports
(
Long
agentId
,
int
page
,
int
pageSize
);
Page
<
ReportDetailDto
>
getAllMissionAgentReports
(
Long
missionId
,
Long
agentId
,
int
page
,
int
pageSize
);
ReportDetailDto
getReportById
(
Long
reportId
);
}
ssa-rest/src/main/java/cz/muni/fi/pa165/rest/controller/ReportController.java
View file @
d223dcfd
...
...
@@ -5,6 +5,7 @@ import cz.muni.fi.pa165.dto.ReportDetailDto;
import
cz.muni.fi.pa165.facade.ReportFacade
;
import
cz.muni.fi.pa165.rest.ApiResponse
;
import
cz.muni.fi.pa165.rest.ApiUris
;
import
cz.muni.fi.pa165.service.ReportService
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
org.slf4j.Logger
;
...
...
@@ -87,4 +88,17 @@ public class ReportController {
return
ResponseEntity
.
notFound
().
build
();
}
}
@Operation
(
description
=
"Retrieve a specified report"
)
@GetMapping
(
"/reports/{reportId}"
)
public
final
ResponseEntity
<
ReportDetailDto
>
getReportById
(
@PathVariable
long
reportId
)
{
//TODO logged in user logic
try
{
return
ResponseEntity
.
ok
().
body
(
reportFacade
.
getReportById
(
reportId
));
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"Could not retrieve reports of specified agent"
,
e
);
return
ResponseEntity
.
notFound
().
build
();
}
}
}
ssa-service/src/main/java/cz/muni/fi/pa165/facade/ReportFacadeImpl.java
View file @
d223dcfd
...
...
@@ -63,4 +63,9 @@ public class ReportFacadeImpl implements ReportFacade {
return
reports
.
map
(
reportDetailMapper:
:
map
);
}
@Override
public
ReportDetailDto
getReportById
(
Long
reportId
)
{
return
reportDetailMapper
.
map
(
reportService
.
findById
(
reportId
));
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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