In my application I have dozens, eventually hundreds of classes. Most of these require some business logic on save. (eg search indexing key fields, checking object relationships, etc)
Currently it seems I have to manually define lists of classes to map classes to callbacks. This is terrible frustrating, slow and fragile/hard to maintain as the application grows.
I would much prefer to use business logic to dynamically/programmatically decide if a save function needs to be called … eg:
Parse.Cloud.beforeSave("*", (request) => {
if (!someNecessaryCondition) return
//- do some application logic
})
This way, I have much simpler and robust way to determine whether a call back applies. In my case, so far, have to map 18 classes to 8 different callbacks and it’s already becoming hard to maintain … and we haven’t launched yet
It seems to be a straight forward path to extend Cloud Functions to accept a regex as class name. If anyone wants to make a PR, I estimate it to be around 2h work incl. testing.