2026-09-11 02:46:56 +02:00
|
|
|
import type { Core } from '@strapi/strapi';
|
|
|
|
|
|
|
|
|
|
import { runBootstrap } from './bootstrap';
|
2026-09-24 00:55:47 +02:00
|
|
|
import { runEventReminders } from './lib/event-reminders';
|
2026-09-24 11:51:24 +02:00
|
|
|
import { runWaitlistPromotion } from './lib/waitlist-promotion';
|
2026-09-11 02:46:56 +02:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
/**
|
|
|
|
|
* An asynchronous register function that runs before
|
|
|
|
|
* your application is initialized.
|
|
|
|
|
*
|
|
|
|
|
* This gives you an opportunity to extend code.
|
|
|
|
|
*/
|
|
|
|
|
register(/* { strapi }: { strapi: Core.Strapi } */) {},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* An asynchronous bootstrap function that runs before
|
|
|
|
|
* your application gets started.
|
|
|
|
|
*
|
|
|
|
|
* Reconciles the state the SHARP-ER site depends on: the `en` / `ar` locales
|
|
|
|
|
* and the Public role permissions. See `src/bootstrap/` - every step is
|
|
|
|
|
* idempotent, so this is safe on every boot.
|
|
|
|
|
*/
|
|
|
|
|
async bootstrap({ strapi }: { strapi: Core.Strapi }) {
|
|
|
|
|
await runBootstrap({ strapi });
|
2026-09-24 00:55:47 +02:00
|
|
|
|
|
|
|
|
// The cron provider always runs its own `start()`, so `strapi.cron.add()`
|
|
|
|
|
// here schedules immediately. Respect the explicit opt-out in
|
|
|
|
|
// `server.cron.enabled` (env `CRON_ENABLED`): without SMTP configured the
|
|
|
|
|
// hourly job would just fail and log, so it stays inert by default.
|
|
|
|
|
if (strapi.config.get('server.cron.enabled', false)) {
|
|
|
|
|
strapi.cron.add({
|
|
|
|
|
'send-event-reminders': {
|
|
|
|
|
task: runEventReminders,
|
|
|
|
|
options: { rule: '0 * * * *', tz: 'Africa/Tripoli' },
|
|
|
|
|
},
|
2026-09-24 11:51:24 +02:00
|
|
|
'run-waitlist-promotion': {
|
|
|
|
|
task: runWaitlistPromotion,
|
|
|
|
|
options: { rule: '0 * * * *', tz: 'Africa/Tripoli' },
|
|
|
|
|
},
|
2026-09-24 00:55:47 +02:00
|
|
|
});
|
2026-09-24 11:51:24 +02:00
|
|
|
strapi.log.info('[index] event reminder + waitlist promotion cron jobs registered.');
|
2026-09-24 00:55:47 +02:00
|
|
|
}
|
2026-09-11 02:46:56 +02:00
|
|
|
},
|
|
|
|
|
};
|