Computing for good
Atlanta Food Consortium/Feature Docs

Announcements Route

Platform-wide announcements. Any authenticated user can read; only ADMINs can create or delete.

Overview

The Announcements route (/announcements) displays a list of platform-wide announcements. Any authenticated user can read announcements. Only users with the ADMIN role can create or delete them.

A dismissible banner for the most recent unread announcement also appears on the home page (/).

Source directory: src/app/announcements/

Access control

ActionRequired role
View announcementsAny authenticated user
Create announcementADMIN
Delete announcementADMIN

Home page banner

A banner component at the top of the home page (src/app/page.tsx) shows the latest announcement if the user has not yet dismissed it. Dismissal state is stored in localStorage.

// Shown if unread announcement exists
<AnnouncementBanner announcement={latestAnnouncement} />

Creating an announcement (Admin only)

The create form on /announcements posts to /api/announcements:

await fetch('/api/announcements', {
  method: 'POST',
  body: JSON.stringify({ title, body }),
});

Fields:

FieldTypeRequired
titlestringYes
bodystringYes

API routes used

EndpointMethodPurpose
/api/announcementsGETFetch all announcements
/api/announcementsPOSTCreate a new announcement (ADMIN only)
/api/announcements/[id]DELETEDelete an announcement (ADMIN only)