Closed jacomago closed 9 months ago
Thank you, This should address #101
In the long run I wonder if there is a better way of doing this? is our reliance on nested documents making this more complicated that it should be
Thanks for the quick fix!
Thank you, This should address #101
In the long run I wonder if there is a better way of doing this? is our reliance on nested documents making this more complicated that it should be
I thought the same thing fixing this. To me there is a natural hierachy that
Channels have properties and tags
So it seems weird to me to allow Properties to have channels or Tags to have channels.
A more natural api to me would be:
A Property, Tag, and channel have a UID as well as the name_id which aren't returned from api, but are stored in db to make some of the queries simpler.
POST /properties Add a new property PUT /properties/{propertyName} updates a property name only GET /properties/{propertyName} returns a propertyName and Owner DELETE /properties/{propertyName} Delete a property
POST /tags Add a new property PUT /tags/{tagName} renames a tag only GET /tags/{tagName} returns a tag and Owner DELETE /tags/{tagName} deletes a tag
POST /channels Add a new channel or channels, that can include a list of properties and tags that don't exist yet PUT /channels Updates existing channels with new tags and property values and properties PUT /channels/{channelName} updates channelName and tags and properties of channel GET /channels/{channelName} Gets a channel and its properties and tags
POST /channels/{channelName}/properties Replace properties list PUT /channels/{channelName}/properties Add to properties list or update values of properties POST /channels/{channelName}/properties/{propertyName} Add property to channel with value PUT /channels/{channelName}/properties/{propertyName} Update value for a property DELETE /channels/{channelName}/properties/{propertyName} Delete property from channel GET /channels/{channelName}/properties/ Get properties of a channel including values GET /channels/{channelName}/properties/{propertyName} Get single property of a channel
POST /channels/{channelName}/tags Replace tag list PUT /channels/{channelName}/tags Add to tag list POST /channels/{channelName}/tags/{tagName} Add tag to channel DELETE /channels/{channelName}/tags/{tagName} Delete tag from channel GET /channels/{channelName}/tags/ Get tags of a channel
POST /channels{q=Query}/properties Add a new property to queried channels PUT /channels{q=Query}/properties Update a already attached properties to queried channels to a new value PUT /channels{q=Query}/properties/{propertyName} Update an already attached property to queried channels to a new value DELETE /channels{q=Query}/properties Delete properties from queried channels DELETE /channels{q=Query}/properties/{propertyName} Delete property from queried channels
POST /channels{q=Query}/tags Add a new tag or tags to queried channels DELETE /channels{q=Query}/tags Delete tags from queried channels DELETE /channels{q=Query}/tags/{tagName} Delete tag from queried channels
Main thing is nesting is only done on /channels and POST, PUT /channels are the only bulk apis for updates.
I think a new api could be written (Would be nice to use Spring Data). But channelfinder is pretty small so supporting the current nested documents is not that much work, so I'm not sure a new api is worth the effort. It would require either supporting two api versions at the same time, or tagging a chanelfinder version in channelfinder clients to check support.
So it seems weird to me to allow Properties to have channels or Tags to have channels.
I agree, it makes the API/code more complicated without much clear benefit
to the value mentioned in the property payload uploaded.
Reproduces and fixes #101