johnRedden / TextbookProject

Textbook project start.
0 stars 0 forks source link

[Images] CS should have functionality of multiple buckets #12

Closed FelixVicis closed 8 years ago

FelixVicis commented 8 years ago

Currently images are added to the root bucket of cloudstore.

If possible, sub-bucket functionality should be added in such that images can be retrieved via the objective they were added in or a 'global' scope.

There are two ways of doing this that I can immediately see:

  1. Create an admin client with storage.NewAdminClient() to create a bucket of objective id.
  2. Add the prefix of objective.id to each object
FelixVicis commented 8 years ago

Surprisingly. Prefix checking seems to be the easier option here. going with that.

FelixVicis commented 8 years ago

Solved

I've solved this issue by adding prefixes to images. there are two kinds of prefixes.

  1. If an image uploader is given an objective id through the form value 'oid' this will be the uploaded images prefix. This can be easily queried and then presented to the user.
  2. If no prefix is given--such as with viewing /image on its own-- then the prefix is set to 'global'. This can also be queried for any images that are not tied to an objective.

Bugs Created.