@@ -52,15 +52,15 @@ func (a *AccountV3) links(c *gin.Context) {
5252}
5353
5454type AccountQueryFilterV3 struct {
55- Name string `form:"name" filterField:"false"` // Fuzzy filter for the account name
56- Note string `form:"note" filterField:"false"` // Fuzzy filter for the note
57- BudgetID string `form:"budget"` // By budget ID
58- OnBudget bool `form:"onBudget"` // Is the account on-budget?
59- External bool `form:"external"` // Is the account external?
60- Hidden bool `form:"hidden"` // Is the account hidden?
61- Search string `form:"search" filterField:"false"` // By string in name or note
62- Offset uint `form:"offset" filterField:"false"` // The offset of the first Transaction returned. Defaults to 0.
63- Limit int `form:"limit" filterField:"false"` // Maximum number of transactions to return. Defaults to 50.
55+ Name string `form:"name" filterField:"false"` // Fuzzy filter for the account name
56+ Note string `form:"note" filterField:"false"` // Fuzzy filter for the note
57+ BudgetID string `form:"budget"` // By budget ID
58+ OnBudget bool `form:"onBudget"` // Is the account on-budget?
59+ External bool `form:"external"` // Is the account external?
60+ Archived bool `form:"archived" filterField:"false"` // Is the account hidden?
61+ Search string `form:"search" filterField:"false"` // By string in name or note
62+ Offset uint `form:"offset" filterField:"false"` // The offset of the first Transaction returned. Defaults to 0.
63+ Limit int `form:"limit" filterField:"false"` // Maximum number of transactions to return. Defaults to 50.
6464}
6565
6666func (f AccountQueryFilterV3 ) ToCreate () (models.AccountCreate , httperrors.Error ) {
@@ -73,7 +73,7 @@ func (f AccountQueryFilterV3) ToCreate() (models.AccountCreate, httperrors.Error
7373 BudgetID : budgetID ,
7474 OnBudget : f .OnBudget ,
7575 External : f .External ,
76- Hidden : f .Hidden ,
76+ Hidden : f .Archived ,
7777 }, httperrors.Error {}
7878}
7979
@@ -256,7 +256,7 @@ func (co Controller) CreateAccountsV3(c *gin.Context) {
256256// @Param budget query string false "Filter by budget ID"
257257// @Param onBudget query bool false "Is the account on-budget?"
258258// @Param external query bool false "Is the account external?"
259- // @Param hidden query bool false "Is the account hidden ?"
259+ // @Param archived query bool false "Is the account archived ?"
260260// @Param search query string false "Search for this text in name and note"
261261// @Param offset query uint false "The offset of the first Transaction returned. Defaults to 0."
262262// @Param limit query int false "Maximum number of transactions to return. Defaults to 50."
@@ -270,6 +270,13 @@ func (co Controller) GetAccountsV3(c *gin.Context) {
270270 // Get the set parameters in the query string
271271 queryFields , setFields := httputil .GetURLFields (c .Request .URL , filter )
272272
273+ // If the archived parameter is set, add "Hidden" to the query fields
274+ // This is done since in v3, we're using the name "Archived", but the
275+ // field is not yet updated in the database, which will happen later
276+ if slices .Contains (setFields , "Archived" ) {
277+ queryFields = append (queryFields , "Hidden" )
278+ }
279+
273280 // Convert the QueryFilter to a Create struct
274281 create , err := filter .ToCreate ()
275282 if ! err .Nil () {
0 commit comments