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): Title
timePosted (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 here
poster (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 or 404 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.
- PATCH
/announcement/<aid>
- DELETE
/announcement/<aid>
404: If nothing was deleted
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:
Announcementaid(INTEGER): Announcement ID (primary key)title(VARCHAR): TitletimePosted(DATETIME): Time it was postedcontent(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 postedREST API Endpoints
200or404unless stated otherwise.application/x-www-form-urlencodedNote: Question marks indicate something that may not need to be added
/announcement: Get all announcements (might not be needed, but I'll put it here for completeness)/announcement/<timestamp>: Get all announcements at or below this timestamp/announcement/<timestamp>?end=<number>: Get all announcements at or below this timestamp, limited to the most recent posts./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./announcement201: successful creation/announcement/<aid>/announcement/<aid>404: If nothing was deleted