-
Notifications
You must be signed in to change notification settings - Fork 14
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
[WIP] Add routes to add an item to a collection from the collections page #557
base: main
Are you sure you want to change the base?
Conversation
Passing run #777 ↗︎
Details:
Review all test suite changes for PR #557 ↗︎ |
Since adding or removing collections via
These wouldn't necessarily be used when managing collections from the sample edit page, but they would be used on the collection edit page and anywhere else where the mental model is: "I'm managing a collection" The actual under-the-hood implementation currently is that the collections are stored in the item mongo documents, but from the perspective of a caller (the frontend collection page, python api interacting with collections, etc.), I think it should still "feel" like you are calling routes that deal with the collection, if that makes sense. Otherwise, it gets messy to try to do stuff on the collections page, but have to write complicated |
Yeah, that's tricky. IMO updating is a better pattern, but harder to write the routes for. If we do this, we should also use more expressive names for the functions, i.e. |
On the API side, I think using the HTTP semantics for |
Builds on #553, still some outstanding work to do.
One way of hacking in a "add item to collection" route would be to treat the following cases in
/save-item
:/save-item
is called withcollections: [{"collection_id": "coll1"}]
then after saving the item should only be in coll1 even if it was already in coll2/save-item
is called withcollections: {"collection_id": "coll1"}
then after saving the item should be added to coll1 but not removed from any other colls/save-item
is called withcollections: []
then remove the item from all collections.We will run into this pattern a lot when writing the Python API, i.e., whether you should be able to modify only the provided parts of a sample, or whether you always have to provide the full state to avoid deleting other fields (e.g., whether it should behave like a dictionary assignment or
.update()
in Python)