Added edit Cache
This commit is contained in:
parent
ec4202a5aa
commit
c5ffa61eda
@ -324,6 +324,32 @@ public class Controller {
|
|||||||
return createCacheUtil(cache);
|
return createCacheUtil(cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/api/editCache", method = RequestMethod.PUT, produces = "application/json")
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseEntity editCache(@RequestBody Cache newCache){
|
||||||
|
|
||||||
|
//----------------------
|
||||||
|
//Get Cache
|
||||||
|
ResponseEntity getCache = FinderUtil.findCacheById(newCache.getId() + "");
|
||||||
|
|
||||||
|
if (getCache.getStatusCodeValue() != 200) {
|
||||||
|
return getCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
Cache oldCache = (Cache) getCache.getBody();
|
||||||
|
//----------------------
|
||||||
|
|
||||||
|
oldCache.setDescription(newCache.getDescription());
|
||||||
|
oldCache.setName(newCache.getName());
|
||||||
|
oldCache.setRankingPoints(newCache.getRankingPoints());
|
||||||
|
oldCache.setReward(newCache.getReward());
|
||||||
|
oldCache.setStationen(newCache.getStationen());
|
||||||
|
|
||||||
|
cacheRepository.save(oldCache);
|
||||||
|
|
||||||
|
return ResponseEntity.status(200).body("Cache edited");
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "Checks if the given User has an admin role")
|
@ApiOperation(value = "Checks if the given User has an admin role")
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 404, message = "Database error"),
|
@ApiResponse(code = 404, message = "Database error"),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user