I have a social mobile app, where users can like posts. Every time a like occurs, a
cloud function creates a new
Like object and then, a
afterSave trigger fetches the post, increases its
numberOfLikes, creates a
Notification object and performs a fetch/update on the poster.
My question is, have I divided the amount of work between the cloud function and the trigger properly? Should the cloud function do all the work? Are triggers heavy for the system and so they should only be used on less frequent operations?