Description
Hello,
what follows is a suggestion to introduce a "before/after get trigger" in the cloud code and is backed up by the following use case:
Assume that we want to know the amount of views of a blog post, so everytime a blog post is fetched with a GET request, the amount of views should be updated.
If i'm correct, there are two ways to solve this problem:
- create a cloud function, which you call instead of querying a collection
- after the fetch request, save the object again with the counter increased
While the first one is acceptable, the second is not. Although, I think the cloud code is meant for custom code and does not support a way to simulate the after get trigger, but only the before get trigger. Also in terms of consistency, I want to create normal queries and not call some custom function, which is why I propose the suggestion of before/after triggers of get requests. This is similar to the exisiting triggers and provides a uniform way to have triggers for GET/POST/DELETE requests.
Remarks/thoughts/use cases?