mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -0,0 +1,28 @@
|
||||
/***********************************************************************************************************************************************************************
|
||||
* File Name: cronPresets.data.js
|
||||
* Type of Program: Data
|
||||
* Description: Friendly schedule presets for admin-configurable notification
|
||||
* crons. The UI only ever offers these six options — no raw cron
|
||||
* expressions are accepted from the client, so `updateSetting`
|
||||
* in notificationSettings.controller.js validates against this map.
|
||||
*
|
||||
* Author: Kenneth Obsequio (@lash0000)
|
||||
* Date Created: Jul. 2, 2026
|
||||
***********************************************************************************************************************************************************************/
|
||||
'use strict';
|
||||
|
||||
const CRON_PRESETS = {
|
||||
every_minute: '* * * * *',
|
||||
every_5_min: '*/5 * * * *',
|
||||
every_15_min: '*/15 * * * *',
|
||||
hourly: '0 * * * *',
|
||||
every_6_hours: '0 */6 * * *',
|
||||
daily: '0 0 * * *',
|
||||
};
|
||||
|
||||
// Reverse lookup — cron string -> preset key (used to label a job's current schedule)
|
||||
const CRON_PRESET_BY_EXPRESSION = Object.fromEntries(
|
||||
Object.entries(CRON_PRESETS).map(([key, expr]) => [expr, key])
|
||||
);
|
||||
|
||||
module.exports = { CRON_PRESETS, CRON_PRESET_BY_EXPRESSION };
|
||||
Reference in New Issue
Block a user