Package se.bth.pulse.controller
Class ReportAdminRestController
java.lang.Object
se.bth.pulse.controller.ReportAdminRestController
This class is a rest controller that serves the report admin page.
-
Constructor Summary
ConstructorsConstructorDescriptionReportAdminRestController
(ReportRepository reportRepository, ReportCommentRepository reportCommentRepository) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
commentReport
(Integer reportId, String content) Adds a comment to a report.org.springframework.http.ResponseEntity
readReport
(Integer id) Marks a report as read.
-
Constructor Details
-
ReportAdminRestController
public ReportAdminRestController(ReportRepository reportRepository, ReportCommentRepository reportCommentRepository)
-
-
Method Details
-
readReport
@PostMapping("/api/admin/report/read/{id}") public org.springframework.http.ResponseEntity readReport(@PathVariable("id") Integer id) Marks a report as read. The report is retrieved from the report repository using the id.- Parameters:
id
- - the id of the report to be read- Returns:
- ResponseEntity - the response entity containing a success message if the report was read successfully, an error message otherwise.
-
commentReport
@PostMapping("/api/admin/report/comment/{id}") public org.springframework.http.ResponseEntity commentReport(@PathVariable("id") Integer reportId, @RequestBody String content) Adds a comment to a report. The report is retrieved from the report repository using the id. The comment is saved in the report comment repository.- Parameters:
reportId
- - the id of the report to be commented oncontent
- - the content of the comment- Returns:
- ResponseEntity - the response entity containing a success message if the comment was added successfully, an error message otherwise.
-