Skip to content

Commit cf74c20

Browse files
committed
feat: add new endpoints for allocation setting/deleting of a whole month
1 parent f05c1b1 commit cf74c20

File tree

9 files changed

+652
-83
lines changed

9 files changed

+652
-83
lines changed

api/docs.go

Lines changed: 106 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ const docTemplate = `{
984984
}
985985
},
986986
"options": {
987-
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs. **Use GET /month endpoint with month and budgetId query parameters instead.**",
987+
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs. **Use OPTIONS /month endpoint with month and budgetId query parameters instead.**",
988988
"tags": [
989989
"Budgets"
990990
],
@@ -1030,11 +1030,12 @@ const docTemplate = `{
10301030
},
10311031
"/v1/budgets/{budgetId}/{month}/allocations": {
10321032
"post": {
1033-
"description": "Sets allocations for a month for all envelopes that do not have an allocation yet",
1033+
"description": "Sets allocations for a month for all envelopes that do not have an allocation yet. **Use POST /month endpoint with month and budgetId query parameters instead.**",
10341034
"tags": [
10351035
"Budgets"
10361036
],
10371037
"summary": "Set allocations for a month",
1038+
"deprecated": true,
10381039
"parameters": [
10391040
{
10401041
"type": "string",
@@ -1079,11 +1080,12 @@ const docTemplate = `{
10791080
}
10801081
},
10811082
"delete": {
1082-
"description": "Deletes all allocation for the specified month",
1083+
"description": "Deletes all allocation for the specified month. **Use DELETE /month endpoint with month and budgetId query parameters instead.**",
10831084
"tags": [
10841085
"Budgets"
10851086
],
10861087
"summary": "Delete allocations for a month",
1088+
"deprecated": true,
10871089
"parameters": [
10881090
{
10891091
"type": "string",
@@ -1119,11 +1121,12 @@ const docTemplate = `{
11191121
}
11201122
},
11211123
"options": {
1122-
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
1124+
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs. **Use OPTIONS /month endpoint with month and budgetId query parameters instead.**",
11231125
"tags": [
11241126
"Budgets"
11251127
],
11261128
"summary": "Allowed HTTP verbs",
1129+
"deprecated": true,
11271130
"parameters": [
11281131
{
11291132
"type": "string",
@@ -1879,6 +1882,101 @@ const docTemplate = `{
18791882
}
18801883
}
18811884
},
1885+
"post": {
1886+
"description": "Sets allocations for a month for all envelopes that do not have an allocation yet",
1887+
"tags": [
1888+
"Months"
1889+
],
1890+
"summary": "Set allocations for a month",
1891+
"parameters": [
1892+
{
1893+
"type": "string",
1894+
"description": "ID formatted as string",
1895+
"name": "budget",
1896+
"in": "query",
1897+
"required": true
1898+
},
1899+
{
1900+
"type": "string",
1901+
"description": "The month in YYYY-MM format",
1902+
"name": "month",
1903+
"in": "query",
1904+
"required": true
1905+
},
1906+
{
1907+
"description": "Budget",
1908+
"name": "mode",
1909+
"in": "body",
1910+
"required": true,
1911+
"schema": {
1912+
"$ref": "#/definitions/controllers.BudgetAllocationMode"
1913+
}
1914+
}
1915+
],
1916+
"responses": {
1917+
"204": {
1918+
"description": "No Content"
1919+
},
1920+
"400": {
1921+
"description": "Bad Request",
1922+
"schema": {
1923+
"$ref": "#/definitions/httperrors.HTTPError"
1924+
}
1925+
},
1926+
"404": {
1927+
"description": "Not Found"
1928+
},
1929+
"500": {
1930+
"description": "Internal Server Error",
1931+
"schema": {
1932+
"$ref": "#/definitions/httperrors.HTTPError"
1933+
}
1934+
}
1935+
}
1936+
},
1937+
"delete": {
1938+
"description": "Deletes all allocation for the specified month",
1939+
"tags": [
1940+
"Months"
1941+
],
1942+
"summary": "Delete allocations for a month",
1943+
"parameters": [
1944+
{
1945+
"type": "string",
1946+
"description": "ID formatted as string",
1947+
"name": "budget",
1948+
"in": "query",
1949+
"required": true
1950+
},
1951+
{
1952+
"type": "string",
1953+
"description": "The month in YYYY-MM format",
1954+
"name": "month",
1955+
"in": "query",
1956+
"required": true
1957+
}
1958+
],
1959+
"responses": {
1960+
"204": {
1961+
"description": "No Content"
1962+
},
1963+
"400": {
1964+
"description": "Bad Request",
1965+
"schema": {
1966+
"$ref": "#/definitions/httperrors.HTTPError"
1967+
}
1968+
},
1969+
"404": {
1970+
"description": "Not Found"
1971+
},
1972+
"500": {
1973+
"description": "Internal Server Error",
1974+
"schema": {
1975+
"$ref": "#/definitions/httperrors.HTTPError"
1976+
}
1977+
}
1978+
}
1979+
},
18821980
"options": {
18831981
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs.",
18841982
"tags": [
@@ -2444,19 +2542,19 @@ const docTemplate = `{
24442542
"example": "https://example.com/api/v1/envelopes?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"
24452543
},
24462544
"groupedMonth": {
2447-
"description": "This 'YYYY-MM' for clients to replace with the actual year and month.",
2545+
"description": "This uses 'YYYY-MM' for clients to replace with the actual year and month.",
24482546
"type": "string",
2449-
"example": "https://example.com/api/v1/month?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf\u0026month=YYYY-MM"
2547+
"example": "https://example.com/api/v1/months?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf\u0026month=YYYY-MM"
24502548
},
24512549
"month": {
2452-
"description": "This 'YYYY-MM' for clients to replace with the actual year and month.",
2550+
"description": "This uses 'YYYY-MM' for clients to replace with the actual year and month.",
24532551
"type": "string",
24542552
"example": "https://example.com/api/v1/budgets/550dc009-cea6-4c12-b2a5-03446eb7b7cf/YYYY-MM"
24552553
},
24562554
"monthAllocations": {
24572555
"description": "This uses 'YYYY-MM' for clients to replace with the actual year and month.",
24582556
"type": "string",
2459-
"example": "https://example.com/api/v1/budgets/550dc009-cea6-4c12-b2a5-03446eb7b7cf/YYYY-MM/allocations"
2557+
"example": "https://example.com/api/v1/months?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf\u0026month=YYYY-MM"
24602558
},
24612559
"self": {
24622560
"type": "string",

api/swagger.json

Lines changed: 106 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@
972972
}
973973
},
974974
"options": {
975-
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs. **Use GET /month endpoint with month and budgetId query parameters instead.**",
975+
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs. **Use OPTIONS /month endpoint with month and budgetId query parameters instead.**",
976976
"tags": [
977977
"Budgets"
978978
],
@@ -1018,11 +1018,12 @@
10181018
},
10191019
"/v1/budgets/{budgetId}/{month}/allocations": {
10201020
"post": {
1021-
"description": "Sets allocations for a month for all envelopes that do not have an allocation yet",
1021+
"description": "Sets allocations for a month for all envelopes that do not have an allocation yet. **Use POST /month endpoint with month and budgetId query parameters instead.**",
10221022
"tags": [
10231023
"Budgets"
10241024
],
10251025
"summary": "Set allocations for a month",
1026+
"deprecated": true,
10261027
"parameters": [
10271028
{
10281029
"type": "string",
@@ -1067,11 +1068,12 @@
10671068
}
10681069
},
10691070
"delete": {
1070-
"description": "Deletes all allocation for the specified month",
1071+
"description": "Deletes all allocation for the specified month. **Use DELETE /month endpoint with month and budgetId query parameters instead.**",
10711072
"tags": [
10721073
"Budgets"
10731074
],
10741075
"summary": "Delete allocations for a month",
1076+
"deprecated": true,
10751077
"parameters": [
10761078
{
10771079
"type": "string",
@@ -1107,11 +1109,12 @@
11071109
}
11081110
},
11091111
"options": {
1110-
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
1112+
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs. **Use OPTIONS /month endpoint with month and budgetId query parameters instead.**",
11111113
"tags": [
11121114
"Budgets"
11131115
],
11141116
"summary": "Allowed HTTP verbs",
1117+
"deprecated": true,
11151118
"parameters": [
11161119
{
11171120
"type": "string",
@@ -1867,6 +1870,101 @@
18671870
}
18681871
}
18691872
},
1873+
"post": {
1874+
"description": "Sets allocations for a month for all envelopes that do not have an allocation yet",
1875+
"tags": [
1876+
"Months"
1877+
],
1878+
"summary": "Set allocations for a month",
1879+
"parameters": [
1880+
{
1881+
"type": "string",
1882+
"description": "ID formatted as string",
1883+
"name": "budget",
1884+
"in": "query",
1885+
"required": true
1886+
},
1887+
{
1888+
"type": "string",
1889+
"description": "The month in YYYY-MM format",
1890+
"name": "month",
1891+
"in": "query",
1892+
"required": true
1893+
},
1894+
{
1895+
"description": "Budget",
1896+
"name": "mode",
1897+
"in": "body",
1898+
"required": true,
1899+
"schema": {
1900+
"$ref": "#/definitions/controllers.BudgetAllocationMode"
1901+
}
1902+
}
1903+
],
1904+
"responses": {
1905+
"204": {
1906+
"description": "No Content"
1907+
},
1908+
"400": {
1909+
"description": "Bad Request",
1910+
"schema": {
1911+
"$ref": "#/definitions/httperrors.HTTPError"
1912+
}
1913+
},
1914+
"404": {
1915+
"description": "Not Found"
1916+
},
1917+
"500": {
1918+
"description": "Internal Server Error",
1919+
"schema": {
1920+
"$ref": "#/definitions/httperrors.HTTPError"
1921+
}
1922+
}
1923+
}
1924+
},
1925+
"delete": {
1926+
"description": "Deletes all allocation for the specified month",
1927+
"tags": [
1928+
"Months"
1929+
],
1930+
"summary": "Delete allocations for a month",
1931+
"parameters": [
1932+
{
1933+
"type": "string",
1934+
"description": "ID formatted as string",
1935+
"name": "budget",
1936+
"in": "query",
1937+
"required": true
1938+
},
1939+
{
1940+
"type": "string",
1941+
"description": "The month in YYYY-MM format",
1942+
"name": "month",
1943+
"in": "query",
1944+
"required": true
1945+
}
1946+
],
1947+
"responses": {
1948+
"204": {
1949+
"description": "No Content"
1950+
},
1951+
"400": {
1952+
"description": "Bad Request",
1953+
"schema": {
1954+
"$ref": "#/definitions/httperrors.HTTPError"
1955+
}
1956+
},
1957+
"404": {
1958+
"description": "Not Found"
1959+
},
1960+
"500": {
1961+
"description": "Internal Server Error",
1962+
"schema": {
1963+
"$ref": "#/definitions/httperrors.HTTPError"
1964+
}
1965+
}
1966+
}
1967+
},
18701968
"options": {
18711969
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs.",
18721970
"tags": [
@@ -2432,19 +2530,19 @@
24322530
"example": "https://example.com/api/v1/envelopes?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"
24332531
},
24342532
"groupedMonth": {
2435-
"description": "This 'YYYY-MM' for clients to replace with the actual year and month.",
2533+
"description": "This uses 'YYYY-MM' for clients to replace with the actual year and month.",
24362534
"type": "string",
2437-
"example": "https://example.com/api/v1/month?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf\u0026month=YYYY-MM"
2535+
"example": "https://example.com/api/v1/months?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf\u0026month=YYYY-MM"
24382536
},
24392537
"month": {
2440-
"description": "This 'YYYY-MM' for clients to replace with the actual year and month.",
2538+
"description": "This uses 'YYYY-MM' for clients to replace with the actual year and month.",
24412539
"type": "string",
24422540
"example": "https://example.com/api/v1/budgets/550dc009-cea6-4c12-b2a5-03446eb7b7cf/YYYY-MM"
24432541
},
24442542
"monthAllocations": {
24452543
"description": "This uses 'YYYY-MM' for clients to replace with the actual year and month.",
24462544
"type": "string",
2447-
"example": "https://example.com/api/v1/budgets/550dc009-cea6-4c12-b2a5-03446eb7b7cf/YYYY-MM/allocations"
2545+
"example": "https://example.com/api/v1/months?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf\u0026month=YYYY-MM"
24482546
},
24492547
"self": {
24502548
"type": "string",

0 commit comments

Comments
 (0)