diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dd0309b..1b0938d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,13 @@ build: script: - go mod tidy - go install github.com/swaggo/swag/cmd/swag - - ${GOPATH}/bin/swag init -p pascalcase -g "start.go" -o "./doc/api/" + - ${GOPATH}/bin/swag init --propertyStrategy pascalcase + --generalInfo "start.go" + --output "./doc/api/" + --parseDependency + --parseInternal + --parseVendor + --parseDepth 2 - go build artifacts: paths: diff --git a/Dockerfile b/Dockerfile index 35502cb..0d031e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,23 @@ -FROM golang:1.13-buster AS builder +FROM golang:1.15.7-buster AS builder RUN mkdir /build WORKDIR /build -ADD . /build +# Make use of layer caching +ADD go.* ./ +RUN go mod download RUN go install github.com/swaggo/swag/cmd/swag -RUN swag init -p pascalcase -g "start.go" -o "./doc/api/" + +ADD . . + +RUN swag init --propertyStrategy pascalcase \ + --generalInfo "start.go" \ + --output "./doc/api/" \ + --parseDependency \ + --parseInternal \ + --parseVendor \ + --parseDepth 2 + RUN go build -o villasweb-backend FROM debian:buster 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/go.mod b/go.mod index 0e9c098..a7c041a 100644 --- a/go.mod +++ b/go.mod @@ -10,19 +10,20 @@ require ( github.com/go-playground/universal-translator v0.17.0 // indirect github.com/google/uuid v1.1.2 github.com/jinzhu/gorm v1.9.11 + github.com/kr/pretty v0.2.1 // indirect github.com/leodido/go-urn v1.2.0 // indirect github.com/lib/pq v1.1.1 github.com/nsf/jsondiff v0.0.0-20190712045011-8443391ee9b6 github.com/prometheus/client_golang v1.2.1 github.com/smartystreets/goconvey v1.6.4 // indirect github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271 - github.com/stretchr/testify v1.4.0 - github.com/swaggo/gin-swagger v1.2.0 - github.com/swaggo/swag v1.6.3 + github.com/stretchr/testify v1.6.1 + github.com/swaggo/swag v1.7.0 + github.com/urfave/cli v1.22.5 // indirect github.com/zpatrick/go-config v0.0.0-20191104215613-50bc2709703f golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 gopkg.in/go-playground/validator.v9 v9.30.0 gopkg.in/ini.v1 v1.51.0 // indirect ) -go 1.13 +go 1.15 diff --git a/go.sum b/go.sum index ed40b86..2d06f65 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= -github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4= -github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -29,6 +29,8 @@ github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tj github.com/chenjiandongx/ginprom v0.0.0-20191022035802-6f3da3c84986 h1:6r9/zDxh+oMzqLWol3ByjfoZN85AaCTnXNvEfvc316U= github.com/chenjiandongx/ginprom v0.0.0-20191022035802-6f3da3c84986/go.mod h1:lINNCb1ZH3c0uL/9ApaQ8muR4QILsi0STj8Ojt8ZmwU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -44,13 +46,8 @@ github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc= -github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= -github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 h1:t8FVkw33L+wilf2QiWkw0UV77qRpcH/JHPKGpKa2E8g= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= github.com/gin-gonic/gin v1.4.0 h1:3tMoCCfM7ppqsR0ptz/wi1impNpT7/9wQtMZ8lr1mCQ= github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= github.com/go-ini/ini v1.51.0 h1:VPJKXGzbKlyExUE8f41aV57yxkYx5R49yR6n7flp0M0= @@ -59,15 +56,15 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-openapi/jsonpointer v0.17.0 h1:nH6xp8XdXHx8dqveo0ZuJBluCO2qGrPbDNZ0dwoRHP0= -github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= -github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= -github.com/go-openapi/jsonreference v0.19.0 h1:BqWKpV1dFd+AuiKlgtddwVIFQsuMpxfBDBHGfM2yNpk= -github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= -github.com/go-openapi/spec v0.19.0 h1:A4SZ6IWh3lnjH0rG0Z5lkxazMGBECtrZcbyYQi+64k4= -github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= -github.com/go-openapi/swag v0.17.0 h1:iqrgMg7Q7SvtbWLlltPrkMs0UBJI6oTSs79JFRUi880= -github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= +github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.4 h1:3Vw+rh13uq2JFNxgnMTGE1rnoieU9FmyE1gvnyylsYg= +github.com/go-openapi/jsonreference v0.19.4/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= +github.com/go-openapi/spec v0.19.14 h1:r4fbYFo6N4ZelmSX8G6p+cv/hZRXzcuqQIADGT1iNKM= +github.com/go-openapi/spec v0.19.14/go.mod h1:gwrgJS15eCUgjLpMjBJmbZezCsw88LmgeEip0M63doA= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.11 h1:RFTu/dlFySpyVvJDfp/7674JY4SDglYWKztbiIGFpmc= +github.com/go-openapi/swag v0.19.11/go.mod h1:Uc0gKkdR+ojzsEpjh39QChyu92vPgIr72POcgHMAgSY= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= @@ -111,7 +108,6 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -124,6 +120,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -131,12 +129,11 @@ github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4= github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-sqlite3 v1.11.0 h1:LDdKkqtYlom37fkvqs8rMPFKAMe8+SgjbwZ6ex1/A/Q= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= @@ -180,6 +177,10 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8= github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= @@ -194,47 +195,46 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= -github.com/swaggo/gin-swagger v1.2.0 h1:YskZXEiv51fjOMTsXrOetAjrMDfFaXD79PEoQBOe2W0= -github.com/swaggo/gin-swagger v1.2.0/go.mod h1:qlH2+W7zXGZkczuL+r2nEBR2JTT+/lX05Nn6vPhc7OI= -github.com/swaggo/swag v1.5.1/go.mod h1:1Bl9F/ZBpVWh22nY0zmYyASPO1lI/zIwRDrpZU+tv8Y= -github.com/swaggo/swag v1.6.3 h1:N+uVPGP4H2hXoss2pt5dctoSUPKKRInr6qcTMOm0usI= -github.com/swaggo/swag v1.6.3/go.mod h1:wcc83tB4Mb2aNiL/HP4MFeQdpHUrca+Rp/DRNgWAUio= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/swaggo/swag v1.7.0 h1:5bCA/MTLQoIqDXXyHfOpMeDvL9j68OY/udlK4pQoo4E= +github.com/swaggo/swag v1.7.0/go.mod h1:BdPIL73gvS9NBsdi7M1JOxLvlbfvNRaBP8m6WT6Aajo= +github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.5-pre h1:jyJKFOSEbdOc2HODrf2qcCkYOdq7zzXqA9bhW5oV4fM= -github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0= -github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.5-pre h1:5YV9PsFAN+ndcCtTM7s60no7nY7eTG3LPtxhSwuxzCs= -github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI= -github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU= +github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zpatrick/go-config v0.0.0-20191104215613-50bc2709703f h1:A3xgNrO0Yh+GQJuplpwSdCqT+xcGNPu2gtg+wvHuq8U= github.com/zpatrick/go-config v0.0.0-20191104215613-50bc2709703f/go.mod h1:N7O1arBXMtrvgkF3kTwZdytK4gsAf13kfqv9Z6vk47Q= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -244,17 +244,16 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= @@ -265,6 +264,8 @@ golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -272,9 +273,13 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b h1:/mJ+GKieZA6hFDQGdWZrjj4AXPl5ylY+5HusG80roy0= -golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201120155355-20be4ac4bd6e h1:t96dS3DO8DGjawSLJL/HIdz8CycAd2v07XxqB3UPTi0= +golang.org/x/tools v0.0.0-20201120155355-20be4ac4bd6e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= @@ -301,8 +306,13 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 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/healthz/healthz_test.go b/routes/healthz/healthz_test.go index 7d716ed..6fcbd86 100644 --- a/routes/healthz/healthz_test.go +++ b/routes/healthz/healthz_test.go @@ -85,5 +85,5 @@ func TestHealthz(t *testing.T) { // test healthz endpoint for connected DB and AMQP client code, resp, err = helper.TestEndpoint(router, "", "healthz", http.MethodGet, nil) assert.NoError(t, err) - assert.Equalf(t, 200, code, "Response body: \n%v\n", resp) + assert.Equalf(t, 204, code, "Response body: \n%v\n", resp) } 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/openapi/openapi.go b/routes/openapi/openapi.go new file mode 100644 index 0000000..7d6a12b --- /dev/null +++ b/routes/openapi/openapi.go @@ -0,0 +1,50 @@ +/** Healthz package, endpoints. +* +* @author Sonja Happ +* @copyright 2014-2019, Institute for Automation of Complex Power Systems, EONERC +* @license GNU General Public License (version 3) +* +* VILLASweb-backend-go +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*********************************************************************************/ +package openapi + +import ( + _ "git.rwth-aachen.de/acs/public/villas/web-backend-go/doc/api" // doc/api folder is used by Swag CLI, you have to import it + "git.rwth-aachen.de/acs/public/villas/web-backend-go/helper" + "github.com/gin-gonic/gin" + "github.com/swaggo/swag" +) + +func RegisterOpenAPIEndpoint(r *gin.RouterGroup) { + r.GET("", getOpenAPI) +} + +// getOpenAPI godoc +// @Summary Get OpenAPI 2.0 spec of API +// @ID getOpenAPI +// @Produce json +// @Tags openapi +// @Success 200 string string "A OpenAPI 2.0 specification of the API" +// @Router /openapi [get] +func getOpenAPI(c *gin.Context) { + doc, err := swag.ReadDoc() + if err != nil { + helper.InternalServerError(c, err.Error()) + } + + c.Header("Content-Type", "application/json") + c.String(200, doc) +} diff --git a/routes/register.go b/routes/register.go index 57cbff2..7884397 100644 --- a/routes/register.go +++ b/routes/register.go @@ -42,14 +42,13 @@ import ( "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/healthz" infrastructure_component "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/infrastructure-component" "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/metrics" + "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/openapi" "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/result" "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/scenario" "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/signal" "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/user" "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/widget" "github.com/gin-gonic/gin" - ginSwagger "github.com/swaggo/gin-swagger" - "github.com/swaggo/gin-swagger/swaggerFiles" "github.com/zpatrick/go-config" ) @@ -80,6 +79,7 @@ func RegisterEndpoints(router *gin.Engine, api *gin.RouterGroup) { healthz.RegisterHealthzEndpoint(api.Group("/healthz")) metrics.RegisterMetricsEndpoint(api.Group("/metrics")) + openapi.RegisterOpenAPIEndpoint(api.Group("/openapi")) // All endpoints (except for /healthz and /metrics) require authentication except when someone wants to // login (POST /authenticate) user.RegisterAuthenticate(api.Group("/authenticate")) @@ -96,8 +96,6 @@ func RegisterEndpoints(router *gin.Engine, api *gin.RouterGroup) { infrastructure_component.RegisterICEndpoints(api.Group("/ic")) result.RegisterResultEndpoints(api.Group("/results")) - router.GET("swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) - metrics.InitCounters() } 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 diff --git a/start.go b/start.go index 7b32853..6879992 100644 --- a/start.go +++ b/start.go @@ -27,7 +27,6 @@ import ( "git.rwth-aachen.de/acs/public/villas/web-backend-go/configuration" "git.rwth-aachen.de/acs/public/villas/web-backend-go/database" - apidocs "git.rwth-aachen.de/acs/public/villas/web-backend-go/doc/api" // doc/api folder is used by Swag CLI, you have to import it "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes" infrastructure_component "git.rwth-aachen.de/acs/public/villas/web-backend-go/routes/infrastructure-component" "github.com/gin-gonic/gin" @@ -83,7 +82,7 @@ func addData(router *gin.Engine, cfg *config.Config) error { func main() { log.Println("Starting VILLASweb-backend-go") - mode, baseHost, basePath, port, amqphost, amqpuser, amqppass, err := configuration.ConfigureBackend() + mode, _, basePath, port, amqphost, amqpuser, amqppass, err := configuration.ConfigureBackend() if err != nil { panic(err) } @@ -103,8 +102,6 @@ func main() { r := gin.Default() api := r.Group(basePath) routes.RegisterEndpoints(r, api) - apidocs.SwaggerInfo.Host = baseHost - apidocs.SwaggerInfo.BasePath = basePath //Start AMQP client if amqphost != "" {