Skip to content

Commit d19e730

Browse files
authored
fix: add allocation month delete to Budgets group instead of new Budget group (#298)
1 parent a45877d commit d19e730

File tree

4 files changed

+133
-17
lines changed

4 files changed

+133
-17
lines changed

api/docs.go

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -963,10 +963,8 @@ const docTemplate = `{
963963
}
964964
}
965965
}
966-
}
967-
},
968-
"/v1/budgets/{budgetId}/{month}/allocations": {
969-
"get": {
966+
},
967+
"options": {
970968
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
971969
"tags": [
972970
"Budgets"
@@ -1008,11 +1006,13 @@ const docTemplate = `{
10081006
}
10091007
}
10101008
}
1011-
},
1009+
}
1010+
},
1011+
"/v1/budgets/{budgetId}/{month}/allocations": {
10121012
"delete": {
10131013
"description": "Deletes all allocation for the specified month",
10141014
"tags": [
1015-
"Budget"
1015+
"Budgets"
10161016
],
10171017
"summary": "Delete allocations for a month",
10181018
"parameters": [
@@ -1048,6 +1048,49 @@ const docTemplate = `{
10481048
}
10491049
}
10501050
}
1051+
},
1052+
"options": {
1053+
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
1054+
"tags": [
1055+
"Budgets"
1056+
],
1057+
"summary": "Allowed HTTP verbs",
1058+
"parameters": [
1059+
{
1060+
"type": "string",
1061+
"description": "ID formatted as string",
1062+
"name": "budgetId",
1063+
"in": "path",
1064+
"required": true
1065+
},
1066+
{
1067+
"type": "string",
1068+
"description": "The month in YYYY-MM format",
1069+
"name": "month",
1070+
"in": "path",
1071+
"required": true
1072+
}
1073+
],
1074+
"responses": {
1075+
"204": {
1076+
"description": "No Content"
1077+
},
1078+
"400": {
1079+
"description": "Bad Request",
1080+
"schema": {
1081+
"$ref": "#/definitions/httperrors.HTTPError"
1082+
}
1083+
},
1084+
"404": {
1085+
"description": "Not Found"
1086+
},
1087+
"500": {
1088+
"description": "Internal Server Error",
1089+
"schema": {
1090+
"$ref": "#/definitions/httperrors.HTTPError"
1091+
}
1092+
}
1093+
}
10511094
}
10521095
},
10531096
"/v1/categories": {

api/swagger.json

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -951,10 +951,8 @@
951951
}
952952
}
953953
}
954-
}
955-
},
956-
"/v1/budgets/{budgetId}/{month}/allocations": {
957-
"get": {
954+
},
955+
"options": {
958956
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
959957
"tags": [
960958
"Budgets"
@@ -996,11 +994,13 @@
996994
}
997995
}
998996
}
999-
},
997+
}
998+
},
999+
"/v1/budgets/{budgetId}/{month}/allocations": {
10001000
"delete": {
10011001
"description": "Deletes all allocation for the specified month",
10021002
"tags": [
1003-
"Budget"
1003+
"Budgets"
10041004
],
10051005
"summary": "Delete allocations for a month",
10061006
"parameters": [
@@ -1036,6 +1036,49 @@
10361036
}
10371037
}
10381038
}
1039+
},
1040+
"options": {
1041+
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
1042+
"tags": [
1043+
"Budgets"
1044+
],
1045+
"summary": "Allowed HTTP verbs",
1046+
"parameters": [
1047+
{
1048+
"type": "string",
1049+
"description": "ID formatted as string",
1050+
"name": "budgetId",
1051+
"in": "path",
1052+
"required": true
1053+
},
1054+
{
1055+
"type": "string",
1056+
"description": "The month in YYYY-MM format",
1057+
"name": "month",
1058+
"in": "path",
1059+
"required": true
1060+
}
1061+
],
1062+
"responses": {
1063+
"204": {
1064+
"description": "No Content"
1065+
},
1066+
"400": {
1067+
"description": "Bad Request",
1068+
"schema": {
1069+
"$ref": "#/definitions/httperrors.HTTPError"
1070+
}
1071+
},
1072+
"404": {
1073+
"description": "Not Found"
1074+
},
1075+
"500": {
1076+
"description": "Internal Server Error",
1077+
"schema": {
1078+
"$ref": "#/definitions/httperrors.HTTPError"
1079+
}
1080+
}
1081+
}
10391082
}
10401083
},
10411084
"/v1/categories": {

api/swagger.yaml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,36 @@ paths:
12201220
summary: Get Budget month data
12211221
tags:
12221222
- Budgets
1223+
options:
1224+
description: Returns an empty response with the HTTP Header "allow" set to the
1225+
allowed HTTP verbs
1226+
parameters:
1227+
- description: ID formatted as string
1228+
in: path
1229+
name: budgetId
1230+
required: true
1231+
type: string
1232+
- description: The month in YYYY-MM format
1233+
in: path
1234+
name: month
1235+
required: true
1236+
type: string
1237+
responses:
1238+
"204":
1239+
description: No Content
1240+
"400":
1241+
description: Bad Request
1242+
schema:
1243+
$ref: '#/definitions/httperrors.HTTPError'
1244+
"404":
1245+
description: Not Found
1246+
"500":
1247+
description: Internal Server Error
1248+
schema:
1249+
$ref: '#/definitions/httperrors.HTTPError'
1250+
summary: Allowed HTTP verbs
1251+
tags:
1252+
- Budgets
12231253
/v1/budgets/{budgetId}/{month}/allocations:
12241254
delete:
12251255
description: Deletes all allocation for the specified month
@@ -1247,8 +1277,8 @@ paths:
12471277
$ref: '#/definitions/httperrors.HTTPError'
12481278
summary: Delete allocations for a month
12491279
tags:
1250-
- Budget
1251-
get:
1280+
- Budgets
1281+
options:
12521282
description: Returns an empty response with the HTTP Header "allow" set to the
12531283
allowed HTTP verbs
12541284
parameters:

pkg/controllers/budget.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func OptionsBudgetDetail(c *gin.Context) {
113113
// @Failure 500 {object} httperrors.HTTPError
114114
// @Param budgetId path string true "ID formatted as string"
115115
// @Param month path string true "The month in YYYY-MM format"
116-
// @Router /v1/budgets/{budgetId}/{month} [get]
116+
// @Router /v1/budgets/{budgetId}/{month} [options]
117117
func OptionsBudgetMonth(c *gin.Context) {
118118
p, err := uuid.Parse(c.Param("budgetId"))
119119
if err != nil {
@@ -144,7 +144,7 @@ func OptionsBudgetMonth(c *gin.Context) {
144144
// @Failure 500 {object} httperrors.HTTPError
145145
// @Param budgetId path string true "ID formatted as string"
146146
// @Param month path string true "The month in YYYY-MM format"
147-
// @Router /v1/budgets/{budgetId}/{month}/allocations [get]
147+
// @Router /v1/budgets/{budgetId}/{month}/allocations [options]
148148
func OptionsBudgetMonthAllocations(c *gin.Context) {
149149
p, err := uuid.Parse(c.Param("budgetId"))
150150
if err != nil {
@@ -414,7 +414,7 @@ func DeleteBudget(c *gin.Context) {
414414

415415
// @Summary Delete allocations for a month
416416
// @Description Deletes all allocation for the specified month
417-
// @Tags Budget
417+
// @Tags Budgets
418418
// @Success 204
419419
// @Failure 400 {object} httperrors.HTTPError
420420
// @Failure 500 {object} httperrors.HTTPError

0 commit comments

Comments
 (0)