Ask for prayer (who will see it said plainly, the prayer team by default; for members the first name or Anonymous, approved first; fully anonymous when the church allows it; the emergency numbers, signed out too), Pray for others (the shared list with "I prayed"), My prayer requests (state, what the team changed or why it wasn't shared, the team's private replies, "Answered!", close, delete). The admin's Prayer requests: waiting, open, escalated and closed; approve, edit out details, don't share, reply, escalate; the settings. Pastoral care sees open and escalated requests. The Prayer tab shows with either prayer module and opens requests when the House of Prayer is off. Checked in a browser on a throwaway PostgreSQL: a member asks, a coordinator edits out a name and approves, another member sees the edited text and prays, the sender sees the note and the count but not who; no page errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
/** Prayer requests' shapes (backend/src/requests/*), for server and client components. */
|
|
|
|
export type RequestForm = { anonymousAllowed: boolean; emergencyNumbers: { label: string; number: string }[]; closeAfterDays: number };
|
|
|
|
export type Update = { id: string; author: "submitter" | "team"; text: string; createdAt: string };
|
|
|
|
/** GET /api/v1/requests: what members see. */
|
|
export type SharedRequest = { id: string; text: string; by: string; prayedCount: number; iPrayed: boolean; updates: Update[]; createdAt: string; mine: boolean };
|
|
|
|
export type RequestStatus = "closed" | "with_team" | "waiting" | "shared" | "not_shared";
|
|
|
|
/** GET /api/v1/me/requests: the sender's own. */
|
|
export type MyRequest = {
|
|
id: string;
|
|
text: string;
|
|
visibility: "team" | "members";
|
|
showName: boolean;
|
|
anonymous: boolean;
|
|
status: RequestStatus;
|
|
redactionNote: string | null;
|
|
removedReason: string | null;
|
|
prayedCount: number;
|
|
updates: Update[];
|
|
closesAt: string;
|
|
closedAt: string | null;
|
|
createdAt: string;
|
|
};
|
|
|
|
/** The prayer team's view. */
|
|
export type TeamRequest = MyRequest & {
|
|
moderation: "none" | "pending" | "approved" | "removed";
|
|
submitter: { name: string; email: string; phone: string | null } | null;
|
|
escalated: { at: string; note: string | null } | null;
|
|
redacted: boolean;
|
|
};
|
|
|
|
export const STATUS_NAMES: Record<RequestStatus, string> = {
|
|
with_team: "With the prayer team",
|
|
waiting: "Waiting for approval",
|
|
shared: "Shared with members",
|
|
not_shared: "Not shared",
|
|
closed: "Closed",
|
|
};
|
|
|
|
/** "3 December" from an ISO instant. */
|
|
export const shortDate = (iso: string) => new Intl.DateTimeFormat("en-ZA", { day: "numeric", month: "long" }).format(new Date(iso));
|