fixed merge problems
This commit is contained in:
parent
2509d0dc6d
commit
8636443f87
@ -10,7 +10,11 @@
|
|||||||
<q-dialog v-model="reward">
|
<q-dialog v-model="reward">
|
||||||
<q-card>
|
<q-card>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div>Jetzt ist eine gute Zeit, etwas Neues zu beginnen.</div>
|
<div class="text-h6">Deine Belohnung: </div>
|
||||||
|
</q-card-section>
|
||||||
|
|
||||||
|
<q-card-section>
|
||||||
|
<div>{{ cache.reward.rewardDescription }}</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
@ -27,6 +31,9 @@
|
|||||||
reward: false,
|
reward: false,
|
||||||
cacheID: "",
|
cacheID: "",
|
||||||
cacheName: "",
|
cacheName: "",
|
||||||
|
cache: {
|
||||||
|
reward: "",
|
||||||
|
},
|
||||||
rankingPoints: "",
|
rankingPoints: "",
|
||||||
end1: "Gut gemacht, Du hast alle Stationen dieses Cache gefunden. Dir wurden ",
|
end1: "Gut gemacht, Du hast alle Stationen dieses Cache gefunden. Dir wurden ",
|
||||||
end2: " Punkte gutgeschrieben." //TODO Punkte wirklich gutschreiben, ggf. Cache auf erledigt setzen
|
end2: " Punkte gutgeschrieben." //TODO Punkte wirklich gutschreiben, ggf. Cache auf erledigt setzen
|
||||||
@ -45,10 +52,10 @@
|
|||||||
this.$axios.get('/api/allCaches')
|
this.$axios.get('/api/allCaches')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log("/api/allCaches");
|
console.log("/api/allCaches");
|
||||||
console.log(JSON.stringify(this.data));
|
console.log(JSON.stringify(this.response.data));
|
||||||
console.log(this.data);
|
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
const cache = response.data.find(cache => cache.id === Number(this.$route.params.cache));
|
const cache = response.data.find(cache => cache.id === Number(this.$route.params.cache));
|
||||||
|
this.cache = cache;
|
||||||
this.cacheName = cache.name;
|
this.cacheName = cache.name;
|
||||||
this.rankingPoints = cache.rankingPoints;
|
this.rankingPoints = cache.rankingPoints;
|
||||||
this.cacheID = this.$route.params.cache;
|
this.cacheID = this.$route.params.cache;
|
||||||
|
|||||||
@ -48,9 +48,6 @@ public class Controller {
|
|||||||
@Autowired
|
@Autowired
|
||||||
User_InfoRepository user_infoRepository;
|
User_InfoRepository user_infoRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
TeamInviteRepository teamInviteRepository;
|
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
fetchPublicKey();
|
fetchPublicKey();
|
||||||
@ -546,7 +543,7 @@ public class Controller {
|
|||||||
|
|
||||||
user_infoRepository.save(user_info);
|
user_infoRepository.save(user_info);
|
||||||
|
|
||||||
return ResponseEntity.status(200).body(new Gson().toJson(team));
|
return ResponseEntity.status(200).body(team);
|
||||||
}
|
}
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
||||||
@ -609,186 +606,6 @@ public class Controller {
|
|||||||
return ResponseEntity.status(200).body("Ok");
|
return ResponseEntity.status(200).body("Ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
|
||||||
@RequestMapping("/api/sendTeamInvite")
|
|
||||||
@ResponseBody
|
|
||||||
public ResponseEntity sendTeamInvite(@RequestParam String token,
|
|
||||||
@RequestParam String invitedUserEmail) {
|
|
||||||
// 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 InvitedUser
|
|
||||||
|
|
||||||
User invitedUser = userRepository.findByEmail(invitedUserEmail);
|
|
||||||
|
|
||||||
if (invitedUser == null) {
|
|
||||||
return ResponseEntity.status(404).body("There isnt any user with that email");
|
|
||||||
}
|
|
||||||
//----------------------
|
|
||||||
|
|
||||||
|
|
||||||
//Get User_Info
|
|
||||||
ResponseEntity getUser_Info = FinderUtil.findUser_InfoByID(String.valueOf(user.getId()));
|
|
||||||
|
|
||||||
if (getUser_Info.getStatusCodeValue() != 200) {
|
|
||||||
return getUser_Info;
|
|
||||||
}
|
|
||||||
|
|
||||||
User_Info user_info = (User_Info) getUser_Info.getBody();
|
|
||||||
//----------------------
|
|
||||||
if (user_info.getTeam() == null) {
|
|
||||||
return ResponseEntity.status(400).body("You aren´t in any team");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get team
|
|
||||||
ResponseEntity getTeam = FinderUtil.findTeamById(String.valueOf(user_info.getTeam().getId()));
|
|
||||||
|
|
||||||
if (getTeam.getStatusCodeValue() != 200) {
|
|
||||||
return getTeam;
|
|
||||||
}
|
|
||||||
|
|
||||||
Team team = (Team) getTeam.getBody();
|
|
||||||
|
|
||||||
if (teamInviteRepository.findByUserAndTeam(invitedUser, team) != null) {
|
|
||||||
return ResponseEntity.status(400).body("The user is already invited to this team");
|
|
||||||
}
|
|
||||||
|
|
||||||
TeamInvite teamInvite = new TeamInvite();
|
|
||||||
teamInvite.setUser(invitedUser);
|
|
||||||
teamInvite.setTeam(team);
|
|
||||||
|
|
||||||
teamInviteRepository.save(teamInvite);
|
|
||||||
|
|
||||||
return ResponseEntity.status(200).body("OK");
|
|
||||||
}
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
|
||||||
@RequestMapping("/api/getMyTeamInvites")
|
|
||||||
@ResponseBody
|
|
||||||
public ResponseEntity getMyTeamInvites(@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();
|
|
||||||
|
|
||||||
List<TeamInvite> teamInvitesList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (TeamInvite teamInvite : teamInviteRepository.findAll()) {
|
|
||||||
if (teamInvite.getUser() == user) {
|
|
||||||
teamInvitesList.add(teamInvite);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResponseEntity.status(200).body(new Gson().toJson(teamInvitesList));
|
|
||||||
}
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
|
||||||
@RequestMapping("/api/deleteTeamInvite")
|
|
||||||
@ResponseBody
|
|
||||||
public ResponseEntity deleteTeamInvite(@RequestParam String token,
|
|
||||||
@RequestParam String teamInviteID) {
|
|
||||||
// verify user
|
|
||||||
ResponseEntity verifyToken = VerificationUtil.verifyToken(token);
|
|
||||||
|
|
||||||
if (verifyToken.getStatusCodeValue() != 200) {
|
|
||||||
return verifyToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get teaminvite
|
|
||||||
ResponseEntity getTeamInvite = FinderUtil.findTeamInviteByID(teamInviteID);
|
|
||||||
|
|
||||||
if (getTeamInvite.getStatusCodeValue() != 200) {
|
|
||||||
return getTeamInvite;
|
|
||||||
}
|
|
||||||
|
|
||||||
TeamInvite teamInvite = (TeamInvite) getTeamInvite.getBody();
|
|
||||||
|
|
||||||
teamInviteRepository.delete(teamInvite);
|
|
||||||
|
|
||||||
return ResponseEntity.status(200).body("OK");
|
|
||||||
}
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
|
||||||
@RequestMapping("/api/setTeamStatus")
|
|
||||||
@ResponseBody
|
|
||||||
public ResponseEntity setTeamStatus(@RequestParam String token,
|
|
||||||
@RequestParam String teamStatus) {
|
|
||||||
// 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 User_Info
|
|
||||||
ResponseEntity getUser_Info = FinderUtil.findUser_InfoByID(String.valueOf(user.getId()));
|
|
||||||
|
|
||||||
if (getUser_Info.getStatusCodeValue() != 200) {
|
|
||||||
return getUser_Info;
|
|
||||||
}
|
|
||||||
|
|
||||||
User_Info user_info = (User_Info) getUser_Info.getBody();
|
|
||||||
//----------------------
|
|
||||||
if (user_info.getTeam() == null) {
|
|
||||||
return ResponseEntity.status(400).body("You aren´t in any team");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get team
|
|
||||||
ResponseEntity getTeam = FinderUtil.findTeamById(String.valueOf(user_info.getTeam().getId()));
|
|
||||||
|
|
||||||
if (getTeam.getStatusCodeValue() != 200) {
|
|
||||||
return getTeam;
|
|
||||||
}
|
|
||||||
|
|
||||||
Team team = (Team) getTeam.getBody();
|
|
||||||
team.setTeamStatus(teamStatus);
|
|
||||||
|
|
||||||
teamRepository.save(team);
|
|
||||||
|
|
||||||
return ResponseEntity.status(200).body(new Gson().toJson(teamStatus));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@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));
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import org.springframework.data.repository.CrudRepository;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface UserRepository extends CrudRepository<User, Integer> {
|
public interface UserRepository extends CrudRepository<User, Integer> {
|
||||||
User findByEmail(String email);
|
User findByUsername(String username);
|
||||||
|
|
||||||
@Query(value = "SELECT DISTINCT u.id AS ID, SUBSTRING_INDEX(u.email, '@', 1) AS Name, ui.ranking_points_sum AS Ranglistenpunkte\n" +
|
@Query(value = "SELECT DISTINCT u.id AS ID, SUBSTRING_INDEX(u.email, '@', 1) AS Name, ui.ranking_points_sum AS Ranglistenpunkte\n" +
|
||||||
"FROM user u,\n" +
|
"FROM user u,\n" +
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user