source: phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/PhoneController.java@ b68ae8d

Last change on this file since b68ae8d was b68ae8d, checked in by Marko <Marko@…>, 2 years ago

Created spring app, edited setec_scrapper

  • Property mode set to 100644
File size: 870 bytes
Line 
1package finki.it.phoneluxbackend.controllers;
2
3import finki.it.phoneluxbackend.entities.Phone;
4import finki.it.phoneluxbackend.entities.PhoneOffer;
5import finki.it.phoneluxbackend.services.PhoneService;
6import org.springframework.beans.factory.annotation.Autowired;
7import org.springframework.web.bind.annotation.*;
8
9import java.util.List;
10
11@RestController
12@RequestMapping(path = "/")
13public class PhoneController {
14 private final PhoneService phoneService;
15
16 @Autowired
17 public PhoneController(PhoneService phoneService) {
18 this.phoneService = phoneService;
19 }
20
21 @GetMapping
22 public List<Phone> getPhones(){
23 return phoneService.getPhones();
24 }
25
26 @PostMapping(path = "{phoneId}")
27 public List<PhoneOffer> getOffersForPhone(@PathVariable("phoneId") Long phoneId){
28 return phoneService.getOffersForPhone(phoneId);
29 }
30
31}
Note: See TracBrowser for help on using the repository browser.