Files
Zumri-Backend/cron/index.js
T
Sathira Sri Sathara abb760cc19
CI / test (push) Successful in 10m23s
feat: Implement loyalty and wholesale services with models, routes, and validation
- Added models for loyalty points allocation, redemption, rewards, tiers, tier history, and referrals.
- Created business credit ledger entries, settlements, and settlement items models.
- Developed services for loyalty operations including account management, point allocation, redemption, and referral handling.
- Implemented wholesale credit management services for transactions and settlements.
- Established routes for loyalty and wholesale admin and customer operations with appropriate middleware for authentication and permission checks.
- Introduced validation schemas for loyalty and wholesale operations.
- Set up cron jobs for loyalty reconciliation tasks such as birthday rewards and point expirations.
- Created migration scripts to set up the database schema for loyalty and wholesale features.
- Added unit tests for validation and policy enforcement in loyalty and wholesale services.
2026-09-09 13:56:37 +05:30

31 lines
982 B
JavaScript

/**
* Copyright (c) 2026 Niolla
* All rights reserved.
*
* This source code is proprietary and confidential.
* Unauthorized copying, modification, distribution, or use
* of this file, via any medium, is strictly prohibited.
*/
// cron/index.js
const startCleanInactiveNotificationsCron = require("./notificationCleaning.cron");
const startInventoryReservationExpiryCron = require("./inventoryReservationExpiry.cron");
const startCheckoutExpiryCron = require("./checkoutExpiry.cron");
const startLoyaltyReconciliationCron = require("./loyaltyReconciliation.cron");
function startAllCrons() {
console.log("Starting Cron Jobs...");
const tasks = [startCleanInactiveNotificationsCron(), startInventoryReservationExpiryCron(), startCheckoutExpiryCron(), startLoyaltyReconciliationCron()];
return async () => {
for (const task of tasks) {
task.stop();
if (typeof task.destroy === "function") task.destroy();
}
};
}
module.exports = startAllCrons;