Skip to content

Commit 26a9e99

Browse files
authored
fix: add URL for match rules to link list (#1127)
1 parent 8342441 commit 26a9e99

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

api/docs.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2324,6 +2324,12 @@ const docTemplate = `{
23242324
"name": "account",
23252325
"in": "query"
23262326
},
2327+
{
2328+
"type": "string",
2329+
"description": "Filter by budget ID",
2330+
"name": "budget",
2331+
"in": "query"
2332+
},
23272333
{
23282334
"type": "integer",
23292335
"description": "The offset of the first Match Rule returned. Defaults to 0.",
@@ -3645,6 +3651,10 @@ const docTemplate = `{
36453651
"type": "string",
36463652
"example": "https://example.com/api/v4/envelopes?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"
36473653
},
3654+
"matchRules": {
3655+
"type": "string",
3656+
"example": "https://example.com/api/v4/match-rules?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"
3657+
},
36483658
"month": {
36493659
"description": "This uses 'YYYY-MM' for clients to replace with the actual year and month.",
36503660
"type": "string",

api/swagger.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,6 +2313,12 @@
23132313
"name": "account",
23142314
"in": "query"
23152315
},
2316+
{
2317+
"type": "string",
2318+
"description": "Filter by budget ID",
2319+
"name": "budget",
2320+
"in": "query"
2321+
},
23162322
{
23172323
"type": "integer",
23182324
"description": "The offset of the first Match Rule returned. Defaults to 0.",
@@ -3634,6 +3640,10 @@
36343640
"type": "string",
36353641
"example": "https://example.com/api/v4/envelopes?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"
36363642
},
3643+
"matchRules": {
3644+
"type": "string",
3645+
"example": "https://example.com/api/v4/match-rules?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"
3646+
},
36373647
"month": {
36383648
"description": "This uses 'YYYY-MM' for clients to replace with the actual year and month.",
36393649
"type": "string",

api/swagger.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,9 @@ definitions:
326326
description: Envelopes for this budget
327327
example: https://example.com/api/v4/envelopes?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf
328328
type: string
329+
matchRules:
330+
example: https://example.com/api/v4/match-rules?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf
331+
type: string
329332
month:
330333
description: This uses 'YYYY-MM' for clients to replace with the actual year
331334
and month.
@@ -2970,6 +2973,10 @@ paths:
29702973
in: query
29712974
name: account
29722975
type: string
2976+
- description: Filter by budget ID
2977+
in: query
2978+
name: budget
2979+
type: string
29732980
- description: The offset of the first Match Rule returned. Defaults to 0.
29742981
in: query
29752982
name: offset

internal/controllers/v4/budget_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type BudgetLinks struct {
2828
Envelopes string `json:"envelopes" example:"https://example.com/api/v4/envelopes?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"` // Envelopes for this budget
2929
Transactions string `json:"transactions" example:"https://example.com/api/v4/transactions?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"` // Transactions for this budget
3030
Month string `json:"month" example:"https://example.com/api/v4/months?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf&month=YYYY-MM"` // This uses 'YYYY-MM' for clients to replace with the actual year and month.
31+
MatchRules string `json:"matchRules" example:"https://example.com/api/v4/match-rules?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"`
3132
}
3233

3334
// Budget is the API v4 representation of a Budget.
@@ -54,6 +55,7 @@ func newBudget(c *gin.Context, model models.Budget) Budget {
5455
Envelopes: fmt.Sprintf("%s/v4/envelopes?budget=%s", url, model.ID),
5556
Transactions: fmt.Sprintf("%s/v4/transactions?budget=%s", url, model.ID),
5657
Month: fmt.Sprintf("%s/v4/months?budget=%s&month=YYYY-MM", url, model.ID),
58+
MatchRules: fmt.Sprintf("%s/v4/match-rules?budget=%s", url, model.ID),
5759
},
5860
}
5961
}

internal/controllers/v4/match_rule.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ func CreateMatchRules(c *gin.Context) {
118118
// @Param priority query uint false "Filter by priority"
119119
// @Param match query string false "Filter by match"
120120
// @Param account query string false "Filter by account ID"
121+
// @Param budget query string false "Filter by budget ID"
121122
// @Param offset query uint false "The offset of the first Match Rule returned. Defaults to 0."
122123
// @Param limit query int false "Maximum number of Match Rules to return. Defaults to 50.".
123124
// @Router /v4/match-rules [get]

0 commit comments

Comments
 (0)