dimanche 1 mars 2015

How to create hook in strongloop loopback for soft delete

I am expecting to create hook in Strongloop Loopback for all model for the purpose of achieving the soft delete.


I wish to include where filter automatically as deleted:0 so only non-deleted data is retrieved. I want same logic for validation, that automatically my query concatenate with deleted:0 condition. I want same for associations, so only related data is fetched.


To achieve so from DB side I have created a flag with default value 0. If I wish to fetch deleted records. I simply attach deleted:1 so it overrite base condition. Ang gives me relevant.


I am PHP Dev so to achive so in frameworks, I attach condition in beforeFilter in base model. Please help me here with Strongloop Loopback.


Aucun commentaire:

Enregistrer un commentaire