Core Resources - acmucsd-projects/purple-team-backend GitHub Wiki
Table of Contents
Event
This is an object representing an event that ACM hosts. You can add, modify, delete, and retrieve event objects from the MongoDB database.
Endpoints:
GET /events/event
GET /events/event/{query}
POST /events/event
DELETE /events/event
PUT /events/event
The Event Object
Represents one specific event that ACM hosts.
Attributes
title, string
Title of the event.
location, string
The location of the event, or in other words, where the event takes place.
startTime, date
The time at which the event starts.
endTime, date
The time at which the event ends.
checkIn, string
The check in code for the event (for membership points on the ACM portal).
tags, array of strings
The list of tags that are associated with the event. Examples of tags are "Social" and "Workshop."
url, string
The URL to the splash page generated for the event.
The Event Object:
{
"title": "watch garrett chug ketchup",
"location": "Garrett's House",
"startTime": "2020-05-25T22:00:00.000Z",
"endTime": "2020-05-26T00:00:00.000Z",
"checkIn": "ketchupChug",
"url": "acmsplash1.com"
}
Retrieve Event
Retrieves a list of all events, or if provided a query, retrieves a list of all events with that query.
GET /events/event/{query}
GET /events/event
RESPONSE:
[
{
"tags": [
"Social"
],
"_id": "5ec9983f3af1c756d8c5aaf2",
"title": "Watching Tyler1 Stream",
"location": "Discord",
"startTime": "2020-04-25T16:00:00.000Z",
"endTime": "2020-04-25T18:00:00.000Z",
"checkIn": "reformed",
"url": "twitch.tv/loltyler5",
"__v": 0
},
{
"tags": [
"Workshop"
],
"_id": "5ed1d756272c5a52bca1e036",
"title": "building a cat cafe with stanley",
"location": "Qualcomm Room",
"startTime": "2020-05-15T19:00:00.000Z",
"endTime": "2020-05-15T22:00:00.000Z",
"checkIn": "snuCafe",
"url": "acmsplash2.com",
"__v": 0
}
]
Modify Event
Modifies an existing event in the database by id. Include id and modified elements in the request body. Responds with the event before modification. All fields in request body are optional, besides the ID.
PUT /events/event
PUT /events/event
REQUEST:
{
_id: String
checkIn: String
startTime: Date
endTime: Date
title: String
tags: List of String
url: String
}
RESPONSE:
{
"tags": [
"Workshop"
],
"_id": "5ec9983f3af1c756d8c5aaf2",
"title": "Watching Tyler1 Stream",
"location": "Discord",
"startTime": "2020-04-25T16:00:00.000Z",
"endTime": "2020-04-25T18:00:00.000Z",
"checkIn": "reformed",
"url": "twitch.tv/loltyler5",
"__v": 0
}
Insert Event
Insert an event into the database. Request body should be the event details. ID is auto-generated. Responds with the event just inserted into the database.
POST /events/event
POST /events/event
REQUEST:
{
title: String
location: String
startTime: Date
endTime: Date
checkIn: String
tags: List of String
url: String
}
RESPONSE:
{
"tags": [
"Workshop"
],
"_id": "5ed1d756272c5a52bca1e036",
"title": "building a cat cafe with stanley",
"location": "Qualcomm Room",
"startTime": "2020-05-15T19:00:00.000Z",
"endTime": "2020-05-15T22:00:00.000Z",
"checkIn": "snuCafe",
"url": "acmsplash2.com",
"__v": 0
}
Delete Event
Deletes an existing event in the database by id. Pass id through the request body.
DELETE /events/event
DELETE /events/event
REQUEST:
{
event: {
id: String
}
}
RESPONSE:
{
"msg": "Event deleted"
}