From 01d860542b453d3c408629ddbef968513527e4a7 Mon Sep 17 00:00:00 2001 From: Maximilian Leopold Date: Fri, 5 Apr 2019 11:04:53 +0200 Subject: [PATCH 1/2] Changed some ResponseEntities --- .../bugageocaching/controller/Controller.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java index a2e93df..a962339 100644 --- a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java +++ b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java @@ -109,8 +109,8 @@ public class Controller { CacheAccesDefinition cacheAccesDefinition = cacheAccesDefinitionOptional.get(); bearbeitet.setCacheAccesDefinition(cacheAccesDefinition); } else { - throw new IllegalParameterException("There is no cacheAccesDefinition with the ID " + 0); - } + return ResponseEntity.status(404).body("There is no cacheAccesDefinition with the ID " + 0); + } bearbeitetRepository.save(bearbeitet); @@ -147,11 +147,11 @@ public class Controller { @RequestMapping("/api/createStation") @ResponseBody public ResponseEntity createStation(@RequestParam String description, - @RequestParam String lattitude, + @RequestParam String latitude, @RequestParam String longitude, @RequestParam String solution) { - if (description.length() == 0 || lattitude.length() == 0 || longitude.length() == 0 || solution.length() == 0) { + if (description.length() == 0 || latitude.length() == 0 || longitude.length() == 0 || solution.length() == 0) { return ResponseEntity.status(400).body("At least one Argument was empty"); } @@ -159,9 +159,9 @@ public class Controller { double longi; try { - latti = Double.valueOf(lattitude); + latti = Double.valueOf(latitude); if (latti < -90 || latti > 90) { - return ResponseEntity.status(400).body("Lattitude has to be between -90 and 90 Degree"); + return ResponseEntity.status(400).body("Latitude has to be between -90 and 90 Degree"); } } catch (NumberFormatException e) { return ResponseEntity.status(400).body("Latitude has to be a decimal"); @@ -198,6 +198,9 @@ public class Controller { @ResponseBody public ResponseEntity checkAdmin(@RequestParam String token) { User user = userRepository.findByUsername(token.substring(0, token.indexOf("$"))); + if(user == null){ + return ResponseEntity.status(404).body("User was not found"); + } for (Role role : user.getRoles()) { if (role.getId() == 0) { // is admin return ResponseEntity.status(200).body("User is Admin"); From 239dc92b5801f7f5539275bef0788a2bac8840fe Mon Sep 17 00:00:00 2001 From: Timo Volkmann Date: Fri, 5 Apr 2019 14:40:10 +0200 Subject: [PATCH 2/2] changes in Cache & Station Editpages, added cacheCollector Store --- frontend/quasar.conf.js | 2 + frontend/src/pages/Cache.vue | 77 ++++++++++++++++--- frontend/src/pages/Overview.vue | 4 +- frontend/src/pages/StationEdit.vue | 57 +++++++++++--- frontend/src/store/cacheCollector/actions.js | 4 + frontend/src/store/cacheCollector/getters.js | 4 + frontend/src/store/cacheCollector/index.js | 12 +++ .../src/store/cacheCollector/mutations.js | 4 + frontend/src/store/cacheCollector/state.js | 3 + frontend/src/store/index.js | 22 ++---- 10 files changed, 152 insertions(+), 37 deletions(-) create mode 100644 frontend/src/store/cacheCollector/actions.js create mode 100644 frontend/src/store/cacheCollector/getters.js create mode 100644 frontend/src/store/cacheCollector/index.js create mode 100644 frontend/src/store/cacheCollector/mutations.js create mode 100644 frontend/src/store/cacheCollector/state.js diff --git a/frontend/quasar.conf.js b/frontend/quasar.conf.js index 42861b5..b557976 100644 --- a/frontend/quasar.conf.js +++ b/frontend/quasar.conf.js @@ -64,6 +64,8 @@ module.exports = function (ctx) { 'QExpansionItem', 'QParallax', 'QEditor', + 'QSelect', + 'QField', ], directives: [ diff --git a/frontend/src/pages/Cache.vue b/frontend/src/pages/Cache.vue index 896ba01..513310e 100644 --- a/frontend/src/pages/Cache.vue +++ b/frontend/src/pages/Cache.vue @@ -1,19 +1,76 @@