Answer the question
In order to leave comments, you need to log in
What is the best way to organize logging of data changes with saving to the database in Sails.js?
Hello!
Example:
We make a change to the Client model.
When saving the model, the beforeUpdate() and afterUdate() hooks are available to us .
We also have a Log model, in which we need to write down what and by whom has changed at the moment, the old and new values.
My solution:
In beforeUpdate() we get the new values and make a request to get the old data. Compare what has changed and create a change record.
But I feel it really badly :)
What is the best way to organize such logging?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question