- Timestamp:
- 10/01/22 22:57:41 (2 years ago)
- Branches:
- master
- Children:
- 47f4eaf
- Parents:
- fd5b100
- Location:
- phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/AdminController.java
rfd5b100 rffd50db 23 23 MediaType.APPLICATION_XML_VALUE 24 24 }) 25 public ResponseEntity<Object> editOffer(@PathVariable("offerId") Long offerId, @RequestBody PhoneOffer editedOffer){ 25 public ResponseEntity<Object> editOffer(@PathVariable("offerId") Long offerId, @RequestBody PhoneOffer editedOffer) 26 { 26 27 27 28 return phoneOfferService.editOffer(offerId,editedOffer); -
phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/PhoneController.java
rfd5b100 rffd50db 6 6 import finki.it.phoneluxbackend.services.PhoneService; 7 7 import lombok.AllArgsConstructor; 8 import org.apache.coyote.Response; 8 9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.http.MediaType; 11 import org.springframework.http.ResponseEntity; 9 12 import org.springframework.web.bind.annotation.*; 10 13 … … 50 53 } 51 54 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 52 85 } -
phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/PhoneOfferController.java
rfd5b100 rffd50db 7 7 import lombok.AllArgsConstructor; 8 8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.http.ResponseEntity; 9 10 import org.springframework.web.bind.annotation.*; 10 11 … … 16 17 private final PhoneOfferService phoneOfferService; 17 18 19 20 @GetMapping(path = "/alloffers") 21 public List<PhoneOffer> getAllOffers(){ 22 return phoneOfferService.getAllOffers(); 23 } 18 24 @GetMapping(path = "/phones/offers/{phoneId}") 19 25 public List<PhoneOffer> getOffersForPhone(@PathVariable("phoneId") Long phoneId){ … … 22 28 23 29 @GetMapping(path = "/multipleoffers") 24 public List<PhoneOffer> get PhoneOffer(@RequestParam("offerIds") String offerIds){30 public List<PhoneOffer> getMultiplePhoneOffers(@RequestParam("offerIds") String offerIds){ 25 31 return phoneOfferService.getMultiplePhoneOffers(offerIds); 26 32 } … … 58 64 } 59 65 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 } 60 91 }
Note:
See TracChangeset
for help on using the changeset viewer.