Closed tjanowsk closed 4 years ago
Would we not want this to be in the same service as the current data one, since data api's would have endpoints for both current/summary data and historical?
The title makes me think its intended to be a separate service.
We definitely want the subservices to be separate, each with its own call(successCallback, errorCallback)
function.
It's probably best to keep them separate on the basis of single responsibility principle.
It's also nice to have the flexibility of taking summary and historical data from different apis.
I think I disagree slightly, since it'd be easier if a subservice is responsible for a single api Vs a single endpoint.
There'd be less setup and less refactoring to do since the old stuff assumes that.
Could have a call for each endpoint like callSummary
and callHistorical
.
Maybe thats just lazyness talking and it'll be easier once it starts.
OK, that can work, I'm happy with this solution.
I was thinking more along the lines of having all apis (summary, historical, news) implement the common interface containing call, and then we could generalise the function that calls apis sequentially until one succeeds. In other words, trying to avoid duplicating code in getCovidSummaryData
.
After looking over it again I think your solution might be better. Anyways I'll try it out first and see what its like then can decide after.
We want to be able to fetch the historical data from a covid api. The api should be easy to switch if needed, and preferably we will have a list of fallback apis like in the summary api implementation.
The service should depend on the country service to select the given country. There should also be a way to specify the time frame for data of interest.