diff --git a/build.gradle b/build.gradle index 3dc4e7d..3968fb4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id 'org.springframework.boot' version '2.1.3.RELEASE' id 'java' + id 'org.asciidoctor.jvm.convert' version '2.2.0' } apply plugin: 'io.spring.dependency-management' @@ -13,6 +14,8 @@ sourceCompatibility = '1.8' repositories { mavenCentral() + jcenter() + maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' } } bootWar{ @@ -73,6 +76,6 @@ dependencies { testCompile group: 'junit', name: 'junit', version: '4.+' - + compile "io.github.swagger2markup:swagger2markup:1.3.1" } \ No newline at end of file diff --git a/labswp_2019_sose_geocaching.ipr b/labswp_2019_sose_geocaching.ipr new file mode 100644 index 0000000..f2ae5ac --- /dev/null +++ b/labswp_2019_sose_geocaching.ipr @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.6 + + + + + + + + + + + + + diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/CacheStart.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/CacheStart.vue index 951b7af..0803193 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/CacheStart.vue +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/CacheStart.vue @@ -9,7 +9,7 @@ - + @@ -87,6 +87,7 @@ Vue.use(VueLayers); this.stationID = cache.stationen[0]; this.lon = this.stationID.longitude; this.lat = this.stationID.lattitude; + this.center = [this.lon, this.lat] }) }, checkStation() { diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Profile.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Profile.vue index dc1fc1b..9e19de5 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Profile.vue +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Profile.vue @@ -32,6 +32,7 @@ - - - - - - - - - - - - + Nutzer zu Administrator befördern + + + + + + @@ -191,6 +194,7 @@ boolStatus: false, boolTable: true, boolMemberTableUpdating: false, + newAdminMail: "", teamColumns: [ { name: 'desc', @@ -216,7 +220,6 @@ page: 1, rowsPerPage: 10 }, - // newAdminMail: "", } }, mounted: function () { @@ -279,6 +282,20 @@ }).onDismiss(() => { }) }, + confirmAddAdmin(newAdmin) { + this.$q.dialog({ + title: 'Administrator hinzufügen', + message: 'Willst du den Nutzer ' + newAdmin.name + ' mit der Email ' + newAdmin.email + ' wirklich zum Administrator befördern?', + persistent: true, + cancel: true, + }).onOk(() => { + console.log('>>>> OK'); + this.addAdmin(newAdmin); + }).onCancel(() => { + console.log('>>>> Cancel') + }).onDismiss(() => { + }) + }, activateInvite() { if (this.inviteActivated) { this.inviteActivated = false; @@ -516,73 +533,69 @@ }); this.updateStatus(); }, - // getUser() { - // const data = { - // "email" : this.newAdminMail - // } - // JSON.stringify(data); - // const token = JSON.parse(localStorage.getItem('userToken')).token; - // this.$axios.get(process.env.USER_API + '/account/email', data, { - // headers: { - // 'Authorization': 'Bearer ' + token, - // } - // }).then((response) => { - // let newAdminAccount = response.data; - // if (response.status === 200) { - // this.addAdmin(JSON.parse(response).data); - // } - // }) - // .catch((error) => { - // let message; - // let header = "Unbekannter Fehler..."; - // if (error.response) { - // console.log(error.response) - // if (error.response.status === 400) { - // message = "Es gibt keinen Nutzer mit dieser Email!"; - // header = "Email überprüfen!"; - // } - // } else if (error.request) { - // console.log(error.request); - // header = "Anfrage fehlgeschlagen!"; - // message = "Die Verbindung zum Server ist gestört. Versuchen Sie es später noch einmal."; - // } - // this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: message, title: header}); - // }); - // }, - // addAdmin(newAdmin) { - // const token = JSON.parse(localStorage.getItem('userToken')).token; - // newAdmin.roles.role = "ADMIN"; - // JSON.stringify(newAdmin); - // this.$axios.patch(process.env.USER_API, '/account', newAdmin, { - // headers: { - // 'Authorization': 'Bearer ' + token, - // } - // }).then((response) => { - // if (response.status === 200) { - // this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { - // message: "Du hast den Nutzer mit der Email " + this.newAdminMail + " als Admin freigeschalten!", - // title: "Nutzerverwaltung", - // color: "blue" - // }); - // } - // }) - // .catch((error) => { - // let message; - // let header = "Unbekannter Fehler..."; - // if (error.response) { - // console.log(error.response) - // if (error.response.status === 400) { - // message = JSON.parse(error).error; - // header = "Probleme mit dem zu bearbeitenden Nutzeraccount!"; - // } - // } else if (error.request) { - // console.log(error.request); - // header = "Anfrage fehlgeschlagen!"; - // message = "Die Verbindung zum Server ist gestört. Versuchen Sie es später noch einmal."; - // } - // this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: message, title: header}); - // }); - // }, + getUser() { + const token = JSON.parse(localStorage.getItem('userToken')).token; + this.$axios.get(process.env.USER_API + '/account/email/' + this.newAdminMail, { + headers: { + 'Authorization': 'Bearer ' + token, + } + }).then((response) => { + let newAdminAccount = response.data; + if (response.status === 200) { + this.confirmAddAdmin(response.data); + } + }) + .catch((error) => { + let message; + let header = "Unbekannter Fehler..."; + if (error.response) { + console.log(error.response) + if (error.response.status === 400) { + message = "Es gibt keinen Nutzer mit dieser Email!"; + header = "Email überprüfen!"; + } + } else if (error.request) { + console.log(error.request); + header = "Anfrage fehlgeschlagen!"; + message = "Die Verbindung zum Server ist gestört. Versuchen Sie es später noch einmal."; + } + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: message, title: header}); + }); + }, + addAdmin(newAdmin) { + const token = JSON.parse(localStorage.getItem('userToken')).token; + newAdmin.roles.role = "ADMIN"; + JSON.stringify(newAdmin); + this.$axios.patch(process.env.USER_API, '/account', newAdmin, { + headers: { + 'Authorization': 'Bearer ' + token, + } + }).then((response) => { + if (response.status === 200) { + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { + message: "Du hast den Nutzer mit der Email " + this.newAdminMail + " als Admin freigeschalten!", + title: "Nutzerverwaltung", + color: "blue" + }); + } + }) + .catch((error) => { + let message; + let header = "Unbekannter Fehler..."; + if (error.response) { + console.log(error.response) + if (error.response.status === 400) { + message = JSON.parse(error).error; + header = "Probleme mit dem zu bearbeitenden Nutzeraccount!"; + } + } else if (error.request) { + console.log(error.request); + header = "Anfrage fehlgeschlagen!"; + message = "Die Verbindung zum Server ist gestört. Versuchen Sie es später noch einmal."; + } + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: message, title: header}); + }); + }, handleError(error) { let msg; let title; diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Register.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Register.vue index 430436f..c627de1 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Register.vue +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/Register.vue @@ -98,7 +98,7 @@ methods: { validateEmail(email) { //var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - let re = new RegExp('^[a-zA-Z0-9.!#$%&\'*+/=?^_`{|}~-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$'); + let re = new RegExp('/^(([^<>()\\[\\]\\\\.,;:\\s@"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@"]+)*)|(".+"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/'); return re.test(String(email).toLowerCase()); }, register: function () { diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationView.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationView.vue index 487d6bd..20c7c2c 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationView.vue +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationView.vue @@ -4,12 +4,21 @@ data-projection="EPSG:4326" style="height: 200px" v-if="!cameraActive"> - + - + + + + + + + + + + @@ -57,13 +66,14 @@ Vue.use(VueLayers); stationen: [], }, station: {}, - markercolor: "red", + markercolor: "grey", cameraActive: false, result: null, zoom: 15, center: [ 9.208858198755664, 49.14785422283188], rotation: 0, geolocPosition: undefined, + filteredStations: [], } }, beforeRouteUpdate(to, from, next) { @@ -105,24 +115,28 @@ Vue.use(VueLayers); }, methods: { fetchData() { - this.$axios.get('/api/allCaches') - .then((response) => { - console.log("/api/allCaches"); - console.log(response.data); - const cache = response.data.find(cache => cache.id === Number(this.$route.params.cache)); - this.cache = cache; - this.station = cache.stationen.find(station => station.id === Number(this.$route.params.id)); - this.cacheName = cache.name; - this.cacheID = this.$route.params.cache; - console.log(JSON.stringify(this.cache)); - console.log(JSON.stringify(this.station)); - console.log(this.cache); + if (localStorage.getItem('userToken')) { + let params = {cacheID: this.$route.params.cache}; + params.token = JSON.parse(localStorage.getItem('userToken')).token; + this.$axios.get('/api/getCurrentStation',{params}) + .then((response) => { + console.log("/api/getCurrentStation"); + console.log(response.data); + const cache = response.data.cache; + this.cache = cache; + this.station = response.data.aktuelleStation; + this.cacheName = cache.name; + this.cacheID = this.$route.params.cache; + console.log(JSON.stringify(this.cache)); + console.log(JSON.stringify(this.station)); + console.log(this.cache); + let stationIndex = this.cache.stationen.findIndex(s => s.id === this.station.id); + for( let i=0; i< stationIndex; i++){ + this.filteredStations.push(this.cache.stationen[i]) + } + this.center = [this.station.longitude, this.station.lattitude] }) - }, - - getMarkerURL(station) { - console.log(station); - return `./statics/map-marker_${this.markercolor}.svg` + } }, updateResult(event) { diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/ranking.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/ranking.vue index 63857cd..b865c7b 100644 --- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/ranking.vue +++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/ranking.vue @@ -24,11 +24,11 @@ - {{user.rank}}. {{user.username}} + {{user.rank}}. {{user.username}} - {{user.rank}}. {{user.username}} + {{user.rank}}. {{user.username}} @@ -39,19 +39,18 @@ - - - + { - console.log("Rankinglist: "); - console.log(response.data); - this.fetchRankinglist(); - }).catch((error) => { - }) + this.$axios.put('/api/resetSingleUser', null, {params: {token, username}}) + .then((response) => { + console.log("Rankinglist: "); + console.log(response.data); + this.fetchRankinglist(); + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { + message: "Die Ranglistenpunkte des Benutzers wurden erfolgreich zurückgesetzt!", + title: "Zurücksetzen", + color: "blue" + }); + }).catch((error) => { + let msg; + let title; + if (error.response) { + title = "Bitte Eingaben überprüfen!"; + msg = error.response.data; + } else if (error.request) { + title = "Verbindungsfehler!"; + msg = "Es konnte keine Verbindung zum Server aufgebaut werden. Versuchen Sie es später noch einmal!" + console.log(error.request); + } else { + title = "Error"; + msg = error.message; + console.log('Error', error.message); + } + console.log(error.config); + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); + }) + } else { + this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { + message: "Bitte geben Sie eine gültige Email ein", + title: "Ungültige Email", + color: "negative" + }); + } } else { this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: "Zum zurücksetzen der Punkte eines Nutzers gib bitte einen Usernamen ein", @@ -207,6 +239,11 @@ } }, + validateEmail(email) { + let re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + return re.test(String(email).toLowerCase()); + }, + } } diff --git a/src/main/java/hhn/labsw/bugageocaching/SwaggerMarkup.java b/src/main/java/hhn/labsw/bugageocaching/SwaggerMarkup.java new file mode 100644 index 0000000..19c881c --- /dev/null +++ b/src/main/java/hhn/labsw/bugageocaching/SwaggerMarkup.java @@ -0,0 +1,18 @@ +package hhn.labsw.bugageocaching; + +import io.github.swagger2markup.Swagger2MarkupConverter; + +import java.nio.file.Path; +import java.nio.file.Paths; + +public class SwaggerMarkup { + + public static void main(String[] args) { + Path localSwaggerFile = Paths.get("swagger.json"); + Path outputDirectory = Paths.get("build/asciidoc"); + + Swagger2MarkupConverter.from(localSwaggerFile) + .build() + .toFolder(outputDirectory); + } +} diff --git a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java index bbf0e1b..13d1bb9 100644 --- a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java +++ b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java @@ -425,7 +425,7 @@ public class Controller { for (RankingListHelper rankingListHelper: sendBackUsers) { logger.debug("RankingList Helper " + rankingListHelper.getUsername()); logger.debug("User: " + user.getUsername()); - if(rankingListHelper.getUsername().equals(user.getUsername())){ + if(rankingListHelper.getUsername().equals(user.getEmail())){ userAlreadyInRankingList = true; break; } @@ -435,7 +435,7 @@ public class Controller { ResponseEntity singlePlace = getRankingPlace(user.getEmail()); if (singlePlace.getStatusCodeValue() == 200) { - RankingListHelper rankingListHelper = new RankingListHelper(user.getUsername(), (Integer) user_infoRepository.findUser_InfoByUser(user).getRankingPointsSum(), (Integer) getRankingPlace(user.getEmail()).getBody()); + RankingListHelper rankingListHelper = new RankingListHelper(user.getEmail(), (Integer) user_infoRepository.findUser_InfoByUser(user).getRankingPointsSum(), (Integer) getRankingPlace(user.getEmail()).getBody()); logger.debug(String.valueOf((Integer) singlePlace.getBody())); sendBackUsers.add(rankingListHelper); } @@ -1323,7 +1323,12 @@ public class Controller { if (isAdmin) { - User deleteUser = userRepository.findByUsername(username); + User deleteUser = userRepository.findByEmail(username); + + + if(deleteUser == null) { + return ResponseEntity.status(400).body("Es wurde kein User mit dieser Email gefunden."); + } User_Info user_info = user_infoRepository.findUser_InfoByUser(deleteUser); user_info.setRankingPointsSum(0); diff --git a/src/main/java/hhn/labsw/bugageocaching/repositories/UserRepository.java b/src/main/java/hhn/labsw/bugageocaching/repositories/UserRepository.java index 9c920fe..a4a04a0 100644 --- a/src/main/java/hhn/labsw/bugageocaching/repositories/UserRepository.java +++ b/src/main/java/hhn/labsw/bugageocaching/repositories/UserRepository.java @@ -20,7 +20,7 @@ public interface UserRepository extends CrudRepository { // "LIMIT 10;", nativeQuery = true) // List getRankingList(); - @Query(value = "SELECT DISTINCT u.id AS ID, username AS Name, ui.ranking_points_sum AS Ranglistenpunkte, email Email\n" + + @Query(value = "SELECT DISTINCT u.id AS ID, u.email AS Name, ui.ranking_points_sum AS Ranglistenpunkte, email Email\n" + "FROM user u,\n" + " user_info ui,\n" + " user_roles ur\n" + diff --git a/swagger.json b/swagger.json new file mode 100644 index 0000000..cbb2ccf --- /dev/null +++ b/swagger.json @@ -0,0 +1,1676 @@ +{ + "swagger": "2.0", + "info": { + "description": "Api Documentation", + "version": "1.0", + "title": "Api Documentation", + "termsOfService": "urn:tos", + "contact": {}, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + }, + "host": "localhost:8080", + "basePath": "/", + "tags": [ + { + "name": "basic-error-controller", + "description": "Basic Error Controller" + }, + { + "name": "controller", + "description": "Controller" + } + ], + "paths": { + "/api/allCaches": { + "get": { + "tags": [ + "controller" + ], + "summary": "Retrieves all Caches, including their Stations, from the Database", + "operationId": "getAllCachesUsingGET", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + } + }, + "deprecated": false + } + }, + "/api/checkAdmin": { + "get": { + "tags": [ + "controller" + ], + "summary": "Checks if the given User has an admin role", + "operationId": "checkAdminUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/checkStation": { + "put": { + "tags": [ + "controller" + ], + "summary": "Checks if the given Station is the correct next Station in the Cache", + "operationId": "checkStationUsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "cacheID", + "in": "query", + "description": "cacheID", + "required": true, + "type": "string" + }, + { + "name": "durchgefuehrterCacheID", + "in": "query", + "description": "durchgefuehrterCacheID", + "required": true, + "type": "string" + }, + { + "name": "stationID", + "in": "query", + "description": "stationID", + "required": true, + "type": "string" + }, + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Given Station is NOT the correct following station" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/createCache": { + "post": { + "tags": [ + "controller" + ], + "summary": "Creates a new Cache", + "operationId": "createCacheUsingPOST", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "cache", + "description": "cache", + "required": true, + "schema": { + "$ref": "#/definitions/Cache" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something wrong with the given Parameters" + } + }, + "deprecated": false + } + }, + "/api/createTeam": { + "post": { + "tags": [ + "controller" + ], + "summary": "Creates a new Team", + "operationId": "createTeamUsingPOST", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "name", + "in": "query", + "description": "name", + "required": true, + "type": "string" + }, + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/deleteCache": { + "delete": { + "tags": [ + "controller" + ], + "summary": "Deletes a Cache", + "operationId": "deleteCacheUsingDELETE", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "cacheID", + "in": "query", + "description": "cacheID", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/deleteCacheForUser": { + "delete": { + "tags": [ + "controller" + ], + "summary": "Deletes the bearbeitet entry from a User from a Cache", + "operationId": "deleteCacheForUserUsingDELETE", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "cacheID", + "in": "query", + "description": "cacheID", + "required": true, + "type": "string" + }, + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/deleteTeamInvite": { + "delete": { + "tags": [ + "controller" + ], + "summary": "Removes a team invite from a user (called if a user declined a team invite)", + "operationId": "deleteTeamInviteUsingDELETE", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "teamInviteID", + "in": "query", + "description": "teamInviteID", + "required": true, + "type": "string" + }, + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/editCache": { + "put": { + "tags": [ + "controller" + ], + "summary": "Edits a Cache", + "operationId": "editCacheUsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "newCache", + "description": "newCache", + "required": true, + "schema": { + "$ref": "#/definitions/Cache" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something wrong with the given Parameters" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getAllStations": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns all Stations", + "operationId": "getAllStationsUsingGET", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getCurrentStation": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns the station the user is currently at (for a specific cache)", + "operationId": "getStationFromUserAndCacheUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "cacheID", + "in": "query", + "description": "cacheID", + "required": true, + "type": "string" + }, + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getCurrentStationMap": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns the Team of a user", + "operationId": "getCurrentStationMapUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "cacheID", + "in": "query", + "description": "cacheID", + "required": true, + "type": "string" + }, + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getMyCaches": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns all Caches finished/started by a given User", + "operationId": "getMyCachesUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getMyStationPOIS": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns startstations and all other stations the user already visited as POIS", + "operationId": "getMyStationPOISUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getMyTeamInvites": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns all User invites for a specific User", + "operationId": "getMyTeamInvitesUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getRankingList": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns the rankinglist", + "operationId": "getRankingListUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "token", + "in": "query", + "description": "token", + "required": false, + "type": "string", + "default": "null" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getRankingPlace": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns the ranking place on the leaderboard for a specific user", + "operationId": "getRankingPlaceUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "email", + "in": "query", + "description": "email", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getTeam": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns a team by a name", + "operationId": "getTeamUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "name", + "in": "query", + "description": "name", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getTeamMembers": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns all teammembers by the team name", + "operationId": "getTeamMembersUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "name", + "in": "query", + "description": "name", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getTeamOfUser": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns the Team of a user", + "operationId": "getTeamOfUserUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getTeamRankingList": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns the Team Rankinglist", + "operationId": "getTeamRankingListUsingGET", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/getUser": { + "get": { + "tags": [ + "controller" + ], + "summary": "Returns a user from a given token", + "operationId": "getUserUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/hello": { + "get": { + "tags": [ + "controller" + ], + "summary": "Test method (Changes its purpose often)", + "operationId": "helloUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "name", + "in": "query", + "description": "name", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/joinTeam": { + "put": { + "tags": [ + "controller" + ], + "summary": "Lets the user join a Team", + "operationId": "joinTeamUsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "teamID", + "in": "query", + "description": "teamID", + "required": true, + "type": "string" + }, + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/leaveTeam": { + "get": { + "tags": [ + "controller" + ], + "summary": "Removes the user from the Team", + "operationId": "leaveTeamUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + }, + "put": { + "tags": [ + "controller" + ], + "summary": "Removes the user from the Team", + "operationId": "leaveTeamUsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/resetRankingList": { + "get": { + "tags": [ + "controller" + ], + "summary": "Resets the rankinglist", + "operationId": "resetRankingListUsingGET", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/resetSingleUser": { + "put": { + "tags": [ + "controller" + ], + "summary": "Resets the points of a single User ", + "operationId": "resetSingleUserUsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + }, + { + "name": "username", + "in": "query", + "description": "username", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/sendTeamInvite": { + "post": { + "tags": [ + "controller" + ], + "summary": "Sends a Team Invite to the invitedUserEmail from the User (token)", + "operationId": "sendTeamInviteUsingPOST", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "invitedUserEmail", + "in": "query", + "description": "invitedUserEmail", + "required": true, + "type": "string" + }, + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/api/setTeamStatus": { + "put": { + "tags": [ + "controller" + ], + "summary": "Sets the team status", + "operationId": "setTeamStatusUsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "teamStatus", + "in": "query", + "description": "teamStatus", + "required": true, + "type": "string" + }, + { + "name": "token", + "in": "query", + "description": "token", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResponseEntity" + } + }, + "400": { + "description": "Something went wrong at verification" + }, + "401": { + "description": "JWT Token expired" + }, + "404": { + "description": "Database error" + } + }, + "deprecated": false + } + }, + "/error": { + "get": { + "tags": [ + "basic-error-controller" + ], + "summary": "error", + "operationId": "errorUsingGET", + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": { + "type": "object" + } + } + } + }, + "deprecated": false + }, + "head": { + "tags": [ + "basic-error-controller" + ], + "summary": "error", + "operationId": "errorUsingHEAD", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": { + "type": "object" + } + } + } + }, + "deprecated": false + }, + "post": { + "tags": [ + "basic-error-controller" + ], + "summary": "error", + "operationId": "errorUsingPOST", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": { + "type": "object" + } + } + } + }, + "deprecated": false + }, + "put": { + "tags": [ + "basic-error-controller" + ], + "summary": "error", + "operationId": "errorUsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": { + "type": "object" + } + } + } + }, + "deprecated": false + }, + "delete": { + "tags": [ + "basic-error-controller" + ], + "summary": "error", + "operationId": "errorUsingDELETE", + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": { + "type": "object" + } + } + } + }, + "deprecated": false + }, + "options": { + "tags": [ + "basic-error-controller" + ], + "summary": "error", + "operationId": "errorUsingOPTIONS", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": { + "type": "object" + } + } + } + }, + "deprecated": false + }, + "patch": { + "tags": [ + "basic-error-controller" + ], + "summary": "error", + "operationId": "errorUsingPATCH", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": { + "type": "object" + } + } + } + }, + "deprecated": false + } + } + }, + "definitions": { + "Cache": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "The Description of the Cache" + }, + "id": { + "type": "integer", + "format": "int32", + "description": "The autogenerated CacheID (Primary Key)" + }, + "name": { + "type": "string", + "description": "The name of the Cache" + }, + "rankingPoints": { + "type": "integer", + "format": "int32", + "description": "The number of ranking points the user gets fro completing the cache" + }, + "reward": { + "description": "The Reward for the Cache", + "$ref": "#/definitions/Reward" + }, + "stationen": { + "type": "array", + "description": "All stations included in the Cache", + "items": { + "$ref": "#/definitions/Station" + } + } + }, + "title": "Cache" + }, + "ModelAndView": { + "type": "object", + "properties": { + "empty": { + "type": "boolean" + }, + "model": { + "type": "object" + }, + "modelMap": { + "type": "object", + "additionalProperties": { + "type": "object" + } + }, + "reference": { + "type": "boolean" + }, + "status": { + "type": "string", + "enum": [ + "100 CONTINUE", + "101 SWITCHING_PROTOCOLS", + "102 PROCESSING", + "103 CHECKPOINT", + "200 OK", + "201 CREATED", + "202 ACCEPTED", + "203 NON_AUTHORITATIVE_INFORMATION", + "204 NO_CONTENT", + "205 RESET_CONTENT", + "206 PARTIAL_CONTENT", + "207 MULTI_STATUS", + "208 ALREADY_REPORTED", + "226 IM_USED", + "300 MULTIPLE_CHOICES", + "301 MOVED_PERMANENTLY", + "302 FOUND", + "302 MOVED_TEMPORARILY", + "303 SEE_OTHER", + "304 NOT_MODIFIED", + "305 USE_PROXY", + "307 TEMPORARY_REDIRECT", + "308 PERMANENT_REDIRECT", + "400 BAD_REQUEST", + "401 UNAUTHORIZED", + "402 PAYMENT_REQUIRED", + "403 FORBIDDEN", + "404 NOT_FOUND", + "405 METHOD_NOT_ALLOWED", + "406 NOT_ACCEPTABLE", + "407 PROXY_AUTHENTICATION_REQUIRED", + "408 REQUEST_TIMEOUT", + "409 CONFLICT", + "410 GONE", + "411 LENGTH_REQUIRED", + "412 PRECONDITION_FAILED", + "413 PAYLOAD_TOO_LARGE", + "413 REQUEST_ENTITY_TOO_LARGE", + "414 URI_TOO_LONG", + "414 REQUEST_URI_TOO_LONG", + "415 UNSUPPORTED_MEDIA_TYPE", + "416 REQUESTED_RANGE_NOT_SATISFIABLE", + "417 EXPECTATION_FAILED", + "418 I_AM_A_TEAPOT", + "419 INSUFFICIENT_SPACE_ON_RESOURCE", + "420 METHOD_FAILURE", + "421 DESTINATION_LOCKED", + "422 UNPROCESSABLE_ENTITY", + "423 LOCKED", + "424 FAILED_DEPENDENCY", + "426 UPGRADE_REQUIRED", + "428 PRECONDITION_REQUIRED", + "429 TOO_MANY_REQUESTS", + "431 REQUEST_HEADER_FIELDS_TOO_LARGE", + "451 UNAVAILABLE_FOR_LEGAL_REASONS", + "500 INTERNAL_SERVER_ERROR", + "501 NOT_IMPLEMENTED", + "502 BAD_GATEWAY", + "503 SERVICE_UNAVAILABLE", + "504 GATEWAY_TIMEOUT", + "505 HTTP_VERSION_NOT_SUPPORTED", + "506 VARIANT_ALSO_NEGOTIATES", + "507 INSUFFICIENT_STORAGE", + "508 LOOP_DETECTED", + "509 BANDWIDTH_LIMIT_EXCEEDED", + "510 NOT_EXTENDED", + "511 NETWORK_AUTHENTICATION_REQUIRED" + ] + }, + "view": { + "$ref": "#/definitions/View" + }, + "viewName": { + "type": "string" + } + }, + "title": "ModelAndView" + }, + "ResponseEntity": { + "type": "object", + "properties": { + "body": { + "type": "object" + }, + "statusCode": { + "type": "string", + "enum": [ + "100 CONTINUE", + "101 SWITCHING_PROTOCOLS", + "102 PROCESSING", + "103 CHECKPOINT", + "200 OK", + "201 CREATED", + "202 ACCEPTED", + "203 NON_AUTHORITATIVE_INFORMATION", + "204 NO_CONTENT", + "205 RESET_CONTENT", + "206 PARTIAL_CONTENT", + "207 MULTI_STATUS", + "208 ALREADY_REPORTED", + "226 IM_USED", + "300 MULTIPLE_CHOICES", + "301 MOVED_PERMANENTLY", + "302 FOUND", + "302 MOVED_TEMPORARILY", + "303 SEE_OTHER", + "304 NOT_MODIFIED", + "305 USE_PROXY", + "307 TEMPORARY_REDIRECT", + "308 PERMANENT_REDIRECT", + "400 BAD_REQUEST", + "401 UNAUTHORIZED", + "402 PAYMENT_REQUIRED", + "403 FORBIDDEN", + "404 NOT_FOUND", + "405 METHOD_NOT_ALLOWED", + "406 NOT_ACCEPTABLE", + "407 PROXY_AUTHENTICATION_REQUIRED", + "408 REQUEST_TIMEOUT", + "409 CONFLICT", + "410 GONE", + "411 LENGTH_REQUIRED", + "412 PRECONDITION_FAILED", + "413 PAYLOAD_TOO_LARGE", + "413 REQUEST_ENTITY_TOO_LARGE", + "414 URI_TOO_LONG", + "414 REQUEST_URI_TOO_LONG", + "415 UNSUPPORTED_MEDIA_TYPE", + "416 REQUESTED_RANGE_NOT_SATISFIABLE", + "417 EXPECTATION_FAILED", + "418 I_AM_A_TEAPOT", + "419 INSUFFICIENT_SPACE_ON_RESOURCE", + "420 METHOD_FAILURE", + "421 DESTINATION_LOCKED", + "422 UNPROCESSABLE_ENTITY", + "423 LOCKED", + "424 FAILED_DEPENDENCY", + "426 UPGRADE_REQUIRED", + "428 PRECONDITION_REQUIRED", + "429 TOO_MANY_REQUESTS", + "431 REQUEST_HEADER_FIELDS_TOO_LARGE", + "451 UNAVAILABLE_FOR_LEGAL_REASONS", + "500 INTERNAL_SERVER_ERROR", + "501 NOT_IMPLEMENTED", + "502 BAD_GATEWAY", + "503 SERVICE_UNAVAILABLE", + "504 GATEWAY_TIMEOUT", + "505 HTTP_VERSION_NOT_SUPPORTED", + "506 VARIANT_ALSO_NEGOTIATES", + "507 INSUFFICIENT_STORAGE", + "508 LOOP_DETECTED", + "509 BANDWIDTH_LIMIT_EXCEEDED", + "510 NOT_EXTENDED", + "511 NETWORK_AUTHENTICATION_REQUIRED" + ] + }, + "statusCodeValue": { + "type": "integer", + "format": "int32" + } + }, + "title": "ResponseEntity" + }, + "Reward": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "rewardDescription": { + "type": "string" + } + }, + "title": "Reward" + }, + "Station": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "description": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "int32" + }, + "lattitude": { + "type": "number", + "format": "double" + }, + "longitude": { + "type": "number", + "format": "double" + }, + "solution": { + "type": "string" + } + }, + "title": "Station" + }, + "View": { + "type": "object", + "properties": { + "contentType": { + "type": "string" + } + }, + "title": "View" + } + } +}
Nutzer zu Administrator befördern