mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-18 05:04:12 +00:00
Community Management Phase 1 completion: - Add Community Inbox admin view with filters, stats, and reply functionality - Add Rules Engine service for automated interaction processing - Add YouTube OAuth flow (auth, callback, token refresh) - Add Comment Sync cron job (every 15 minutes) - Add Community Export API (PDF/Excel/CSV) - Fix database schema for community_rules hasMany fields - Fix access control in communityAccess.ts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import cron from 'node-cron'
|
|
import type { Payload } from 'payload'
|
|
import { runConsentRetentionJob } from './consentRetentionJob'
|
|
import { runSyncAllCommentsJob } from './syncAllComments'
|
|
|
|
/**
|
|
* Initialisiert alle Scheduled Jobs
|
|
*/
|
|
export const initScheduledJobs = (payload: Payload): void => {
|
|
// Consent Retention: Täglich um 03:00 Uhr
|
|
cron.schedule(
|
|
'0 3 * * *',
|
|
async () => {
|
|
console.log('[Scheduler] Starte Consent Retention Job...')
|
|
try {
|
|
await runConsentRetentionJob(payload)
|
|
} catch (error) {
|
|
console.error('[Scheduler] Consent Retention Job fehlgeschlagen:', error)
|
|
}
|
|
},
|
|
{
|
|
timezone: 'Europe/Berlin',
|
|
},
|
|
)
|
|
|
|
// Comment Sync: Alle 15 Minuten
|
|
const syncInterval = process.env.COMMUNITY_SYNC_CRON || '*/15 * * * *'
|
|
cron.schedule(
|
|
syncInterval,
|
|
async () => {
|
|
console.log('[Scheduler] Starte Comment Sync Job...')
|
|
try {
|
|
await runSyncAllCommentsJob(payload)
|
|
} catch (error) {
|
|
console.error('[Scheduler] Comment Sync Job fehlgeschlagen:', error)
|
|
}
|
|
},
|
|
{
|
|
timezone: 'Europe/Berlin',
|
|
},
|
|
)
|
|
|
|
console.log('[Scheduler] Scheduled Jobs initialisiert.')
|
|
console.log(` - Consent Retention: Täglich um 03:00`)
|
|
console.log(` - Comment Sync: ${syncInterval}`)
|
|
}
|