Skip to content

Commit 89bc3da

Browse files
committed
Show article reported when i put a new report
1 parent 7f30777 commit 89bc3da

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ public class ReportRestController {
3232
@PostMapping("/{idArticle}")
3333
@ResponseStatus(HttpStatus.CREATED)
3434
public ResponseEntity<Report> createReport(@PathVariable long idArticle,@RequestBody Report report) {
35-
reportService.save(report);
36-
reportService.findById(report.getID_REPORT()).get().setARTICLE(articleService.findById(idArticle).get());
37-
reportService.flush();
35+
report.setARTICLE(articleService.findById(idArticle).get());
36+
reportService.save(report);
3837
return new ResponseEntity<>(report, HttpStatus.OK);
3938
}
4039

backend/src/main/java/es/codeurjc/wallypop/model/Report.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
@Entity
2222
@Table(name = "REPORT")
2323
//@JsonIdentityInfo(generator= ObjectIdGenerators.IntSequenceGenerator.class, property="@id_report")
24-
@JsonIgnoreProperties(value = "article")
24+
//@JsonIgnoreProperties(value = "article")
2525
public class Report {
2626

2727
@Id

0 commit comments

Comments
 (0)