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

querying for subject #20

Open
mystor opened this issue Jan 10, 2014 · 7 comments
Open

querying for subject #20

mystor opened this issue Jan 10, 2014 · 7 comments

Comments

@mystor
Copy link
Member

mystor commented Jan 10, 2014

There is currently no way to query the api such that it returns all courses within a specific subject, this is because the link property for the subject is contained within a dictionary, thus the dumb query cannot see it.

This means that the front end considers every course to be in every subject. For some reason I feel like that could cause problems.

@uniphil
Copy link
Member

uniphil commented Jan 13, 2014

Yeah that needs to be either mapped, or maybe we should return something flat instead of an object on the API?

@mystor
Copy link
Member Author

mystor commented Jan 13, 2014

I think that our mapping function in the apis should recognize links and allow requests by them.
I don't think we need to or should flatten them. I think we should try to return the same type of object as it will be, except with fewer properties.

@Graham42
Copy link
Contributor

I think that all objects should have a unique identifier and then allow queries to filter by a nested object's UID.

Example: The course CMPE 324 has a property subject which is a nested object. The subject has a uid property with the value "CMPE". The purpose of this would be so a query of /courses/?subject=CMPE would return all courses with the subject "CMPE"

The same idea could apply to courses by instructor(s) or any other nested object

@mystor
Copy link
Member Author

mystor commented Jan 13, 2014

Objects do have a unique ID right now. At the moment, the unique
identifier is called 'link'.

The unique identifier right now is not intended to be directly related to
the code of the course, so the frontend is doing a subject lookup followed
by a course lookup.

I believe that the query should look as follows under the current system:
/courses/?subject=/subjects/CMPE where /subjects/CMPE is the link to CMPE.

On Mon, Jan 13, 2014 at 12:56 PM, Graham42 [email protected] wrote:

I think that all objects should have a unique identifier and then allow
queries to filter by a nested object's UID.

Example: The course CMPE 324 has a property subject which is a nested
object. The subject has a uid property with the value "CMPE". The purpose
of this would be so a query of /courses/?subject=CMPE would return all
courses with the subject "CMPE"

The same idea could apply to courses by instructor(s) or any other nested
object


Reply to this email directly or view it on GitHubhttps://github.com//issues/20#issuecomment-32193430
.

@Graham42
Copy link
Contributor

So the link is really two parts, a type and a unique identifier {type}/{uid}. So yes the link is a unique property of the object, but it's not really an "id". What i'm suggesting is a property separate from the link.

The query you suggest does not seem like a clean solution at all.

@mystor
Copy link
Member Author

mystor commented Jan 13, 2014

I agree that it doesn't look clean, but it does make sense, to an
extent, as that is what is stored in the model.
I fully support the API implementing a cleaner frontend which uses
uids, as long as it doesn't require me to jump through hoops when
writing the frontend (I think that doing that generally means that the
API is flawed).

On 1/13/14, Graham42 [email protected] wrote:

So the link is really two parts, a type and a unique identifier
{type}/{uid}. So yes the link is a unique property of the object, but it's
not really an "id". What i'm suggesting is a property separate from the
link.

The query you suggest does not seem like a clean solution at all.


Reply to this email directly or view it on GitHub:
#20 (comment)

@pR0Ps
Copy link
Member

pR0Ps commented Jan 17, 2014

When filtering on subjects, can we not just assume that the parameter is going to be a subject?

That way, when entering: /courses/?subject=CMPE, the API could add the 'type' to the parameter, giving courses/?subject=/subjects/CMPE, which is the unique ID of the subject.

In the same way, /terms/?course=CMPE-101 would become the equivalent of /terms/?course=/courses/CMPE-101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants