Skip to content

feat: add daily cron job to mark expired invoices as overdue#1441

Open
rahul-rajak-nsut wants to merge 1 commit into
salahlalami:masterfrom
rahul-rajak-nsut:feat/invoice-expiry-cron
Open

feat: add daily cron job to mark expired invoices as overdue#1441
rahul-rajak-nsut wants to merge 1 commit into
salahlalami:masterfrom
rahul-rajak-nsut:feat/invoice-expiry-cron

Conversation

@rahul-rajak-nsut

Copy link
Copy Markdown

What does this PR do?

Adds a daily cron job that automatically checks and updates
the expiry status of invoices every day at midnight.

Related Issues

Closes #417

Steps to Test

  1. Start the backend server
  2. Check console for message: "Invoice expiry cron job scheduled!"
  3. Invoices with expiredDate < today will be marked as overdue automatically

Changes Made

  • Created backend/src/cron/invoiceCron.js
  • Installed node-cron package
  • Registered cron job in backend/src/server.js

Checklist

  • I have tested these changes
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings or errors
  • The title of my pull request is clear and descriptive

Comment thread backend/package.json
"mongoose-autopopulate": "^1.1.0",
"multer": "^1.4.4",
"node-cache": "^5.1.2",
"node-cron": "^4.2.1",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rahul-rajak-nsut why we are not using agenda or node-schedule in place of node-cron.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Daily Job Cron to Check Expiry Status of Invoices and Quotes

2 participants