-
Notifications
You must be signed in to change notification settings - Fork 29
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
Change media endpoint structure #247
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…rade-mongo-driver
Default to “secondaryPreferred” Close #156
Default to “secondaryPreferred” Close #156
…i/api into feature/upgrade-mongo-driver # Conflicts: # test/unit/model/index.js
…m/dadi/api into feature/upgrade-mongo-driver
@jimlambie We have some merge conflicts here. Could this be because you progressed the previous media implementation further? Could you help me sort this out so I don't break the internet? 😇 |
…endpoint # Conflicts: # dadi/lib/auth/index.js # dadi/lib/index.js # test/acceptance/app.js
I propose that we add information about the media buckets to the
|
…o feature/postinstall-script
Extend hooks config endpoint
…o feature/media-collections-endpoint
Add postinstall script
Add media buckets to collections endpoint
…o feature/upgrade-mongo-driver # Conflicts: # README.md # package.json # scripts/coverage.svg
…rade-mongo-driver
Upgrade mongo driver
mingard
approved these changes
May 29, 2017
fix: check index object keys for sort key
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As per the conversation on Slack this morning, this PR introduces a few changes to how media is handled by API.
Currently, media assets are stored in media collections, which consist of normal collections with a version, database and collection schema, accessible on the normal REST endpoints (i.e.
/version/database/collectionName
). All that differentiates them from normal data collections is atype
property in thesettings
block set tomedia
.With this PR, the concept of media collections is abstracted from the public API. It removes the requirement for a collection schema, using a schema kept internally in API. At the moment it's hardcoded to store images (containing dimensions, size, mime type, etc.), but in the future we can look into making the schema adapt to the type of file being uploaded.
Endpoints
Requesting a signed URL for a media upload:
Uploading a media asset
Listing media assets
Accessing a specific media asset
Media buckets
Even though that's abstracted from the end user, assets still need to be stored in collections. Assets POSTed to
/media
will be stored in amediaStore
collection (configurable via themedia.defaultBucket
configuration parameter). We can have as many namespaces (what we called "media buckets") as we want. That's configurable as an array in themedia.buckets
parameter (defaulting to[]
).This is how the endpoints look like for interacting with a media bucket called
mediaAvatars
:Requesting a signed URL for a media upload:
Uploading a media asset
Listing media assets
Accessing a specific media asset
Naming conflicts
Whenever there is a data collection with the same name as one of the media buckets, API throws an error detailing the name of the conflicting collection.
API base URL
This also fixes the issue described in #245 by introducing a
server.baseUrl
configuration parameter, which will be used to determine the URL of the media assets when using the disk storage option.@mingard can you confirm whether this meets the requirements?
@jimlambie could you share your thoughts on the approach/implementation? Happy to make any required changes.
Thanks!
Fix #260
Fix #245
Fix #265