Skip to content

Suggestion: before/after get triggers #2937

Closed
@jonas-db

Description

@jonas-db

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions