Files
lst_v3/backend/system/settingsFeatures.controller.ts
2026-03-01 14:10:19 -06:00

17 lines
469 B
TypeScript

/**
* When a feature setting gets updated we will handle it here.
* we will stop jobs, stop cycles
*/
import type { Setting } from "../db/schema/settings.schema.js";
import { resumeCronJob, stopCronJob } from "../utils/croner.utils.js";
export const featureControl = async (data: Setting) => {
// when a feature is changed to active or deactivated we will update the cron.
if (data.active) {
resumeCronJob(data.name);
} else {
stopCronJob(data.name);
}
};