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
RevLine 
[dfd5d87]1package finki.it.phoneluxbackend.controllers;
2
[f25d07e]3import finki.it.phoneluxbackend.entities.Phone;
[dfd5d87]4import finki.it.phoneluxbackend.entities.PhoneOffer;
5import finki.it.phoneluxbackend.services.PhoneOfferService;
[f25d07e]6import finki.it.phoneluxbackend.services.PhoneService;
7import lombok.AllArgsConstructor;
[dfd5d87]8import org.springframework.beans.factory.annotation.Autowired;
[5201690]9import org.springframework.web.bind.annotation.*;
[dfd5d87]10
11import java.util.List;
12
13@RestController
[f25d07e]14@AllArgsConstructor
[dfd5d87]15public class PhoneOfferController {
16 private final PhoneOfferService phoneOfferService;
17
[e5b84dc]18 @GetMapping(path = "/phones/offers/{phoneId}")
[dfd5d87]19 public List<PhoneOffer> getOffersForPhone(@PathVariable("phoneId") Long phoneId){
20 return phoneOfferService.getPhoneOffersForPhone(phoneId);
21 }
[f25d07e]22
[5201690]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
[e5b84dc]33 @GetMapping(path = "/phoneoffer/{offerId}")
34 public PhoneOffer getPhoneOffer(@PathVariable("offerId") Long offerId){
35 return phoneOfferService.getPhoneOffer(offerId);
36 }
37
[775e15e]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
[dfd5d87]60}
Note: See TracBrowser for help on using the repository browser.