1 | package finki.it.phoneluxbackend.controllers;
|
---|
2 |
|
---|
3 | import finki.it.phoneluxbackend.entities.OfferReport;
|
---|
4 | import finki.it.phoneluxbackend.services.OfferReportService;
|
---|
5 | import lombok.AllArgsConstructor;
|
---|
6 | import org.apache.coyote.Response;
|
---|
7 | import org.springframework.http.ResponseEntity;
|
---|
8 | import org.springframework.stereotype.Controller;
|
---|
9 | import org.springframework.web.bind.annotation.*;
|
---|
10 |
|
---|
11 | import java.util.List;
|
---|
12 |
|
---|
13 | @AllArgsConstructor
|
---|
14 | @RestController
|
---|
15 | @RequestMapping(path = "/offerreport")
|
---|
16 | public class OfferReportController {
|
---|
17 | private final OfferReportService offerReportService;
|
---|
18 |
|
---|
19 | @GetMapping(path = "/allreports")
|
---|
20 | public List<OfferReport> getAllOfferReports(){
|
---|
21 | return offerReportService.getAllOfferReports();
|
---|
22 | }
|
---|
23 |
|
---|
24 | @PostMapping(path = "/{offerId}/{userId}")
|
---|
25 | public ResponseEntity<Object> reportOffer(@PathVariable("offerId") Long offerId,
|
---|
26 | @PathVariable("userId") Long userId){
|
---|
27 |
|
---|
28 | return offerReportService.reportOffer(offerId, userId);
|
---|
29 | }
|
---|
30 |
|
---|
31 | @DeleteMapping(path = "/remove/{offerReportId}")
|
---|
32 | public ResponseEntity<Object> removeOfferReport(@PathVariable("offerReportId") Long offerReportId){
|
---|
33 |
|
---|
34 | return offerReportService.removeOfferReport(offerReportId);
|
---|
35 | }
|
---|
36 |
|
---|
37 | @DeleteMapping(path = "/removeall")
|
---|
38 | public ResponseEntity<Object> removeAllOfferReports(){
|
---|
39 |
|
---|
40 | return offerReportService.removeAllOfferReports();
|
---|
41 | }
|
---|
42 |
|
---|
43 |
|
---|
44 |
|
---|
45 | }
|
---|