Releases with what's new, notices to churches, withdrawn update requests

- Releases page: each Cross Events version with notes and an urgent flag; the
  newest is the latest version (moved off Settings; the old setting becomes the
  first release). Installs get the notes for every newer version.
- Notices page: a banner for site admins and supervisors (with a time window),
  an email to the customer and admin contact, or both; for every install or
  chosen ones.
- POST /api/installs/update-request/cancel resolves the request and emails Joshua.
- Protocol doc: releases and notices in the heartbeat/register replies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 08:54:35 +02:00
co-authored by Claude Opus 5.5
parent 26e12a199a
commit 1449e5046e
18 changed files with 900 additions and 12 deletions
@@ -0,0 +1,45 @@
-- CreateEnum
CREATE TYPE "NoticeLevel" AS ENUM ('info', 'maintenance', 'warning');
-- CreateTable
CREATE TABLE "Release" (
"id" TEXT NOT NULL,
"version" TEXT NOT NULL,
"notes" TEXT NOT NULL DEFAULT '',
"urgent" BOOLEAN NOT NULL DEFAULT false,
"releasedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Release_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Notice" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"message" TEXT NOT NULL,
"level" "NoticeLevel" NOT NULL DEFAULT 'info',
"allInstalls" BOOLEAN NOT NULL DEFAULT true,
"installIds" TEXT[] DEFAULT ARRAY[]::TEXT[],
"showBanner" BOOLEAN NOT NULL DEFAULT true,
"startsAt" TIMESTAMP(3),
"endsAt" TIMESTAMP(3),
"emailedAt" TIMESTAMP(3),
"emailedTo" INTEGER NOT NULL DEFAULT 0,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Notice_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Release_version_key" ON "Release"("version");
-- CreateIndex
CREATE INDEX "Notice_endsAt_idx" ON "Notice"("endsAt");
-- The latest version set on the Settings page becomes the first release (no notes yet).
INSERT INTO "Release" ("id", "version", "notes", "urgent", "releasedAt", "createdAt", "updatedAt")
SELECT gen_random_uuid()::text, "value", '', false, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
FROM "Setting" WHERE "key" = 'latest_version' AND "value" <> '';
+43
View File
@@ -147,3 +147,46 @@ model Setting {
key String @id
value String
}
// A Cross Events version and what's new in it, shown to installs on an older version so the church
// can decide whether to ask for the update. The highest version is the latest (kept in the
// latest_version setting). Urgent releases (security or serious bug fixes) can't be put off.
model Release {
id String @id @default(uuid())
version String @unique
// Plain text; lines starting with "- " show as a list.
notes String @default("")
urgent Boolean @default(false)
releasedAt DateTime @default(now())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
enum NoticeLevel {
info
maintenance
warning
}
// A message from Joshua to churches: a banner on their site for site admins and supervisors
// (between startsAt and endsAt), an email to the customer and the install's admin contact, or both.
model Notice {
id String @id @default(uuid())
title String
message String
level NoticeLevel @default(info)
// Every install, or only the ones listed.
allInstalls Boolean @default(true)
installIds String[] @default([])
showBanner Boolean @default(true)
// Null = straight away / until ended.
startsAt DateTime?
endsAt DateTime?
// Set when the email went out (sent once, when the notice is created).
emailedAt DateTime?
emailedTo Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([endsAt])
}