Search code examples
datetimetimemodelloopbackoperation

Loopback time based operations


I'm working with loopback , but now i want to perform some operation on my data after a certain time automaticaly
Precioulsly I have a model called Canal and my model has a field beginDate and endDate of type Date, beginDateis set to today date , and endDateis set to beginDateplus two dates , so I want to delete Canal whom endDate is expired

Any ideas how to process ?


Solution

  • You can use node-schedule to add something like a cron job and run it in specific time each day and delete expired Canals.

    You should define it as a boot script in LoopBack.