Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API to get created contest list #9

Closed
kalli8 opened this issue Dec 7, 2015 · 2 comments
Closed

Add API to get created contest list #9

kalli8 opened this issue Dec 7, 2015 · 2 comments
Assignees

Comments

@kalli8
Copy link
Contributor

kalli8 commented Dec 7, 2015

Currently the GUI has no way of getting the list of contests which the current user has created. Add a call to VotingSystem or ChainAdaptorWrapper for this.

@nathanielhourt
Copy link
Contributor

Alright, so initially contests are all created by the server, so there's no way the wallet will be able to help us compile this list. The list simply has to come from the server (where it's easy to compile). In theory, this list could be hundreds or thousands of contests in size, so I don't want to fetch them all at once, but a few at a time... We already have infrastructure in place for this (the contest generator), so let's use it!

In backend.capnp, I can update the getContestGenerator call to take an enum argument which specifies the type of contest generator (i.e. FeedContests, MyContests, CoinContests, etc). This requires passing an additional parameter (whose feed/whose contests/which coin), but that's simple enough.

This also requires updating BackendWrapper to not hide the contest generator as an implementation detail, but instead return it for the GUI to handle directly, since now there may be several generators active at a time. @kalli8 should note this.

Also, I'm now discussing having the client ask for data for a particular user. Make sure we manage the security aspects of this to ensure that the data is either nonsensitive, or is authenticated to ensure the requester has access to it. For instance, creators of contests will likely be public information, so anyone can ask for a list of contests anyone has created. What contests are appearing in a given user's feed is not public, and should not be disclosed to just anyone. It's probably a good idea not to take an argument on whose feed is being requested, but to let the server determine this from authentication data. I always prefer to design APIs such that if the client shouldn't be able to do something, there's simply no way to ask for it.

@nathanielhourt
Copy link
Contributor

After further discussion with @akernest we think it would be better to have two types of contest generator: a customized feed generator, and a general search results generator. The search results generator will support all the other types of query, such as contests by creator, by coin, by search terms, etc. This second type of generator will also need to support specifying a sort order of results.

The design for the API call for the search generator is still in the air, but what I'm thinking right now is a call that takes a list of "filters" which have a type (search term, contest coin, contest creator...) and any arguments which are relevant for that filter, and a list of sorting priorities to order the results.

nathanielhourt added a commit to nathanielhourt/StakeWeightedVoting that referenced this issue Dec 14, 2015
Eventually, we may want to refactor this to have the QML construct the
filters to expose maximum flexibility to the GUI; however, this is much
more elaborate and isn't needed for MVP.

Also, it may be desirable to have the server do something more
intelligent when 'searching' contests than just return the same list as
the feed returns; however, this could also be postponed until making a
real blockchain-based implementation (why waste so much effort creating
an elaborate stub?)
nathanielhourt pushed a commit that referenced this issue Dec 14, 2015
Resolve #9: Add early APIs for filtered contest generators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants