-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
exec-onlyonly csss executives have the permission to do this, likely due to personal informationonly csss executives have the permission to do this, likely due to personal informationgood first issueGood for newcomersGood for newcomersnew featurean enhancementan enhancement
Description
Description
I'd like to store Announcement information somewhere and have our frontend be able to fetch it. I think there would need to be a new table created, as well as a new API endpoint. An announcement will look something like this:

The use-case for this is the frontend using it to make an annnouncements page. The only thing the frontend needs for this are GET requests, but I may want to make something to make it easier to add announcements later on. This will only be accessible by Execs and the W3 chairs.
Requirements
DB Table: Announcement
aid
(INTEGER): Announcement ID (primary key)title
(VARCHAR): TitletimePosted
(DATETIME): Time it was posted- Note: we could do something where posts can be scheduled in the future and fetch only posts that are below a timestamp
content
(VARCHAR): Content of the announcement. For now, we can make it only text, and then add other media later. Links could also be stored and parsed hereposter
(INTEGER) : Officer ID of the person who wrote the announcement (foreign key, referencing the officers table)
Maybes
signature?
(VARCHAR): The signature of the person who posted
REST API Endpoints
- All requests should return
200
or404
unless stated otherwise. - Frontend will send data as
application/x-www-form-urlencoded
- You will most likely need to some way to li
Note: Question marks indicate something that may not need to be added - GET
/announcement
: Get all announcements (might not be needed, but I'll put it here for completeness) - GET
/announcement/<timestamp>
: Get all announcements at or below this timestamp - GET
/announcement/<timestamp>?end=<number>
: Get all announcements at or below this timestamp, limited to the most recent posts. - GET
/announcement/<timestamp>?start=<number1>&end=<number2>
: Get all announcements at or below this timestamp, from start to end. This will be used to split posts in pages, so we can lazy load based on pages.
- POST
/announcement
201
: successful creation
// POST body
{
"title": "string",
"timePosted": "string/date",
"content": "string/date",
"poster": "number" // officer ID
}
// POST response
{
"aid": "number",
"title": "string",
"timePosted": "string/date",
"content": "string/date",
"poster": "number" // officer ID
}
- PATCH
/announcement/<aid>
// PATCH body
{
"title": "string",
"timePosted": "string/date",
"content": "string/date",
"poster": "number" // officer ID
}
// PATCH response
{
"aid": "number",
"title": "string",
"timePosted": "string/date",
"content": "string/date",
"poster": "number" // officer ID
}
- DELETE
/announcement/<aid>
404
: If nothing was deleted
// DELETE body
number
// DELETE response
{
"failureReason?": "doesn't exist | <some other reason>" // only if it fails
"aid?": "number" // only if it succeeds
}
Metadata
Metadata
Assignees
Labels
exec-onlyonly csss executives have the permission to do this, likely due to personal informationonly csss executives have the permission to do this, likely due to personal informationgood first issueGood for newcomersGood for newcomersnew featurean enhancementan enhancement