Skip to content

Commit dd03d28

Browse files
authored
feat: add metrics endpoint (#848)
1 parent 86b7b76 commit dd03d28

20 files changed

+675
-534
lines changed

api/docs.go

Lines changed: 65 additions & 60 deletions
Large diffs are not rendered by default.

api/swagger.json

Lines changed: 65 additions & 60 deletions
Large diffs are not rendered by default.

api/swagger.yaml

Lines changed: 64 additions & 60 deletions
Large diffs are not rendered by default.

go.mod

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ require (
2323
gorm.io/gorm v1.25.5
2424
)
2525

26+
require (
27+
github.com/beorn7/perks v1.0.1 // indirect
28+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
29+
github.com/golang/protobuf v1.5.3 // indirect
30+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
31+
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
32+
github.com/prometheus/common v0.44.0 // indirect
33+
github.com/prometheus/procfs v0.11.1 // indirect
34+
)
35+
2636
require (
2737
github.com/KyleBanks/depth v1.2.1 // indirect
2838
github.com/bytedance/sonic v1.10.2 // indirect
@@ -53,6 +63,7 @@ require (
5363
github.com/modern-go/reflect2 v1.0.2 // indirect
5464
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
5565
github.com/pmezard/go-difflib v1.0.0 // indirect
66+
github.com/prometheus/client_golang v1.17.0
5667
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
5768
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
5869
github.com/ugorji/go/codec v1.2.11 // indirect

go.sum

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
22
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
3+
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
4+
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
35
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
46
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
57
github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE=
68
github.com/bytedance/sonic v1.10.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4=
9+
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
10+
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
711
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
812
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
913
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0=
@@ -68,9 +72,12 @@ github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGF
6872
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
6973
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
7074
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
75+
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
7176
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
77+
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
78+
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
7279
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
73-
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
80+
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
7481
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
7582
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=
7683
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
@@ -112,6 +119,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
112119
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
113120
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
114121
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
122+
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
123+
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
115124
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
116125
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
117126
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -126,11 +135,19 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
126135
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
127136
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
128137
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
138+
github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q=
139+
github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY=
140+
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM=
141+
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
142+
github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY=
143+
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
144+
github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
145+
github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
129146
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
130147
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
131148
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
132-
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
133149
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
150+
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
134151
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
135152
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
136153
github.com/rs/zerolog v1.20.0/go.mod h1:IzD0RJ65iWH0w97OQQebJEvTZYvsCUm9WVLWBQrJRjo=
@@ -185,6 +202,7 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
185202
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
186203
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
187204
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
205+
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
188206
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
189207
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
190208
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -219,6 +237,7 @@ golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk
219237
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
220238
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
221239
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
240+
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
222241
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
223242
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
224243
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ func main() {
7777
ctx = context.WithValue(ctx, database.ContextURL, url)
7878
controller := controllers.Controller{DB: db.WithContext(ctx)}
7979

80-
r, err := router.Config(url)
80+
r, teardown, err := router.Config(url)
81+
defer teardown()
82+
8183
if err != nil {
8284
log.Fatal().Msg(err.Error())
8385
}

pkg/controllers/account_v1.go

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ func (co Controller) RegisterAccountRoutes(r *gin.RouterGroup) {
111111

112112
// Account with ID
113113
{
114-
r.OPTIONS("/:accountId", co.OptionsAccountDetail)
115-
r.GET("/:accountId", co.GetAccount)
116-
r.PATCH("/:accountId", co.UpdateAccount)
117-
r.DELETE("/:accountId", co.DeleteAccount)
114+
r.OPTIONS("/:id", co.OptionsAccountDetail)
115+
r.GET("/:id", co.GetAccount)
116+
r.PATCH("/:id", co.UpdateAccount)
117+
r.DELETE("/:id", co.DeleteAccount)
118118
}
119119
}
120120

@@ -135,13 +135,13 @@ func (co Controller) OptionsAccountList(c *gin.Context) {
135135
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
136136
// @Tags Accounts
137137
// @Success 204
138-
// @Failure 400 {object} httperrors.HTTPError
139-
// @Failure 404 {object} httperrors.HTTPError
140-
// @Failure 500 {object} httperrors.HTTPError
141-
// @Param accountId path string true "ID formatted as string"
142-
// @Router /v1/accounts/{accountId} [options]
138+
// @Failure 400 {object} httperrors.HTTPError
139+
// @Failure 404 {object} httperrors.HTTPError
140+
// @Failure 500 {object} httperrors.HTTPError
141+
// @Param id path string true "ID formatted as string"
142+
// @Router /v1/accounts/{id} [options]
143143
func (co Controller) OptionsAccountDetail(c *gin.Context) {
144-
id, err := uuid.Parse(c.Param("accountId"))
144+
id, err := uuid.Parse(c.Param("id"))
145145
if err != nil {
146146
httperrors.InvalidUUID(c)
147147
return
@@ -262,14 +262,14 @@ func (co Controller) GetAccounts(c *gin.Context) {
262262
// @Description Returns a specific account
263263
// @Tags Accounts
264264
// @Produce json
265-
// @Success 200 {object} AccountResponse
266-
// @Failure 400 {object} httperrors.HTTPError
267-
// @Failure 404 {object} httperrors.HTTPError
268-
// @Failure 500 {object} httperrors.HTTPError
269-
// @Param accountId path string true "ID formatted as string"
270-
// @Router /v1/accounts/{accountId} [get]
265+
// @Success 200 {object} AccountResponse
266+
// @Failure 400 {object} httperrors.HTTPError
267+
// @Failure 404 {object} httperrors.HTTPError
268+
// @Failure 500 {object} httperrors.HTTPError
269+
// @Param id path string true "ID formatted as string"
270+
// @Router /v1/accounts/{id} [get]
271271
func (co Controller) GetAccount(c *gin.Context) {
272-
id, err := uuid.Parse(c.Param("accountId"))
272+
id, err := uuid.Parse(c.Param("id"))
273273
if err != nil {
274274
httperrors.InvalidUUID(c)
275275
return
@@ -289,15 +289,15 @@ func (co Controller) GetAccount(c *gin.Context) {
289289
// @Description Updates an account. Only values to be updated need to be specified.
290290
// @Tags Accounts
291291
// @Produce json
292-
// @Success 200 {object} AccountResponse
293-
// @Failure 400 {object} httperrors.HTTPError
294-
// @Failure 404 {object} httperrors.HTTPError
295-
// @Failure 500 {object} httperrors.HTTPError
296-
// @Param accountId path string true "ID formatted as string"
297-
// @Param account body models.AccountCreate true "Account"
298-
// @Router /v1/accounts/{accountId} [patch]
292+
// @Success 200 {object} AccountResponse
293+
// @Failure 400 {object} httperrors.HTTPError
294+
// @Failure 404 {object} httperrors.HTTPError
295+
// @Failure 500 {object} httperrors.HTTPError
296+
// @Param id path string true "ID formatted as string"
297+
// @Param account body models.AccountCreate true "Account"
298+
// @Router /v1/accounts/{id} [patch]
299299
func (co Controller) UpdateAccount(c *gin.Context) {
300-
id, err := uuid.Parse(c.Param("accountId"))
300+
id, err := uuid.Parse(c.Param("id"))
301301
if err != nil {
302302
httperrors.InvalidUUID(c)
303303
return
@@ -336,13 +336,13 @@ func (co Controller) UpdateAccount(c *gin.Context) {
336336
// @Tags Accounts
337337
// @Produce json
338338
// @Success 204
339-
// @Failure 400 {object} httperrors.HTTPError
340-
// @Failure 404 {object} httperrors.HTTPError
341-
// @Failure 500 {object} httperrors.HTTPError
342-
// @Param accountId path string true "ID formatted as string"
343-
// @Router /v1/accounts/{accountId} [delete]
339+
// @Failure 400 {object} httperrors.HTTPError
340+
// @Failure 404 {object} httperrors.HTTPError
341+
// @Failure 500 {object} httperrors.HTTPError
342+
// @Param id path string true "ID formatted as string"
343+
// @Router /v1/accounts/{id} [delete]
344344
func (co Controller) DeleteAccount(c *gin.Context) {
345-
id, err := uuid.Parse(c.Param("accountId"))
345+
id, err := uuid.Parse(c.Param("id"))
346346
if err != nil {
347347
httperrors.InvalidUUID(c)
348348
return

pkg/controllers/allocation.go

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ func (co Controller) RegisterAllocationRoutes(r *gin.RouterGroup) {
8585

8686
// Transaction with ID
8787
{
88-
r.OPTIONS("/:allocationId", co.OptionsAllocationDetail)
89-
r.GET("/:allocationId", co.GetAllocation)
90-
r.PATCH("/:allocationId", co.UpdateAllocation)
91-
r.DELETE("/:allocationId", co.DeleteAllocation)
88+
r.OPTIONS("/:id", co.OptionsAllocationDetail)
89+
r.GET("/:id", co.GetAllocation)
90+
r.PATCH("/:id", co.UpdateAllocation)
91+
r.DELETE("/:id", co.DeleteAllocation)
9292
}
9393
}
9494

@@ -109,13 +109,13 @@ func (co Controller) OptionsAllocationList(c *gin.Context) {
109109
// @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
110110
// @Tags Allocations
111111
// @Success 204
112-
// @Failure 400 {object} httperrors.HTTPError
113-
// @Failure 404 {object} httperrors.HTTPError
114-
// @Failure 500 {object} httperrors.HTTPError
115-
// @Param allocationId path string true "ID formatted as string"
116-
// @Router /v1/allocations/{allocationId} [options]
112+
// @Failure 400 {object} httperrors.HTTPError
113+
// @Failure 404 {object} httperrors.HTTPError
114+
// @Failure 500 {object} httperrors.HTTPError
115+
// @Param id path string true "ID formatted as string"
116+
// @Router /v1/allocations/{id} [options]
117117
func (co Controller) OptionsAllocationDetail(c *gin.Context) {
118-
id, err := uuid.Parse(c.Param("allocationId"))
118+
id, err := uuid.Parse(c.Param("id"))
119119
if err != nil {
120120
httperrors.InvalidUUID(c)
121121
return
@@ -224,14 +224,14 @@ func (co Controller) GetAllocations(c *gin.Context) {
224224
// @Description Returns a specific allocation
225225
// @Tags Allocations
226226
// @Produce json
227-
// @Success 200 {object} AllocationResponse
228-
// @Failure 400 {object} httperrors.HTTPError
229-
// @Failure 404 {object} httperrors.HTTPError
230-
// @Failure 500 {object} httperrors.HTTPError
231-
// @Param allocationId path string true "ID formatted as string"
232-
// @Router /v1/allocations/{allocationId} [get]
227+
// @Success 200 {object} AllocationResponse
228+
// @Failure 400 {object} httperrors.HTTPError
229+
// @Failure 404 {object} httperrors.HTTPError
230+
// @Failure 500 {object} httperrors.HTTPError
231+
// @Param id path string true "ID formatted as string"
232+
// @Router /v1/allocations/{id} [get]
233233
func (co Controller) GetAllocation(c *gin.Context) {
234-
id, err := uuid.Parse(c.Param("allocationId"))
234+
id, err := uuid.Parse(c.Param("id"))
235235
if err != nil {
236236
httperrors.InvalidUUID(c)
237237
return
@@ -257,15 +257,15 @@ func (co Controller) GetAllocation(c *gin.Context) {
257257
// @Tags Allocations
258258
// @Accept json
259259
// @Produce json
260-
// @Success 200 {object} AllocationResponse
261-
// @Failure 400 {object} httperrors.HTTPError
262-
// @Failure 404 {object} httperrors.HTTPError
263-
// @Failure 500 {object} httperrors.HTTPError
264-
// @Param allocationId path string true "ID formatted as string"
265-
// @Param allocation body models.AllocationCreate true "Allocation"
266-
// @Router /v1/allocations/{allocationId} [patch]
260+
// @Success 200 {object} AllocationResponse
261+
// @Failure 400 {object} httperrors.HTTPError
262+
// @Failure 404 {object} httperrors.HTTPError
263+
// @Failure 500 {object} httperrors.HTTPError
264+
// @Param id path string true "ID formatted as string"
265+
// @Param allocation body models.AllocationCreate true "Allocation"
266+
// @Router /v1/allocations/{id} [patch]
267267
func (co Controller) UpdateAllocation(c *gin.Context) {
268-
id, err := uuid.Parse(c.Param("allocationId"))
268+
id, err := uuid.Parse(c.Param("id"))
269269
if err != nil {
270270
httperrors.InvalidUUID(c)
271271
return
@@ -304,13 +304,13 @@ func (co Controller) UpdateAllocation(c *gin.Context) {
304304
// @Description Deletes an allocation
305305
// @Tags Allocations
306306
// @Success 204
307-
// @Failure 400 {object} httperrors.HTTPError
308-
// @Failure 404 {object} httperrors.HTTPError
309-
// @Failure 500 {object} httperrors.HTTPError
310-
// @Param allocationId path string true "ID formatted as string"
311-
// @Router /v1/allocations/{allocationId} [delete]
307+
// @Failure 400 {object} httperrors.HTTPError
308+
// @Failure 404 {object} httperrors.HTTPError
309+
// @Failure 500 {object} httperrors.HTTPError
310+
// @Param id path string true "ID formatted as string"
311+
// @Router /v1/allocations/{id} [delete]
312312
func (co Controller) DeleteAllocation(c *gin.Context) {
313-
id, err := uuid.Parse(c.Param("allocationId"))
313+
id, err := uuid.Parse(c.Param("id"))
314314
if err != nil {
315315
httperrors.InvalidUUID(c)
316316
return

0 commit comments

Comments
 (0)