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 | |
---|
1 | package finki.it.phoneluxbackend.controllers;
|
---|
2 |
|
---|
3 | import finki.it.phoneluxbackend.entities.Phone;
|
---|
4 | import finki.it.phoneluxbackend.entities.PhoneOffer;
|
---|
5 | import finki.it.phoneluxbackend.services.PhoneService;
|
---|
6 | import org.springframework.beans.factory.annotation.Autowired;
|
---|
7 | import org.springframework.web.bind.annotation.*;
|
---|
8 |
|
---|
9 | import java.util.List;
|
---|
10 |
|
---|
11 | @RestController
|
---|
12 | @RequestMapping(path = "/")
|
---|
13 | public 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.