Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
Trigger Events to change database record in Node JS when reached a future dateTime

I am developing a functionality to the users where they add a task to database with DateTime field ,and when the DateTime reached it triggers event that change a filed in other table from "enabled" to "disabled" ,Plus the user can cancel this task before it happen. so how can I trigger this functionality know that my stack is , NodeJs with NestJs and Prisma ProstgreSql. i checked @nestjs/schedule and node/cron it seems it's difficult to handel task canceling or recreate the job when the server restart. any recommendation for NPM packages would be helpful.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use NestJS lifecycle triggers like onApplicationBootstrap

  • Get closest task or bunch of tasks from DB on server run,
  • Add wait function. Like wait(task, time)
  • Execute task (Change fields by update)
  • On update callback get next task from DB and wait again

For stop execution of some DB records add boolean field like execute: false and change it by your API. On next cycle filter records by this field.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!