17 lines
469 B
TypeScript
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);
|
|
}
|
|
};
|