app: announcements, devotionals and events' backend (APP-1.0-PLAN §5-§7)
Announcements: public or members-only, pinned, a campus, a publish time and an end, an optional button, markdown text; Content admins write them; the heartbeat counts the last 30 days; "also send it" flags kept for §8. Devotionals: Cross Code's from the Hub each night and on Sync now (the next 2 weeks from today in the church's timezone, with the licence; exactly those days replaced, the rest kept, a Hub outage changes nothing), or the church's own by its Devotional writers, by hand or the same CSV import as the Hub's (preview, then replace or skip days already filled). Only KJV and BSB; the passage with its copyright line and Read in YouVersion; today's or the most recent; the archive by month; members-only ones; the acknowledgements. Events: simple events in the church's timezone, and the feed both ways as the Website's (publish its own as crosscode.event/1 with removals; read-only copies of Cross Events' and the Website's, Register on the Events site, canonical to the origin). Jobs event-feed (15 min) and crosscode-devotionals (01:15). Migration 20261204000000_content (checked on PostgreSQL 18: applies, no diff). 93 backend tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,12 +18,16 @@ import type { Ctx } from './context.js';
|
||||
import { heartbeat } from './hub/client.js';
|
||||
import { sendReminders, sendRenewalNotices } from './prayer/jobs.js';
|
||||
import { tidyRequests } from './requests/service.js';
|
||||
import { nightlySync } from './content/devotionals.js';
|
||||
import { syncAll } from './events/feed.js';
|
||||
import { DELETE_AFTER_CLOSED_DAYS } from './requests/settings.js';
|
||||
|
||||
export type Job = { name: string; label: string; cron: string; env: string | null; run: (ctx: Ctx) => Promise<unknown> };
|
||||
|
||||
export const JOBS: Job[] = [
|
||||
{ name: 'hub-heartbeat', label: 'Cross Code Hub: heartbeat and licence refresh', cron: '*/15 * * * *', env: 'HUB_HEARTBEAT_ENABLED', run: (ctx) => heartbeat(ctx) },
|
||||
{ name: 'event-feed', label: 'Events from the church\'s other sites (Cross Events, the Website)', cron: '*/15 * * * *', env: 'FEED_JOB_ENABLED', run: (ctx) => syncAll(ctx) },
|
||||
{ name: 'crosscode-devotionals', label: 'Cross Code\'s devotionals from the Hub (the next 2 weeks)', cron: '15 1 * * *', env: null, run: (ctx) => nightlySync(ctx) },
|
||||
{ name: 'prayer-reminders', label: 'House of Prayer: slot reminders', cron: '* * * * *', env: 'PRAYER_REMINDERS_ENABLED', run: (ctx) => sendReminders(ctx) },
|
||||
{ name: 'prayer-requests-tidy', label: 'Prayer requests: close after their days, delete 12 months after closing', cron: '30 3 * * *', env: null, run: (ctx) => tidyRequests(ctx, DELETE_AFTER_CLOSED_DAYS) },
|
||||
{ name: 'prayer-renewals', label: 'House of Prayer: renewal notices (14 and 3 days before the end)', cron: '0 9 * * *', env: 'PRAYER_RENEWALS_ENABLED', run: (ctx) => sendRenewalNotices(ctx) },
|
||||
|
||||
Reference in New Issue
Block a user