One form at /request for blog posts, events, and new or updated chapters, regions (updates only), partners, teams, awards and people. ?type= opens it on one; buttons on the Community sections, blog posts, Retreats and the front page calendar do. Files (.docx, PDF, JPEG, PNG) go to a Google Drive folder through a service account. Requests are feedback rows of type 'content' (migration 046), in a third Forms queue: files download from Drive, a .docx can become a draft blog post, and deleting a request deletes its files. New content and data requests email the addresses in Site settings through Gmail. Setup: docs/google-drive-and-mail.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
2.2 KiB
TypeScript
37 lines
2.2 KiB
TypeScript
/* ═══════════════════════════════════════════════════════════════
|
|
REQUEST TYPES
|
|
|
|
What the Request form (/request) can ask for, and whether each can
|
|
be new, an update, or both. The ids and actions must match
|
|
CATEGORIES in server/src/routes/requests.js (and the CHECK in
|
|
046_content_requests.sql); keep them in step.
|
|
|
|
A link can open the form on one: requestLink("chapter") is
|
|
/request?type=chapter. People, teams and awards have no buttons on
|
|
the site, but are here to pick.
|
|
═══════════════════════════════════════════════════════════════ */
|
|
|
|
export type RequestAction = "new" | "update";
|
|
|
|
export const REQUEST_TYPES: {
|
|
id: string;
|
|
label: string;
|
|
hint: string;
|
|
actions: RequestAction[];
|
|
// What the name field asks, for a new one and for an update.
|
|
subject: string;
|
|
}[] = [
|
|
{ id: "blog", label: "Blog post", hint: "A story or article for the community blog", actions: ["new"], subject: "Its title" },
|
|
{ id: "event", label: "Event", hint: "A retreat, gathering or calendar event", actions: ["new", "update"], subject: "The event's name" },
|
|
{ id: "chapter", label: "Chapter", hint: "A local NGU chapter", actions: ["new", "update"], subject: "The chapter's name" },
|
|
{ id: "region", label: "Region", hint: "Details for a Unity region", actions: ["update"], subject: "Which region" },
|
|
{ id: "partner", label: "Partner", hint: "A partner organization", actions: ["new", "update"], subject: "The organization's name" },
|
|
{ id: "team", label: "Team", hint: "A team or committee", actions: ["new", "update"], subject: "The team's name" },
|
|
{ id: "award", label: "Award", hint: "An award and who received it", actions: ["new", "update"], subject: "The award's name" },
|
|
{ id: "person", label: "Person", hint: "Someone's profile", actions: ["new", "update"], subject: "Their name" },
|
|
];
|
|
|
|
export const requestLink = (type: string) => `/request?type=${type}`;
|
|
|
|
const BY_ID = new Map(REQUEST_TYPES.map((t) => [t.id, t.label]));
|
|
export const requestTypeLabel = (id: string) => BY_ID.get(id) ?? id;
|