Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

230
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda