I've created a database and included in the tables are these three relatives
Game GameHasPlayer Player
I've created a data access API project, with simple methods for getting filtered results:
GetGame(s) GetGameHasPlayer(s) GetPlayer(s)
I've created a website which can call the API, and the aim is to have this API accessible on other places / websites too.
Then I start to get confused because of the possible options on where to put my filtering.
E.g. the website needs to present
Games joined with
GameHasPlayers. I'll create a new Model (or ViewModel?) called
GamesAndPlayers and it'll show each game that contains a certain
Player and also show each
Player in that game.
So on one hand, this feels like something that should go on outside of the data access and API layer because it's just a filter and join on existing
GameHasPlayertables - I wouldn't want to bloat my API by adding filters and joins for any other similar cases. The onus is on the API caller / consumer to get data and do the sorting (e.g. website 1)
On the other hand, I feel like my API can provide this quite well in one simple call, plus then it's available to all consumers (e.g. all websites that hook up to it) without code repetition, and it also prevents maintenance on a multitude of sites when changes occur.
So my question is - what other arguments for and against am I missing, and am I right to go with option 2?