source: phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/PhoneOfferController.java@ 775e15e

Last change on this file since 775e15e was 775e15e, checked in by Marko <Marko@…>, 22 months ago

Added more controllers

  • Property mode set to 100644
File size: 1.7 KB
Line 
1package finki.it.phoneluxbackend.controllers;
2
3import finki.it.phoneluxbackend.entities.Phone;
4import finki.it.phoneluxbackend.entities.PhoneOffer;
5import finki.it.phoneluxbackend.services.PhoneOfferService;
6import finki.it.phoneluxbackend.services.PhoneService;
7import lombok.AllArgsConstructor;
8import org.springframework.beans.factory.annotation.Autowired;
9import org.springframework.web.bind.annotation.GetMapping;
10import org.springframework.web.bind.annotation.PathVariable;
11import org.springframework.web.bind.annotation.RequestMapping;
12import org.springframework.web.bind.annotation.RestController;
13
14import java.util.List;
15
16@RestController
17@AllArgsConstructor
18public class PhoneOfferController {
19 private final PhoneOfferService phoneOfferService;
20
21 @GetMapping(path = "/phones/offers/{phoneId}")
22 public List<PhoneOffer> getOffersForPhone(@PathVariable("phoneId") Long phoneId){
23 return phoneOfferService.getPhoneOffersForPhone(phoneId);
24 }
25
26 @GetMapping(path = "/phoneoffer/{offerId}")
27 public PhoneOffer getPhoneOffer(@PathVariable("offerId") Long offerId){
28 return phoneOfferService.getPhoneOffer(offerId);
29 }
30
31 @GetMapping(path = "/phoneoffer/{offerId}/cheaperoffers")
32 public List<PhoneOffer> getCheaperOffers(@PathVariable("offerId") Long offerId){
33 return phoneOfferService.getCheaperOffers(offerId);
34 }
35
36 @GetMapping(path = "/shops")
37 public List<String> getShops(){
38 return phoneOfferService.getShops();
39 }
40
41 @GetMapping(path = "/lowestPrice")
42 public int getLowestPrice()
43 {
44 return phoneOfferService.getLowestPrice();
45 }
46
47 @GetMapping(path = "/highestPrice")
48 public int getHighestPrice()
49 {
50 return phoneOfferService.getHighestPrice();
51 }
52
53}
Note: See TracBrowser for help on using the repository browser.