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

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

Admin and specifications controllers added

  • Property mode set to 100644
File size: 1.9 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.*;
10
11import java.util.List;
12
13@RestController
14@AllArgsConstructor
15public class PhoneOfferController {
16 private final PhoneOfferService phoneOfferService;
17
18 @GetMapping(path = "/phones/offers/{phoneId}")
19 public List<PhoneOffer> getOffersForPhone(@PathVariable("phoneId") Long phoneId){
20 return phoneOfferService.getPhoneOffersForPhone(phoneId);
21 }
22
23 @GetMapping(path = "/multipleoffers")
24 public List<PhoneOffer> getPhoneOffer(@RequestParam("offerIds") String offerIds){
25 return phoneOfferService.getMultiplePhoneOffers(offerIds);
26 }
27
28 @GetMapping(path = "/phoneoffer/shop/{shop}")
29 public List<PhoneOffer> getOffersFromShop(@PathVariable("shop") String shop){
30 return phoneOfferService.getOffersFromShop(shop);
31 }
32
33 @GetMapping(path = "/phoneoffer/{offerId}")
34 public PhoneOffer getPhoneOffer(@PathVariable("offerId") Long offerId){
35 return phoneOfferService.getPhoneOffer(offerId);
36 }
37
38 @GetMapping(path = "/phoneoffer/{offerId}/cheaperoffers")
39 public List<PhoneOffer> getCheaperOffers(@PathVariable("offerId") Long offerId){
40 return phoneOfferService.getCheaperOffers(offerId);
41 }
42
43 @GetMapping(path = "/shops")
44 public List<String> getShops(){
45 return phoneOfferService.getShops();
46 }
47
48 @GetMapping(path = "/lowestPrice")
49 public int getLowestPrice()
50 {
51 return phoneOfferService.getLowestPrice();
52 }
53
54 @GetMapping(path = "/highestPrice")
55 public int getHighestPrice()
56 {
57 return phoneOfferService.getHighestPrice();
58 }
59
60}
Note: See TracBrowser for help on using the repository browser.