cms.c2sgmbh/src/jobs/scheduler.ts
Martin Porwoll 74b251edea feat(Community): add Community Inbox View, Rules Engine, and YouTube OAuth
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>
2026-01-15 16:26:08 +00:00

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}`)
}