Merge branch 'develop' into frontend/robin
This commit is contained in:
commit
6251a6b25f
@ -991,22 +991,26 @@ public class Controller {
|
|||||||
poisList.add(poi);
|
poisList.add(poi);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Bearbeitet bearbeitet : bearbeitetRepository.findAll()) {
|
for (Bearbeitet bearbeitet : bearbeitetRepository.findByUser(user)) {
|
||||||
if (bearbeitet.getUser() == user) {
|
Cache cache = bearbeitet.getCache();
|
||||||
Cache cache = bearbeitet.getCache();
|
Station aktuelleStation = bearbeitet.getAktuelleStation();
|
||||||
Station aktuelleStation = bearbeitet.getAktuelleStation();
|
int index = cache.getStationen().indexOf(aktuelleStation);
|
||||||
int index = cache.getStationen().indexOf(aktuelleStation);
|
for (int i = 1; i <= index; i++) {
|
||||||
for (int i = 1; i <= index; i++) {
|
Station station = cache.getStationen().get(i);
|
||||||
Station station = cache.getStationen().get(i);
|
int categoryID;
|
||||||
int categoryID;
|
if (i < cache.getStationen().size() - 1) { // isnt endstation
|
||||||
if (i < cache.getStationen().size() - 1) { // isnt endstation
|
categoryID = 201;
|
||||||
categoryID = 201;
|
if (i == index) {
|
||||||
} else { // is endstation
|
POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID);
|
||||||
categoryID = 203;
|
poisList.add(poi);
|
||||||
}
|
}
|
||||||
|
} else { // is endstation
|
||||||
|
categoryID = 203;
|
||||||
POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID);
|
POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID);
|
||||||
poisList.add(poi);
|
poisList.add(poi);
|
||||||
}
|
}
|
||||||
|
//POI poi = new POI(cache.getName() + "_Station" + (i + 1), (float) station.getLattitude(), (float) station.getLongitude(), categoryID);
|
||||||
|
//poisList.add(poi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1026,7 +1030,7 @@ public class Controller {
|
|||||||
})
|
})
|
||||||
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
||||||
@RequestMapping(value = "/api/getTeamOfUser", method = RequestMethod.GET, produces = "application/json")
|
@RequestMapping(value = "/api/getTeamOfUser", method = RequestMethod.GET, produces = "application/json")
|
||||||
public ResponseEntity getTeamOfUser(@RequestParam String token){
|
public ResponseEntity getTeamOfUser(@RequestParam String token) {
|
||||||
|
|
||||||
// verify user
|
// verify user
|
||||||
ResponseEntity verifyToken = VerificationUtil.verifyToken(token);
|
ResponseEntity verifyToken = VerificationUtil.verifyToken(token);
|
||||||
|
|||||||
@ -6,6 +6,9 @@ import hhn.labsw.bugageocaching.entities.User;
|
|||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface BearbeitetRepository extends JpaRepository<Bearbeitet, Integer> {
|
public interface BearbeitetRepository extends JpaRepository<Bearbeitet, Integer> {
|
||||||
Bearbeitet findByUserAndCache(User user, Cache cache);
|
Bearbeitet findByUserAndCache(User user, Cache cache);
|
||||||
|
List<Bearbeitet> findByUser(User user);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,14 +14,10 @@ public interface TeamRepository extends JpaRepository<Team, Integer> {
|
|||||||
|
|
||||||
@Query(value = "SELECT *\n" +
|
@Query(value = "SELECT *\n" +
|
||||||
"FROM user\n" +
|
"FROM user\n" +
|
||||||
"WHERE id = (\n" +
|
"WHERE id IN (\n" +
|
||||||
" SELECT user_id\n" +
|
" SELECT user_id\n" +
|
||||||
" FROM user_info\n" +
|
" FROM user_info\n" +
|
||||||
" WHERE team_id = (SELECT team_id\n" +
|
" WHERE team_id = (SELECT team_id FROM team WHERE name = ?1))", nativeQuery = true)
|
||||||
" FROM team\n" +
|
|
||||||
" WHERE name = ?1\n" +
|
|
||||||
" )\n" +
|
|
||||||
")", nativeQuery = true)
|
|
||||||
List<Object[]> getTeammembers(String name);
|
List<Object[]> getTeammembers(String name);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -184,7 +184,8 @@ public class FinderUtil {
|
|||||||
sendBack.add(tmp);
|
sendBack.add(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.status(200).body(sendBack);
|
|
||||||
|
return ResponseEntity.status(200).body(list);
|
||||||
} else {
|
} else {
|
||||||
return ResponseEntity.status(404).body("Couldnt find Team member of Team " + name);
|
return ResponseEntity.status(404).body("Couldnt find Team member of Team " + name);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user