Not sure where this stacks up in priorities or difficulty. Looking for an endpoint to get the contributions made to a specific candidate. Maybe /candidate/:id/contributions/:type
with some kind of limit
and offset
parameter so we can scroll the dataset. And maybe we can break this down a bit, since it's kind of 3 datasets.
Here's what the frontend mock is asking for:
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Thinking about implementation for a static backend, we could hard-code a limit (page size) and then just dump those page-size junks into json files. Then the query parameters just become page
number and we fetch the chunk based on that. Directory would look like this, each index.json with up to page-size number of contributors within:
candidate/
└── 1
└── contributions
├── committee
│ ├── 1
│ │ └── index.json
│ ├── 2
│ │ └── index.json
│ └── 3
│ └── index.json
├── individual
│ ├── 1
│ │ └── index.json
│ ├── 2
│ │ └── index.json
│ └── 3
│ └── index.json
└── other
├── 1
│ └── index.json
├── 2
│ └── index.json
└── 3
└── index.json
Sorting adds an additional layer of complexity to this which probably breaks your pagination implementation proposal.
I'm thinking that we should just ship all transactions for each type at once instead of attempting pagination/sorting, and let the frontend do all the hard stuff*. After all, right now our entire data set is 1,447 transactions -- not exactly a browser-crashing amount. Sure, it will grow, but we have in previous incarnations shipped quite a lot of JSON succesfully.
* of course this is my backend-biased viewpoint ;)
👍 I should have looked at the data before saying something :)
Sure, this actually frees us up to do some cool stuff on the frontend.