File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -34,21 +34,23 @@ type AccountLinks struct {
3434type AccountQueryFilter struct {
3535 Name string `form:"name" filterField:"false"` // Fuzzy filter for the account name
3636 Note string `form:"note" filterField:"false"` // Fuzzy filter for the note
37- BudgetID string `form:"budget"`
38- OnBudget bool `form:"onBudget"`
39- External bool `form:"external"`
37+ BudgetID string `form:"budget"` // By budget ID
38+ OnBudget bool `form:"onBudget"` // Is the account on-budget?
39+ External bool `form:"external"` // Is the account external?
40+ Hidden bool `form:"hidden"` // Is the account hidden?
4041}
4142
42- func (a AccountQueryFilter ) ToCreate (c * gin.Context ) (models.AccountCreate , bool ) {
43- budgetID , ok := httputil .UUIDFromString (c , a .BudgetID )
43+ func (f AccountQueryFilter ) ToCreate (c * gin.Context ) (models.AccountCreate , bool ) {
44+ budgetID , ok := httputil .UUIDFromString (c , f .BudgetID )
4445 if ! ok {
4546 return models.AccountCreate {}, false
4647 }
4748
4849 return models.AccountCreate {
4950 BudgetID : budgetID ,
50- OnBudget : a .OnBudget ,
51- External : a .External ,
51+ OnBudget : f .OnBudget ,
52+ External : f .External ,
53+ Hidden : f .Hidden ,
5254 }, true
5355}
5456
Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ func (suite *TestSuiteStandard) TestGetAccountsFilter() {
9898 BudgetID : b1 .Data .ID ,
9999 OnBudget : false ,
100100 External : true ,
101+ Hidden : true ,
101102 })
102103
103104 _ = suite .createTestAccount (models.AccountCreate {
@@ -110,6 +111,7 @@ func (suite *TestSuiteStandard) TestGetAccountsFilter() {
110111 Name : "Name only" ,
111112 Note : "" ,
112113 BudgetID : b1 .Data .ID ,
114+ Hidden : true ,
113115 })
114116
115117 tests := []struct {
@@ -130,6 +132,8 @@ func (suite *TestSuiteStandard) TestGetAccountsFilter() {
130132 {"Off budget" , "onBudget=false" , 4 },
131133 {"External" , "external=true" , 2 },
132134 {"Internal" , "external=false" , 3 },
135+ {"Not Hidden" , "hidden=false" , 3 },
136+ {"Hidden" , "hidden=true" , 2 },
133137 }
134138
135139 for _ , tt := range tests {
You can’t perform that action at this time.
0 commit comments