Closed joaopapereira closed 8 years ago
great addition @joaopapereira !
interesting, so you've gone with having a size of zero represent an active vote.
I had been thinking that we'd only support a single active vote in the first instance, but I guess this works fine, given that posting on votes will be by ID so there shouldn't be any confusion about which story a vote applies to.
So this is kind of more we need for an absolute MVP ...
Maybe I'm misinterpreting this, but have you set it up so that GET /stories
only returns stories with size 0? That seems a little unRESTful to me. I feel like GET /stories
should always return ALL stories, and if we want to modify it then that should be done by passing a parameter. What do you think?
Also some merge conflicts here ...
I am ok with that. Should we go with: GET /stories/active
@joaopapereira I think ultimately GET /stories/active
would get a story that was named active
- how about GET /stories?size=0
?
@tansaku I think we should have a simple endpoint to get all the stories that are actively being voted instead of using the get parameters to do that
I like the idea about filtering actives stories.
http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#advanced-queries
By the way assigning 0
to size
sounds like a little trick ;)
What about GET /stories?state=active
There's interesting discussion here suggesting we use a POST:
http://stackoverflow.com/questions/5020704/how-to-design-restful-search-filtering
Adding a body or params to a GET breaks caching ...
Although see also http://stackoverflow.com/questions/207477/restful-url-design-for-search
After reading that I'm thinking GET /stories?size=0
The only thing that I don't like so much is that clients have know about this implementation detail:
stories
with size
of 0
value are those which are ready to to be voted.
I agree that maybe size=0 is something that we are using for now. I would go with my get suggestion of state=active
let's work with size=0 for now - and then once we're merged we can look at state=active and see about whether we need to add that to the domain model. I think what we want to avoid in the short term is one language for clients and a separate one for the back end - I'm working from Eric Evans concept of domain driven design where we try to keep a single consistent language throughout the system, at least within a given "bounded context"
fixes #9