Skip to content

Commit eb68d2f

Browse files
committed
Report API update
fixed error on report API
1 parent 9a7a500 commit eb68d2f

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

backend/src/main/java/es/codeurjc/wallypop/controller/api/ReportRestController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public ResponseEntity<Report> createReport(@PathVariable long idArticle,@Request
3838
}
3939

4040
@PostMapping("/{idReport}/image")
41-
public ResponseEntity<Object> uploadImage(@PathVariable long id, @RequestParam MultipartFile imageFile)
41+
public ResponseEntity<Object> uploadImage(@PathVariable long idReport, @RequestParam MultipartFile imageFile)
4242
throws IOException {
43-
Report report = reportService.findById(id).orElseThrow();
43+
Report report = reportService.findById(idReport).orElseThrow();
4444

4545
URI location = fromCurrentRequest().build().toUri();
4646
report.setPROOF(BlobProxy.generateProxy(imageFile.getInputStream(), imageFile.getSize()));

backend/src/main/java/es/codeurjc/wallypop/controller/api/admin/AdminReportRestController.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public ResponseEntity<Object> downloadReporteProof(@PathVariable long id) throws
5353

5454
Resource file = new InputStreamResource(report.getPROOF().getBinaryStream());
5555

56-
return ResponseEntity.ok().header(HttpHeaders.CONTENT_TYPE, "image/jpeg")
56+
return ResponseEntity.ok().header(HttpHeaders.CONTENT_TYPE, "application/zip")
5757
.contentLength(report.getPROOF().length()).body(file);
5858

5959
} else {
@@ -89,16 +89,6 @@ public ResponseEntity<Object> downloadReportedArticleImage(@PathVariable long id
8989
}
9090
}
9191

92-
@PutMapping("/{idReport}")
93-
public ResponseEntity<Report> updateReport(@PathVariable long idReport, @RequestBody Report updatedReport) throws SQLException {
94-
if (reportService.exist(idReport)) {
95-
reportService.updateReport(idReport, updatedReport);
96-
return new ResponseEntity<>(reportService.findById(idReport).get(), HttpStatus.OK);
97-
} else {
98-
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
99-
}
100-
}
101-
10292
@DeleteMapping("/{id}/rejectReport")
10393
public ResponseEntity<Report> deleteReport(@PathVariable long id) {
10494

@@ -112,7 +102,7 @@ public ResponseEntity<Report> deleteReport(@PathVariable long id) {
112102

113103
}
114104

115-
@DeleteMapping("/{id}/acceptReport")
105+
@DeleteMapping("/{id}/aceptReport")
116106
public ResponseEntity<Article> deleteArticleReported(@PathVariable long id) {
117107

118108
try {

0 commit comments

Comments
 (0)