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/PhoneController.java

    rfd5b100 rffd50db  
    66import finki.it.phoneluxbackend.services.PhoneService;
    77import lombok.AllArgsConstructor;
     8import org.apache.coyote.Response;
    89import org.springframework.beans.factory.annotation.Autowired;
     10import org.springframework.http.MediaType;
     11import org.springframework.http.ResponseEntity;
    912import org.springframework.web.bind.annotation.*;
    1013
     
    5053    }
    5154
     55    @GetMapping(path = "/totaloffers/{phoneModel}")
     56    public Long getTotalOffersForPhone(@PathVariable("phoneModel") String phoneModel){
     57        return phoneService.getTotalOffersForPhone(phoneModel);
     58    }
     59
     60    @PutMapping(path = "/settotaloffers/{phoneId}/{totaloffers}")
     61    public ResponseEntity<Object> setTotalOffersForPhone(@PathVariable("phoneId") Long phoneId,
     62                                                         @PathVariable("totaloffers") int totaloffers){
     63        return phoneService.setTotalOffersForPhone(phoneId,totaloffers);
     64    }
     65
     66    @PutMapping(path = "/setlowestprice/{phoneId}/{lowestPrice}")
     67    public ResponseEntity<Object> setLowestPriceForPhone(@PathVariable("phoneId") Long phoneId,
     68                                                         @PathVariable("lowestPrice") int lowestPrice){
     69        return phoneService.setLowestPriceForPhone(phoneId,lowestPrice);
     70    }
     71
     72    @PutMapping(path = "/setimageurl/{phoneId}", consumes = {
     73            MediaType.APPLICATION_JSON_VALUE,
     74            MediaType.APPLICATION_XML_VALUE
     75    }, produces = {
     76            MediaType.APPLICATION_JSON_VALUE,
     77            MediaType.APPLICATION_XML_VALUE
     78    })
     79    public ResponseEntity<Object> setImageUrlForPhone(@PathVariable("phoneId") Long phoneId,
     80                                                         @RequestBody String newImageUrl){
     81        return phoneService.setImageUrlForPhone(phoneId,newImageUrl);
     82    }
     83
     84
    5285}
Note: See TracChangeset for help on using the changeset viewer.