added a first implementation for /startCache
This commit is contained in:
parent
4ed03b2f3f
commit
99f8a26c9f
@ -1,13 +1,12 @@
|
|||||||
package hhn.labsw.bugageocaching.controller;
|
package hhn.labsw.bugageocaching.controller;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import hhn.labsw.bugageocaching.repositories.CacheRepository;
|
import hhn.labsw.bugageocaching.entities.*;
|
||||||
import hhn.labsw.bugageocaching.repositories.RewardRepository;
|
import hhn.labsw.bugageocaching.repositories.*;
|
||||||
import hhn.labsw.bugageocaching.repositories.StationRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import java.util.Optional;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class Controller {
|
public class Controller {
|
||||||
@ -21,10 +20,36 @@ public class Controller {
|
|||||||
@Autowired
|
@Autowired
|
||||||
StationRepository stationRepository;
|
StationRepository stationRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
BearbeitetRepository bearbeitetRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CacheAccesDefinitionRepository cacheAccesDefinitionRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TeamRepository teamRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
UserRepository userRepository;
|
||||||
|
|
||||||
@RequestMapping("/allCaches")
|
@RequestMapping("/allCaches")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String getAllCaches(){
|
public String getAllCaches(){
|
||||||
return new Gson().toJson(cacheRepository.findAll());
|
return new Gson().toJson(cacheRepository.findAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/startCache")
|
||||||
|
public @ResponseBody
|
||||||
|
Bearbeitet startCache(@RequestParam String userID,
|
||||||
|
@RequestParam String cacheID,
|
||||||
|
@RequestParam String cacheAccesDefinitionID) {
|
||||||
|
Bearbeitet bearbeitet = new Bearbeitet();
|
||||||
|
bearbeitet.setUserID(Integer.valueOf(userID));
|
||||||
|
bearbeitet.setCacheID(Integer.valueOf(cacheID));
|
||||||
|
bearbeitet.setCacheAccesDefinitionID(Integer.valueOf(cacheAccesDefinitionID));
|
||||||
|
|
||||||
|
bearbeitetRepository.save(bearbeitet);
|
||||||
|
|
||||||
|
return bearbeitet;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user