mirror of
https://github.com/wassname/talk.git
synced 2026-08-08 11:28:12 +08:00
* chore: renamed old templates * feat: initial notifications support * feat: email enhancements * fix: linting * feat: initial digesting beheviour * feat: added notification configuration * feat: added unsubscribe routes * fix: fixed failing snapshots/tests bc random ids * feat: adjusted the save beheviour, added tests * feat: added tests * feat: added staff replies * feat: renamed E-Mail to Email * feat: enhanced cron processing * fix: linting + updating tests * feat: enhanced cron context * fix: added staff replies back in
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { Db } from "mongodb";
|
|
|
|
import { Config } from "coral-server/config";
|
|
import { MailerQueue } from "coral-server/queue/tasks/mailer";
|
|
import { JWTSigningConfig } from "coral-server/services/jwt";
|
|
import TenantCache from "coral-server/services/tenant/cache";
|
|
|
|
import { registerAccountDeletion } from "./accountDeletion";
|
|
import { registerNotificationDigesting } from "./notificationDigesting";
|
|
|
|
export interface ScheduledJobGroups {
|
|
accountDeletion: ReturnType<typeof registerAccountDeletion>;
|
|
notificationDigesting: ReturnType<typeof registerNotificationDigesting>;
|
|
}
|
|
|
|
interface Options {
|
|
mongo: Db;
|
|
config: Config;
|
|
mailerQueue: MailerQueue;
|
|
signingConfig: JWTSigningConfig;
|
|
tenantCache: TenantCache;
|
|
}
|
|
|
|
export default function startScheduledTasks(
|
|
options: Options
|
|
): ScheduledJobGroups {
|
|
const tasks: ScheduledJobGroups = {
|
|
accountDeletion: registerAccountDeletion(options),
|
|
notificationDigesting: registerNotificationDigesting(options),
|
|
};
|
|
|
|
for (const { name, schedulers } of Object.values(tasks)) {
|
|
for (const scheduler of schedulers) {
|
|
scheduler.job.start();
|
|
scheduler.log.debug({ jobGroupName: name }, "now started job scheduling");
|
|
}
|
|
}
|
|
|
|
return tasks;
|
|
}
|