-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResourceRestController.java
35 lines (29 loc) · 1.24 KB
/
ResourceRestController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package dungeon.trading.resource;
import net.minidev.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
public class ResourceRestController {
private final ResourceService resourceService;
public ResourceRestController(
ResourceService resourceService) {
this.resourceService = resourceService;
}
@GetMapping("/resources")
public ResponseEntity<?> getInformationAboutAllResources() {
JSONArray resources = this.resourceService.getResources();
return new ResponseEntity<JSONArray>(resources, HttpStatus.OK);
}
@GetMapping("/resources/history/price")
public ResponseEntity<?> getResourcePriceHistory() {
JSONArray resources = this.resourceService.getResourcePriceHistory();
return new ResponseEntity<JSONArray>(resources, HttpStatus.OK);
}
@GetMapping("/resources/history/sell")
public ResponseEntity<?> getResourceSellHistory() {
JSONArray resources = this.resourceService.getResourceSellHistory();
return new ResponseEntity<JSONArray>(resources, HttpStatus.OK);
}
}