envelope-zero/backend

Allow transaction filtering by availableFrom

Closed this issue · 2 comments

Is your feature request related to a problem? Please describe.

I am looking for incoming transactions that make up the income of a specified month, for example "Show me all transactions that are counted as income for March 2024".

Describe the solution you'd like
Looking at the existing code I think the following could be a possible solution:

  • Add a filter (probably two or three) for availableFrom in
    func GetTransactions(c *gin.Context) {
  • Similar to the date, fromDate and untilDate filters we could expose availableFromDate, availableFromFromDate and availableFromUntilDate. The naming is not ideal but I don't have a better idea right now. But I hope it shows what I mean.
  • The filter should expose logic similar to
    Where("transactions.available_from >= date(?) AND transactions.available_from < date(?)", month, month.AddDate(0, 1)).

Describe alternatives you've considered

Currently, the only alternative is for the client application to fetch all incoming transactions (up to the month of interest) from the API and then filter them based on their availableFrom field. Processing this in the backend/database and only sending the result should be quicker (and easier to implement).

Additional context
None, let me know if anything is unclear.

Love the detail in this issue. Made it even easier to implement, thanks!

This is now available exactly as you proposed in v5.4.0

Nice, thanks!