Merge branch 'develop' into frontend/robin
This commit is contained in:
commit
c99b929076
@ -7,7 +7,7 @@ plugins {
|
||||
apply plugin: 'io.spring.dependency-management'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'com.moowork.node'
|
||||
//apply plugin: 'war'
|
||||
apply plugin: 'war'
|
||||
|
||||
group = 'de.hhn.labsw'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
@ -47,7 +47,7 @@ dependencies {
|
||||
compile group: 'org.springframework.security', name: 'spring-security-core', version: '5.1.4.RELEASE'
|
||||
//compile group: 'at.favre.lib', name: 'bcrypt', version: '{latest-version}'
|
||||
|
||||
//providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
|
||||
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
|
||||
|
||||
//JWT
|
||||
compile 'io.jsonwebtoken:jjwt-api:0.10.5'
|
||||
|
||||
@ -9,7 +9,6 @@ import hhn.labsw.bugageocaching.repositories.*;
|
||||
import hhn.labsw.bugageocaching.util.FinderUtil;
|
||||
import hhn.labsw.bugageocaching.util.VerificationUtil;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
@ -1036,6 +1035,38 @@ public class Controller {
|
||||
return ResponseEntity.status(200).body(new Gson().toJson(pois));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Returns the Team of a user")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 404, message = "Database error"),
|
||||
@ApiResponse(code = 401, message = "JWT Token expired"),
|
||||
@ApiResponse(code = 400, message = "Something went wrong at verification")
|
||||
})
|
||||
@RequestMapping(value = "/api/getTeamOfUser", method = RequestMethod.GET, produces = "application/json")
|
||||
public ResponseEntity getTeamOfUser(@RequestParam String token){
|
||||
|
||||
// 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();
|
||||
|
||||
User_Info user_info = user_infoRepository.findUser_InfoByUser(user);
|
||||
|
||||
return ResponseEntity.status(200).body(user_info.getTeam());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Test method (Changes its purpose often)")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 404, message = "Database error"),
|
||||
@ -1047,6 +1078,7 @@ public class Controller {
|
||||
public ResponseEntity hello(@RequestParam String name) {
|
||||
return ResponseEntity.status(200).body(userRepository.getRankingPlaceFromUser(name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user