Ignore:
Timestamp:
10/01/22 22:57:41 (2 years ago)
Author:
Marko <Marko@…>
Branches:
master
Children:
47f4eaf
Parents:
fd5b100
Message:

Added few methods in PhoneOffer service

File:
1 edited

Legend:

Unmodified
Added
Removed
  • phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/PhoneOfferController.java

    rfd5b100 rffd50db  
    77import lombok.AllArgsConstructor;
    88import org.springframework.beans.factory.annotation.Autowired;
     9import org.springframework.http.ResponseEntity;
    910import org.springframework.web.bind.annotation.*;
    1011
     
    1617    private final PhoneOfferService phoneOfferService;
    1718
     19
     20    @GetMapping(path = "/alloffers")
     21    public List<PhoneOffer> getAllOffers(){
     22        return phoneOfferService.getAllOffers();
     23    }
    1824    @GetMapping(path = "/phones/offers/{phoneId}")
    1925    public List<PhoneOffer> getOffersForPhone(@PathVariable("phoneId") Long phoneId){
     
    2228
    2329    @GetMapping(path = "/multipleoffers")
    24     public List<PhoneOffer> getPhoneOffer(@RequestParam("offerIds") String offerIds){
     30    public List<PhoneOffer> getMultiplePhoneOffers(@RequestParam("offerIds") String offerIds){
    2531        return phoneOfferService.getMultiplePhoneOffers(offerIds);
    2632    }
     
    5864    }
    5965
     66
     67    @PutMapping(path = "/phoneoffer/{offerId}/addphonemodel/{phoneId}")
     68    public ResponseEntity<Object> addPhoneModelToOffer(@PathVariable("offerId") Long offerId,
     69                                                       @PathVariable("phoneId") Long phoneId)
     70    {
     71        return phoneOfferService.addPhoneModelToOffer(offerId,phoneId);
     72    }
     73    @PutMapping(path = "/phoneoffer/{offerId}/changeprice/{price}")
     74    public ResponseEntity<Object> changePriceForOffer(@PathVariable("offerId") Long offerId,
     75                                                       @PathVariable("price") int price)
     76    {
     77        return phoneOfferService.changePriceForOffer(offerId,price);
     78    }
     79
     80    @PostMapping(path = "/phoneoffer/addoffer")
     81    public ResponseEntity<Object> addOffer(@RequestBody PhoneOffer offer)
     82    {
     83        return phoneOfferService.addOffer(offer);
     84    }
     85
     86    @DeleteMapping(path = "/phoneoffer/deleteoffer/{offerId}")
     87    public ResponseEntity<Object> deleteOffer(@PathVariable("offerId") Long offerId)
     88    {
     89        return phoneOfferService.deleteOffer(offerId);
     90    }
    6091}
Note: See TracChangeset for help on using the changeset viewer.