politeia icon indicating copy to clipboard operation
politeia copied to clipboard

cms: create batched calls for invoices

Open fernandoabolafio opened this issue 5 years ago • 5 comments

The batched endpoints allowed a much simpler way of fetching proposals as needed in the politeiagui side. Since we also always display invoices grouped by their status, having a single endpoint creates an inconsistent pagination mechanism and requires different handling in the client. Having batched calls for invoices will increase the code consistency in the frontend side, speed up the loading and provide a better lazy load solution. That said, two accomplish that in the CMS side we need two add the following calls:

  • request token inventory for user invoices
    • POST call
    • params:
      • timestampMax
      • timestampMin
  • request token inventory for admin invoices
    • POST call
    • params:
      • timestampMax
      • timestampMin
  • request batch of invoices
    • POST call
    • params:
      • an array of invoice tokens

The current invoice statuses we have are:

  • unreviewed
  • updated
  • disputed
  • approved
  • paid
  • rejected

The main difference from what we currently do for proposals is the addition of the params timestampMax and timestampMin when asking for the token inventory. The CMS requires the invoices to be filtered by month so to accomplish the desired output here we need to know beforehand what invoices to fetch based on the time filter.

fernandoabolafio avatar Oct 29 '19 09:10 fernandoabolafio

Would like to work on this.

thi4go avatar Mar 19 '20 21:03 thi4go

ok cool, feel free to ask for any help that you may need.

alexlyp avatar Mar 19 '20 21:03 alexlyp

@alexlyp what about the same for DCCs?

victorgcramos avatar Apr 23 '20 18:04 victorgcramos

Yup makes sense to add those as well. Though different PR obvi

alexlyp avatar Apr 23 '20 18:04 alexlyp

Sure! of course! After I finish other stuff on GUI, I'd like to jump on this.

victorgcramos avatar Apr 23 '20 19:04 victorgcramos