mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
45 lines
2.4 KiB
JavaScript
45 lines
2.4 KiB
JavaScript
/***********************************************************************************************************************************************************************
|
|
* File Name : client.cron.js
|
|
* Type : Cron Registry — Client side
|
|
* Description : Aggregates and registers every client-facing scheduled job.
|
|
* Same shape as admin.cron.js — each job module exports
|
|
* { name, schedule, run }, listed in the `jobs` array below.
|
|
*
|
|
* All three are settings-backed (see cronRegistry.util.js) —
|
|
* schedule/enabled state lives in cron_notification_settings
|
|
* and is configurable from /admin/notifications/settings
|
|
* without a restart.
|
|
*
|
|
* Currently registered:
|
|
* - userNotifications (cron/jobs/user_notifications.cron.js)
|
|
* - issueCertificates (cron/jobs/issue_certificates.cron.js)
|
|
* - expireUserTiers (cron/jobs/expire_user_tiers.cron.js)
|
|
*
|
|
* Author: Kenneth Obsequio (@lash0000)
|
|
* Date Created: Jun. 17, 2026
|
|
***********************************************************************************************************************************************************************/
|
|
const userNotifications = require('./jobs/user_notifications.cron');
|
|
const issueCertificates = require('./jobs/issue_certificates.cron');
|
|
const expireUserTiers = require('./jobs/expire_user_tiers.cron');
|
|
const taskDueSoon = require('./jobs/task_due_soon.cron');
|
|
const { startSettingsBackedJobs } = require('./cronRegistry.util');
|
|
|
|
// TODO(ads-7): Add an `expire_advertisements.cron.js` job (same shape as
|
|
// expire_user_tiers.cron.js) that auto-archives (soft-deletes) advertisements
|
|
// once their end_date has passed, instead of just leaving them at derived
|
|
// status "expired" forever. Register it in the `jobs` array below.
|
|
// ─── Registry — add future client-side cron jobs here ────────────────────────
|
|
const jobs = [
|
|
userNotifications,
|
|
issueCertificates,
|
|
expireUserTiers,
|
|
taskDueSoon,
|
|
];
|
|
|
|
// ─── Boot all registered client-side jobs ─────────────────────────────────────
|
|
async function startClientCronJobs() {
|
|
return startSettingsBackedJobs(jobs, 'CLIENT');
|
|
}
|
|
|
|
module.exports = { startClientCronJobs };
|