source: phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/AdminController.java

Last change on this file was ffd50db, checked in by Marko <Marko@…>, 2 years ago

Added few methods in PhoneOffer service

  • Property mode set to 100644
File size: 1.4 KB
Line 
1package finki.it.phoneluxbackend.controllers;
2
3import finki.it.phoneluxbackend.entities.PhoneOffer;
4import finki.it.phoneluxbackend.services.PhoneOfferService;
5import lombok.AllArgsConstructor;
6import org.apache.coyote.Response;
7import org.springframework.http.MediaType;
8import org.springframework.http.ResponseEntity;
9import org.springframework.web.bind.annotation.*;
10
11@RestController
12@RequestMapping(path = "/admin")
13@AllArgsConstructor
14public class AdminController {
15 private PhoneOfferService phoneOfferService;
16
17
18 @PutMapping(path = "/editoffer/{offerId}", consumes = {
19 MediaType.APPLICATION_JSON_VALUE,
20 MediaType.APPLICATION_XML_VALUE
21 }, produces = {
22 MediaType.APPLICATION_JSON_VALUE,
23 MediaType.APPLICATION_XML_VALUE
24 })
25 public ResponseEntity<Object> editOffer(@PathVariable("offerId") Long offerId, @RequestBody PhoneOffer editedOffer)
26 {
27
28 return phoneOfferService.editOffer(offerId,editedOffer);
29 }
30
31 @PutMapping(path = "/validateoffer/{offerId}")
32 public ResponseEntity<Object> validateOffer(@PathVariable("offerId") Long offerId){
33 return phoneOfferService.validateOffer(offerId);
34 }
35
36
37 @GetMapping(path = "/editoffer/{offerId}")
38 public ResponseEntity<Object> getOffer(@PathVariable("offerId") Long offerId){
39 return ResponseEntity.ok().body(phoneOfferService.getPhoneOffer(offerId));
40 }
41}
Note: See TracBrowser for help on using the repository browser.