feat: event registration emails and reminders (reminders untested)

This commit is contained in:
2026-09-24 00:55:47 +02:00
parent 1879a206ad
commit e5bce55bf7
9 changed files with 757 additions and 1 deletions
@@ -0,0 +1,40 @@
import type { Core } from '@strapi/strapi';
import { LOG_PREFIX } from './constants';
const REMINDER_SETTINGS_UID = 'api::reminder-settings.reminder-settings';
/**
* The values the reminder cron job falls back to when no `reminder-settings`
* single type exists yet (first boot on an empty database). The admin panel
* owns these values from then on; this is only the bootstrap default.
*/
export const DEFAULT_REMINDER_SETTINGS = {
enabled: true,
leadHours: 48,
} as const;
/**
* Create the `reminder-settings` single type if the database does not have one
* yet, so the values the reminder cron job depends on exist and are editable in
* the admin panel after the very first boot. Never overwrites an existing row.
*/
export const ensureReminderSettings = async (strapi: Core.Strapi): Promise<void> => {
const existing = await strapi
.documents(REMINDER_SETTINGS_UID)
.findFirst({});
if (existing) {
return;
}
await strapi.documents(REMINDER_SETTINGS_UID).create({
data: { ...DEFAULT_REMINDER_SETTINGS },
});
strapi.log.info(
`${LOG_PREFIX} created reminder-settings single type with defaults ` +
`(enabled=${DEFAULT_REMINDER_SETTINGS.enabled}, ` +
`leadHours=${DEFAULT_REMINDER_SETTINGS.leadHours}).`
);
};