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

Last change on this file since 34950c6 was 5201690, checked in by Marko <Marko@…>, 22 months ago

Admin and specifications controllers added

  • 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 return phoneOfferService.editOffer(offerId,editedOffer);
28 }
29
30 @PutMapping(path = "/validateoffer/{offerId}")
31 public ResponseEntity<Object> validateOffer(@PathVariable("offerId") Long offerId){
32 return phoneOfferService.validateOffer(offerId);
33 }
34
35
36 @GetMapping(path = "/editoffer/{offerId}")
37 public ResponseEntity<Object> getOffer(@PathVariable("offerId") Long offerId){
38 return ResponseEntity.ok().body(phoneOfferService.getPhoneOffer(offerId));
39 }
40}
Note: See TracBrowser for help on using the repository browser.