rosshamish / classtime

university schedule generation and course data API
MIT License
16 stars 2 forks source link

Store "more like" schedules on backend, respond with identifiers instead of full objects #73

Closed rosshamish closed 9 years ago

rosshamish commented 9 years ago

It gets a little ridiculous the send so many schedules. What should be done is to have a small-ish cache of Schedule objects stored in the database, and identify those schedules by a hash or an identifier of some sort. If a schedule is requested which does not exist in the cache, there should be enough info (somehow) to rebuild that schedule somehow.

Then, the "more like" can be a list of identifiers, instead of a list of large schedule dictionary objects.

This is necessary since some schedule requests can balloon to upwards of 1MB with the current method.

Also necessary here will be to expose /api/schedules/##### endpoint so that the frontend can request the data

rosshamish commented 9 years ago

Schedule DB object model will need to be created first, just like #75 Schedule bookmarks/watch-lists


From #75

This is doable by saving Schedule objects in the DB.

Schedule object should be:

institution // "ualberta"
schedule_identifier // "000123"
sections // ["01234", "05678", ...]
more_like // ["000456", "000789", ...]
rosshamish commented 9 years ago

While doing this, it also makes sense to change the current GET api/generate-schedules?q={...} to POST api/schedules?q={...} for proper semantic REST.

rosshamish commented 9 years ago

For documentation purposes...we discussed the GET-POST switch and decided it didn't matter.