Added getCurrentStation
This commit is contained in:
parent
865d48cd63
commit
5246249bf8
@ -606,6 +606,41 @@ public class Controller {
|
|||||||
return ResponseEntity.status(200).body("Ok");
|
return ResponseEntity.status(200).body("Ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/api/getCurrentStation")
|
||||||
|
public ResponseEntity getStationFromUserAndCache(@RequestParam String token, @RequestParam String cacheID){
|
||||||
|
|
||||||
|
// verify user
|
||||||
|
ResponseEntity verifyToken = VerificationUtil.verifyToken(token);
|
||||||
|
|
||||||
|
if (verifyToken.getStatusCodeValue() != 200) {
|
||||||
|
return verifyToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get user
|
||||||
|
Claims claims = (Claims) verifyToken.getBody();
|
||||||
|
|
||||||
|
ResponseEntity getUser = FinderUtil.findUserFromClaim(claims);
|
||||||
|
|
||||||
|
if (getUser.getStatusCodeValue() != 200) {
|
||||||
|
return getUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
User user = (User) getUser.getBody();
|
||||||
|
|
||||||
|
//----------------------
|
||||||
|
//Get Cache
|
||||||
|
ResponseEntity getCache = FinderUtil.findCacheById(cacheID);
|
||||||
|
|
||||||
|
if (getCache.getStatusCodeValue() != 200) {
|
||||||
|
return getCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
Cache cache = (Cache) getCache.getBody();
|
||||||
|
//----------------------
|
||||||
|
|
||||||
|
return ResponseEntity.status(200).body(bearbeitetRepository.findByUserAndCache(user, cache));
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping("/api/hello")
|
@RequestMapping("/api/hello")
|
||||||
public ResponseEntity hello(@RequestParam String name) {
|
public ResponseEntity hello(@RequestParam String name) {
|
||||||
return ResponseEntity.status(200).body(userRepository.getRankingPlaceFromUser(name));
|
return ResponseEntity.status(200).body(userRepository.getRankingPlaceFromUser(name));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user