app: the House of Prayer's backend (APP-1.0-PLAN §3)
Commitments stored as rules (start, length, once/daily/weekly, end, skips) in the church's timezone, daylight saving included; the day's coverage as counts only, cached until a booking changes, live over server-sent events (X-Accel-Buffering off, a comment every 25 s). Booking, skipping, changing, cancelling within the 8-hour rule, renewing (a signed single-use link), "I prayed" (self-reported). Campaigns and moderated testimonies; the admin's bookings with names, always access-logged; booking on a member's behalf. Reminders (every minute) and renewal notices (14 and 3 days before) queued in an outbox for the messaging slice. The heartbeat's prayer counts; export and delete for a member's prayer. Migration 20261202000000_house_of_prayer (checked on PostgreSQL 18: applies, no diff). 66 backend tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
* however many processes run, and timers in this process if the queue can't start.
|
||||
* JOBS_ENABLED=false turns them all off.
|
||||
*
|
||||
* So far only the Hub heartbeat. The modules add theirs (APP-1.0-PLAN §1): reminders, renewals,
|
||||
* the event feed, Cross Code's devotionals (the next 2 weeks, today included, once a night, §6),
|
||||
* The Hub heartbeat and the House of Prayer's reminders and renewal notices (prayer/jobs.ts). The
|
||||
* modules add theirs (APP-1.0-PLAN §1): the event feed, Cross Code's devotionals (the next 2 weeks, today included, once a night, §6),
|
||||
* announcement and devotional sends, and the nightly backup.
|
||||
*
|
||||
* Settings → Background jobs (§10) shows each job's schedule and last runs, runs one now, and
|
||||
@@ -16,11 +16,14 @@ import { CronExpressionParser } from 'cron-parser';
|
||||
import PgBoss from 'pg-boss';
|
||||
import type { Ctx } from './context.js';
|
||||
import { heartbeat } from './hub/client.js';
|
||||
import { sendReminders, sendRenewalNotices } from './prayer/jobs.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: 'prayer-reminders', label: 'House of Prayer: slot reminders', cron: '* * * * *', env: 'PRAYER_REMINDERS_ENABLED', run: (ctx) => sendReminders(ctx) },
|
||||
{ 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) },
|
||||
];
|
||||
|
||||
const SCHEMA = 'pgboss_app';
|
||||
|
||||
Reference in New Issue
Block a user