From 59c924bcffaac2e8424f399f2debd5bb98221af0 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 5 Feb 2021 22:44:45 +0100 Subject: [PATCH] update package name of response docs as changed upstream in swag --- doc/api/responses.go | 2 +- .../config_endpoints.go | 51 ++++++------- routes/dashboard/dashboard_endpoints.go | 51 ++++++------- routes/file/file_endpoints.go | 51 ++++++------- routes/healthz/healthz_endpoint.go | 7 +- .../infrastructure-component/ic_endpoints.go | 73 ++++++++++--------- routes/metrics/metrics_endpoint.go | 2 +- routes/result/result_endpoints.go | 71 +++++++++--------- routes/scenario/scenario_endpoints.go | 71 +++++++++--------- routes/signal/signal_endpoints.go | 53 +++++++------- routes/user/authenticate_endpoint.go | 6 +- routes/user/user_endpoints.go | 46 ++++++------ routes/widget/widget_endpoints.go | 51 ++++++------- 13 files changed, 272 insertions(+), 263 deletions(-) diff --git a/doc/api/responses.go b/doc/api/responses.go index 251b4df..cfcb3f3 100644 --- a/doc/api/responses.go +++ b/doc/api/responses.go @@ -19,7 +19,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . *********************************************************************************/ -package docs +package api import "git.rwth-aachen.de/acs/public/villas/web-backend-go/database" diff --git a/routes/component-configuration/config_endpoints.go b/routes/component-configuration/config_endpoints.go index 82c267f..b3c40c3 100644 --- a/routes/component-configuration/config_endpoints.go +++ b/routes/component-configuration/config_endpoints.go @@ -22,9 +22,10 @@ package component_configuration import ( - "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" "net/http" + "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" + "github.com/gin-gonic/gin" "git.rwth-aachen.de/acs/public/villas/web-backend-go/database" @@ -44,10 +45,10 @@ func RegisterComponentConfigurationEndpoints(r *gin.RouterGroup) { // @ID getConfigs // @Produce json // @Tags component-configurations -// @Success 200 {object} docs.ResponseConfigs "Component configurations which belong to scenario" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseConfigs "Component configurations which belong to scenario" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param scenarioID query int true "Scenario ID" // @Router /configs [get] // @Security Bearer @@ -73,11 +74,11 @@ func getConfigs(c *gin.Context) { // @Accept json // @Produce json // @Tags component-configurations -// @Success 200 {object} docs.ResponseConfig "Component configuration that was added" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseConfig "Component configuration that was added" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputConfig body component_configuration.addConfigRequest true "component configuration to be added incl. IDs of scenario and IC" // @Router /configs [post] // @Security Bearer @@ -120,11 +121,11 @@ func addConfig(c *gin.Context) { // @Tags component-configurations // @Accept json // @Produce json -// @Success 200 {object} docs.ResponseConfig "Component configuration that was added" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseConfig "Component configuration that was added" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputConfig body component_configuration.updateConfigRequest true "component configuration to be updated" // @Param configID path int true "Config ID" // @Router /configs/{configID} [put] @@ -165,11 +166,11 @@ func updateConfig(c *gin.Context) { // @ID getConfig // @Tags component-configurations // @Produce json -// @Success 200 {object} docs.ResponseConfig "component configuration that was requested" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseConfig "component configuration that was requested" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param configID path int true "Config ID" // @Router /configs/{configID} [get] // @Security Bearer @@ -188,11 +189,11 @@ func getConfig(c *gin.Context) { // @ID deleteConfig // @Tags component-configurations // @Produce json -// @Success 200 {object} docs.ResponseConfig "component configuration that was deleted" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseConfig "component configuration that was deleted" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param configID path int true "Config ID" // @Router /configs/{configID} [delete] // @Security Bearer diff --git a/routes/dashboard/dashboard_endpoints.go b/routes/dashboard/dashboard_endpoints.go index dc9a98b..7649a0c 100644 --- a/routes/dashboard/dashboard_endpoints.go +++ b/routes/dashboard/dashboard_endpoints.go @@ -22,9 +22,10 @@ package dashboard import ( - "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" "net/http" + "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" + "github.com/gin-gonic/gin" "git.rwth-aachen.de/acs/public/villas/web-backend-go/database" @@ -45,10 +46,10 @@ func RegisterDashboardEndpoints(r *gin.RouterGroup) { // @ID getDashboards // @Produce json // @Tags dashboards -// @Success 200 {object} docs.ResponseDashboards "Dashboards which belong to scenario" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseDashboards "Dashboards which belong to scenario" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param scenarioID query int true "Scenario ID" // @Router /dashboards [get] // @Security Bearer @@ -74,11 +75,11 @@ func getDashboards(c *gin.Context) { // @Accept json // @Produce json // @Tags dashboards -// @Success 200 {object} docs.ResponseDashboard "Dashboard that was added" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseDashboard "Dashboard that was added" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputDab body dashboard.addDashboardRequest true "Dashboard to be added incl. ID of Scenario" // @Router /dashboards [post] // @Security Bearer @@ -120,11 +121,11 @@ func addDashboard(c *gin.Context) { // @Tags dashboards // @Accept json // @Produce json -// @Success 200 {object} docs.ResponseDashboard "Dashboard that was updated" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseDashboard "Dashboard that was updated" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputDab body dashboard.updateDashboardRequest true "Dashboard to be updated" // @Param dashboardID path int true "Dashboard ID" // @Router /dashboards/{dashboardID} [put] @@ -163,11 +164,11 @@ func updateDashboard(c *gin.Context) { // @ID getDashboard // @Tags dashboards // @Produce json -// @Success 200 {object} docs.ResponseDashboard "Dashboard that was requested" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseDashboard "Dashboard that was requested" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param dashboardID path int true "Dashboard ID" // @Router /dashboards/{dashboardID} [get] // @Security Bearer @@ -186,11 +187,11 @@ func getDashboard(c *gin.Context) { // @ID deleteDashboard // @Tags dashboards // @Produce json -// @Success 200 {object} docs.ResponseDashboard "Dashboard that was deleted" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseDashboard "Dashboard that was deleted" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param dashboardID path int true "Dashboard ID" // @Router /dashboards/{dashboardID} [delete] // @Security Bearer diff --git a/routes/file/file_endpoints.go b/routes/file/file_endpoints.go index e4eb792..3d7d962 100644 --- a/routes/file/file_endpoints.go +++ b/routes/file/file_endpoints.go @@ -23,10 +23,11 @@ package file import ( "fmt" + "net/http" + "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/scenario" "github.com/gin-gonic/gin" - "net/http" "git.rwth-aachen.de/acs/public/villas/web-backend-go/database" ) @@ -44,10 +45,10 @@ func RegisterFileEndpoints(r *gin.RouterGroup) { // @ID getFiles // @Tags files // @Produce json -// @Success 200 {object} docs.ResponseFiles "Files which belong to scenario" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseFiles "Files which belong to scenario" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param scenarioID query int true "Scenario ID" // @Router /files [get] // @Security Bearer @@ -80,11 +81,11 @@ func getFiles(c *gin.Context) { // @Accept model/x-cim // @Accept model/x-cim.zip // @Accept multipart/form-data -// @Success 200 {object} docs.ResponseFile "File that was added" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseFile "File that was added" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputFile formData file true "File to be uploaded" // @Param scenarioID query int true "ID of scenario to which file shall be added" // @Router /files [post] @@ -130,11 +131,11 @@ func addFile(c *gin.Context) { // @Produce gif // @Produce model/x-cim // @Produce model/x-cim.zip -// @Success 200 {object} docs.ResponseFile "File that was requested" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseFile "File that was requested" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param fileID path int true "ID of the file to download" // @Router /files/{fileID} [get] // @Security Bearer @@ -162,11 +163,11 @@ func getFile(c *gin.Context) { // @Accept model/x-cim // @Accept model/x-cim.zip // @Accept multipart/form-data -// @Success 200 {object} docs.ResponseFile "File that was updated" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseFile "File that was updated" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputFile formData file true "File to be uploaded" // @Param fileID path int true "ID of the file to update" // @Router /files/{fileID} [put] @@ -197,11 +198,11 @@ func updateFile(c *gin.Context) { // @ID deleteFile // @Tags files // @Produce json -// @Success 200 {object} docs.ResponseFile "File that was deleted" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseFile "File that was deleted" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param fileID path int true "ID of the file to update" // @Router /files/{fileID} [delete] // @Security Bearer diff --git a/routes/healthz/healthz_endpoint.go b/routes/healthz/healthz_endpoint.go index f93bc37..6c3a546 100644 --- a/routes/healthz/healthz_endpoint.go +++ b/routes/healthz/healthz_endpoint.go @@ -43,8 +43,8 @@ func RegisterHealthzEndpoint(r *gin.RouterGroup) { // @ID getHealth // @Produce json // @Tags healthz -// @Success 200 "Backend is healthy, database and AMQP broker connections are alive" -// @Failure 500 {object} docs.ResponseError "Backend is NOT healthy" +// @Success 204 string string "Backend is healthy, database and AMQP broker connections are alive" +// @Failure 500 {object} api.ResponseError "Backend is NOT healthy" // @Router /healthz [get] func getHealth(c *gin.Context) { @@ -80,5 +80,6 @@ func getHealth(c *gin.Context) { } } - c.JSON(http.StatusOK, gin.H{}) + // Send a 204 reponse + c.Writer.WriteHeader(http.StatusNoContent) } diff --git a/routes/infrastructure-component/ic_endpoints.go b/routes/infrastructure-component/ic_endpoints.go index 7560d26..cebb90e 100644 --- a/routes/infrastructure-component/ic_endpoints.go +++ b/routes/infrastructure-component/ic_endpoints.go @@ -22,11 +22,12 @@ package infrastructure_component import ( + "log" + "net/http" + "git.rwth-aachen.de/acs/public/villas/web-backend-go/database" "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" "github.com/gin-gonic/gin" - "log" - "net/http" ) func RegisterICEndpoints(r *gin.RouterGroup) { @@ -47,10 +48,10 @@ func RegisterAMQPEndpoint(r *gin.RouterGroup) { // @ID getICs // @Tags infrastructure-components // @Produce json -// @Success 200 {object} docs.ResponseICs "ICs requested" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseICs "ICs requested" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Router /ic [get] // @Security Bearer func getICs(c *gin.Context) { @@ -72,11 +73,11 @@ func getICs(c *gin.Context) { // @Accept json // @Produce json // @Tags infrastructure-components -// @Success 200 {object} docs.ResponseIC "Infrastructure Component that was added" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseIC "Infrastructure Component that was added" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputIC body infrastructure_component.AddICRequest true "Infrastructure Component to be added" // @Router /ic [post] // @Security Bearer @@ -125,11 +126,11 @@ func addIC(c *gin.Context) { // @Tags infrastructure-components // @Accept json // @Produce json -// @Success 200 {object} docs.ResponseIC "Infrastructure Component that was updated" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseIC "Infrastructure Component that was updated" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputIC body infrastructure_component.UpdateICRequest true "InfrastructureComponent to be updated" // @Param ICID path int true "InfrastructureComponent ID" // @Router /ic/{ICID} [put] @@ -175,11 +176,11 @@ func updateIC(c *gin.Context) { // @ID getIC // @Produce json // @Tags infrastructure-components -// @Success 200 {object} docs.ResponseIC "Infrastructure Component that was requested" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseIC "Infrastructure Component that was requested" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param ICID path int true "Infrastructure Component ID" // @Router /ic/{ICID} [get] // @Security Bearer @@ -198,11 +199,11 @@ func getIC(c *gin.Context) { // @ID deleteIC // @Tags infrastructure-components // @Produce json -// @Success 200 {object} docs.ResponseIC "Infrastructure Component that was deleted" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseIC "Infrastructure Component that was deleted" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param ICID path int true "Infrastructure Component ID" // @Router /ic/{ICID} [delete] // @Security Bearer @@ -230,11 +231,11 @@ func deleteIC(c *gin.Context) { // @ID getConfigsOfIC // @Tags infrastructure-components // @Produce json -// @Success 200 {object} docs.ResponseConfigs "Configs requested by user" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseConfigs "Configs requested by user" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param ICID path int true "Infrastructure Component ID" // @Router /ic/{ICID}/configs [get] // @Security Bearer @@ -259,11 +260,11 @@ func getConfigsOfIC(c *gin.Context) { // @Tags infrastructure-components // @Produce json // @Param inputAction query string true "Action for IC" -// @Success 200 {object} docs.ResponseError "Action sent successfully" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseError "Action sent successfully" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param ICID path int true "InfrastructureComponent ID" // @Router /ic/{ICID}/action [post] // @Security Bearer diff --git a/routes/metrics/metrics_endpoint.go b/routes/metrics/metrics_endpoint.go index 37779b9..5820235 100644 --- a/routes/metrics/metrics_endpoint.go +++ b/routes/metrics/metrics_endpoint.go @@ -78,7 +78,7 @@ var ( // @ID getMetrics // @Produce json // @Tags metrics -// @Success 200 "Returns Prometheus metrics" +// @Success 200 {string} string "Returns Prometheus metrics" // @Router /metrics [get] func RegisterMetricsEndpoint(rg *gin.RouterGroup) { // use prometheus metrics exporter middleware. diff --git a/routes/result/result_endpoints.go b/routes/result/result_endpoints.go index c1e44e9..71d62c1 100644 --- a/routes/result/result_endpoints.go +++ b/routes/result/result_endpoints.go @@ -24,12 +24,13 @@ package result import ( "fmt" + "net/http" + "git.rwth-aachen.de/acs/public/villas/web-backend-go/database" "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/file" "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/scenario" "github.com/gin-gonic/gin" - "net/http" ) func RegisterResultEndpoints(r *gin.RouterGroup) { @@ -47,10 +48,10 @@ func RegisterResultEndpoints(r *gin.RouterGroup) { // @ID getResults // @Produce json // @Tags results -// @Success 200 {object} docs.ResponseResults "Results which belong to scenario" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseResults "Results which belong to scenario" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param scenarioID query int true "Scenario ID" // @Router /results [get] // @Security Bearer @@ -75,11 +76,11 @@ func getResults(c *gin.Context) { // @Accept json // @Produce json // @Tags results -// @Success 200 {object} docs.ResponseResult "Result that was added" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseResult "Result that was added" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputResult body result.addResultRequest true "Result to be added incl. ID of Scenario" // @Router /results [post] // @Security Bearer @@ -121,11 +122,11 @@ func addResult(c *gin.Context) { // @Tags results // @Accept json // @Produce json -// @Success 200 {object} docs.ResponseResult "Result that was updated" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseResult "Result that was updated" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputResult body result.updateResultRequest true "Result to be updated" // @Param resultID path int true "Result ID" // @Router /results/{resultID} [put] @@ -164,11 +165,11 @@ func updateResult(c *gin.Context) { // @ID getResult // @Tags results // @Produce json -// @Success 200 {object} docs.ResponseResult "Result that was requested" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseResult "Result that was requested" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param resultID path int true "Result ID" // @Router /results/{resultID} [get] // @Security Bearer @@ -187,11 +188,11 @@ func getResult(c *gin.Context) { // @ID deleteResult // @Tags results // @Produce json -// @Success 200 {object} docs.ResponseResult "Result that was deleted" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseResult "Result that was deleted" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param resultID path int true "Result ID" // @Router /results/{resultID} [delete] // @Security Bearer @@ -229,11 +230,11 @@ func deleteResult(c *gin.Context) { // @Accept application/xml // @Accept application/x-bag // @Produce json -// @Success 200 {object} docs.ResponseResult "Result that was updated" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseResult "Result that was updated" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputFile formData file true "File to be uploaded" // @Param resultID path int true "Result ID" // @Router /results/{resultID}/file [post] @@ -277,11 +278,11 @@ func addResultFile(c *gin.Context) { // @ID deleteResultFile // @Tags results // @Produce json -// @Success 200 {object} docs.ResponseResult "Result for which file was deleted" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseResult "Result for which file was deleted" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param resultID path int true "Result ID" // @Param fileID path int true "ID of the file to delete" // @Router /results/{resultID}/file/{fileID} [delete] diff --git a/routes/scenario/scenario_endpoints.go b/routes/scenario/scenario_endpoints.go index 0326637..dd12d3b 100644 --- a/routes/scenario/scenario_endpoints.go +++ b/routes/scenario/scenario_endpoints.go @@ -22,9 +22,10 @@ package scenario import ( - "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" "net/http" + "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" + "github.com/gin-gonic/gin" "git.rwth-aachen.de/acs/public/villas/web-backend-go/database" @@ -47,10 +48,10 @@ func RegisterScenarioEndpoints(r *gin.RouterGroup) { // @ID getScenarios // @Produce json // @Tags scenarios -// @Success 200 {object} docs.ResponseScenarios "Scenarios to which user has access" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseScenarios "Scenarios to which user has access" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Router /scenarios [get] // @Security Bearer func getScenarios(c *gin.Context) { @@ -91,11 +92,11 @@ func getScenarios(c *gin.Context) { // @Accept json // @Produce json // @Tags scenarios -// @Success 200 {object} docs.ResponseScenario "scenario that was added" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseScenario "scenario that was added" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputScenario body scenario.addScenarioRequest true "Scenario to be added" // @Router /scenarios [post] // @Security Bearer @@ -150,11 +151,11 @@ func addScenario(c *gin.Context) { // @Tags scenarios // @Accept json // @Produce json -// @Success 200 {object} docs.ResponseScenario "Updated scenario." -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseScenario "Updated scenario." +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputScenario body scenario.updateScenarioRequest true "Scenario to be updated" // @Param scenarioID path int true "Scenario ID" // @Router /scenarios/{scenarioID} [put] @@ -196,10 +197,10 @@ func updateScenario(c *gin.Context) { // @ID getScenario // @Produce json // @Tags scenarios -// @Success 200 {object} docs.ResponseScenario "Scenario requested by user" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseScenario "Scenario requested by user" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param scenarioID path int true "Scenario ID" // @Router /scenarios/{scenarioID} [get] // @Security Bearer @@ -219,10 +220,10 @@ func getScenario(c *gin.Context) { // @ID deleteScenario // @Tags scenarios // @Produce json -// @Success 200 {object} docs.ResponseScenario "Deleted scenario" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseScenario "Deleted scenario" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param scenarioID path int true "Scenario ID" // @Router /scenarios/{scenarioID} [delete] // @Security Bearer @@ -246,10 +247,10 @@ func deleteScenario(c *gin.Context) { // @ID getUsersOfScenario // @Produce json // @Tags scenarios -// @Success 200 {object} docs.ResponseUsers "Array of users that have access to the scenario" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseUsers "Array of users that have access to the scenario" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param scenarioID path int true "Scenario ID" // @Router /scenarios/{scenarioID}/users/ [get] // @Security Bearer @@ -274,10 +275,10 @@ func getUsersOfScenario(c *gin.Context) { // @ID addUserToScenario // @Tags scenarios // @Produce json -// @Success 200 {object} docs.ResponseUser "User that was added to scenario" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseUser "User that was added to scenario" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param scenarioID path int true "Scenario ID" // @Param username query string true "User name" // @Router /scenarios/{scenarioID}/user [put] @@ -315,10 +316,10 @@ func addUserToScenario(c *gin.Context) { // @ID deleteUserFromScenario // @Tags scenarios // @Produce json -// @Success 200 {object} docs.ResponseUser "User that was deleted from scenario" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseUser "User that was deleted from scenario" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param scenarioID path int true "Scenario ID" // @Param username query string true "User name" // @Router /scenarios/{scenarioID}/user [delete] diff --git a/routes/signal/signal_endpoints.go b/routes/signal/signal_endpoints.go index 9bed08b..ce09561 100644 --- a/routes/signal/signal_endpoints.go +++ b/routes/signal/signal_endpoints.go @@ -22,13 +22,14 @@ package signal import ( - "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" "net/http" + "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" + "github.com/gin-gonic/gin" "git.rwth-aachen.de/acs/public/villas/web-backend-go/database" - "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/component-configuration" + component_configuration "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/component-configuration" ) func RegisterSignalEndpoints(r *gin.RouterGroup) { @@ -46,10 +47,10 @@ func RegisterSignalEndpoints(r *gin.RouterGroup) { // @Tags signals // @Param direction query string true "Direction of signal (in or out)" // @Param configID query string true "Config ID of signals to be obtained" -// @Success 200 {object} docs.ResponseSignals "Signals which belong to component configuration" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseSignals "Signals which belong to component configuration" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Router /signals [get] // @Security Bearer func getSignals(c *gin.Context) { @@ -85,11 +86,11 @@ func getSignals(c *gin.Context) { // @Accept json // @Produce json // @Tags signals -// @Success 200 {object} docs.ResponseSignal "Signal that was added" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseSignal "Signal that was added" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputSignal body signal.addSignalRequest true "A signal to be added to the component configuration incl. direction and config ID to which signal shall be added" // @Router /signals [post] // @Security Bearer @@ -128,11 +129,11 @@ func addSignal(c *gin.Context) { // @ID updateSignal // @Tags signals // @Produce json -// @Success 200 {object} docs.ResponseSignal "Signal that was updated" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseSignal "Signal that was updated" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputSignal body signal.updateSignalRequest true "A signal to be updated" // @Param signalID path int true "ID of signal to be updated" // @Router /signals/{signalID} [put] @@ -171,11 +172,11 @@ func updateSignal(c *gin.Context) { // @ID getSignal // @Tags signals // @Produce json -// @Success 200 {object} docs.ResponseSignal "Signal that was requested" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseSignal "Signal that was requested" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param signalID path int true "ID of signal to be obtained" // @Router /signals/{signalID} [get] // @Security Bearer @@ -193,11 +194,11 @@ func getSignal(c *gin.Context) { // @ID deleteSignal // @Tags signals // @Produce json -// @Success 200 {object} docs.ResponseSignal "Signal that was deleted" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseSignal "Signal that was deleted" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param signalID path int true "ID of signal to be deleted" // @Router /signals/{signalID} [delete] // @Security Bearer diff --git a/routes/user/authenticate_endpoint.go b/routes/user/authenticate_endpoint.go index f4bb1c7..9fee084 100644 --- a/routes/user/authenticate_endpoint.go +++ b/routes/user/authenticate_endpoint.go @@ -48,9 +48,9 @@ func RegisterAuthenticate(r *gin.RouterGroup) { // @Produce json // @Tags authentication // @Param inputUser body user.loginRequest true "loginRequest of user" -// @Success 200 {object} docs.ResponseAuthenticate "JSON web token, success status, message and authenticated user object" -// @Failure 401 {object} docs.ResponseError "Unauthorized" -// @Failure 500 {object} docs.ResponseError "Internal server error." +// @Success 200 {object} api.ResponseAuthenticate "JSON web token, success status, message and authenticated user object" +// @Failure 401 {object} api.ResponseError "Unauthorized" +// @Failure 500 {object} api.ResponseError "Internal server error." // @Router /authenticate [post] func authenticate(c *gin.Context) { diff --git a/routes/user/user_endpoints.go b/routes/user/user_endpoints.go index 7799ce8..c0ea42b 100644 --- a/routes/user/user_endpoints.go +++ b/routes/user/user_endpoints.go @@ -46,10 +46,10 @@ func RegisterUserEndpoints(r *gin.RouterGroup) { // @ID GetUsers // @Produce json // @Tags users -// @Success 200 {object} docs.ResponseUsers "Array of users" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseUsers "Array of users" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Router /users [get] // @Security Bearer func getUsers(c *gin.Context) { @@ -76,10 +76,10 @@ func getUsers(c *gin.Context) { // @Produce json // @Tags users // @Param inputUser body user.addUserRequest true "User to be added" -// @Success 200 {object} docs.ResponseUser "Contains added user object" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseUser "Contains added user object" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Router /users [post] // @Security Bearer func addUser(c *gin.Context) { @@ -134,12 +134,12 @@ func addUser(c *gin.Context) { // @Tags users // @Accept json // @Produce json -// @Success 200 {object} docs.ResponseUser "Contains updated user" -// @Failure 400 {object} docs.ResponseError "Bad request." -// @Failure 403 {object} docs.ResponseError "Access forbidden." -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseUser "Contains updated user" +// @Failure 400 {object} api.ResponseError "Bad request." +// @Failure 403 {object} api.ResponseError "Access forbidden." +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputUser body user.updateUserRequest true "User to be updated (anything except for ID can be changed, role can only be change by admin)" // @Param userID path int true "User ID" // @Router /users/{userID} [put] @@ -226,11 +226,11 @@ func updateUser(c *gin.Context) { // @ID GetUser // @Produce json // @Tags users -// @Success 200 {object} docs.ResponseUser "requested user" -// @Failure 403 {object} docs.ResponseError "Access forbidden." -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseUser "requested user" +// @Failure 403 {object} api.ResponseError "Access forbidden." +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param userID path int true "User ID" // @Router /users/{userID} [get] // @Security Bearer @@ -269,10 +269,10 @@ func getUser(c *gin.Context) { // @ID DeleteUser // @Tags users // @Produce json -// @Success 200 {object} docs.ResponseUser "deleted user" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseUser "deleted user" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param userID path int true "User ID" // @Router /users/{userID} [delete] // @Security Bearer diff --git a/routes/widget/widget_endpoints.go b/routes/widget/widget_endpoints.go index 4bdaaf4..e8e78de 100644 --- a/routes/widget/widget_endpoints.go +++ b/routes/widget/widget_endpoints.go @@ -22,9 +22,10 @@ package widget import ( - "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" "net/http" + "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" + "github.com/gin-gonic/gin" "git.rwth-aachen.de/acs/public/villas/web-backend-go/database" @@ -44,10 +45,10 @@ func RegisterWidgetEndpoints(r *gin.RouterGroup) { // @ID getWidgets // @Produce json // @Tags widgets -// @Success 200 {object} docs.ResponseWidgets "Widgets to which belong to dashboard" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseWidgets "Widgets to which belong to dashboard" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param dashboardID query int true "Dashboard ID" // @Router /widgets [get] // @Security Bearer @@ -73,11 +74,11 @@ func getWidgets(c *gin.Context) { // @Accept json // @Produce json // @Tags widgets -// @Success 200 {object} docs.ResponseWidget "Widget that was added" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseWidget "Widget that was added" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputWidget body widget.addWidgetRequest true "Widget to be added incl. ID of dashboard" // @Router /widgets [post] // @Security Bearer @@ -117,11 +118,11 @@ func addWidget(c *gin.Context) { // @Tags widgets // @Accept json // @Produce json -// @Success 200 {object} docs.ResponseWidget "Widget that was updated" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseWidget "Widget that was updated" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param inputWidget body widget.updateWidgetRequest true "Widget to be updated" // @Param widgetID path int true "Widget ID" // @Router /widgets/{widgetID} [put] @@ -161,11 +162,11 @@ func updateWidget(c *gin.Context) { // @ID getWidget // @Tags widgets // @Produce json -// @Success 200 {object} docs.ResponseWidget "Widget that was requested" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseWidget "Widget that was requested" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param widgetID path int true "Widget ID" // @Router /widgets/{widgetID} [get] // @Security Bearer @@ -184,11 +185,11 @@ func getWidget(c *gin.Context) { // @ID deleteWidget // @Tags widgets // @Produce json -// @Success 200 {object} docs.ResponseWidget "Widget that was deleted" -// @Failure 400 {object} docs.ResponseError "Bad request" -// @Failure 404 {object} docs.ResponseError "Not found" -// @Failure 422 {object} docs.ResponseError "Unprocessable entity" -// @Failure 500 {object} docs.ResponseError "Internal server error" +// @Success 200 {object} api.ResponseWidget "Widget that was deleted" +// @Failure 400 {object} api.ResponseError "Bad request" +// @Failure 404 {object} api.ResponseError "Not found" +// @Failure 422 {object} api.ResponseError "Unprocessable entity" +// @Failure 500 {object} api.ResponseError "Internal server error" // @Param widgetID path int true "Widget ID" // @Router /widgets/{widgetID} [delete] // @Security Bearer