Skip to content

Commit d277bf6

Browse files
committed
Minor bug fixes, minor updates to swagger
1 parent 3424014 commit d277bf6

File tree

3 files changed

+85
-6
lines changed

3 files changed

+85
-6
lines changed

src/controllers/EventFormsController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ router.get("/events/", async (req, res) => {
3737
// NOTE: id is the event form's id, stored as the primary key in the database
3838
router.put("/events/:id", async (req, res) => {
3939
try {
40-
const { id } = req.params;
40+
const { id } = req.params; // id is found in the url path
4141
const { approvalStatus } = req.body;
4242

4343
// Initalize the io instance

src/swagger.json

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,21 @@
219219
"schema": {
220220
"type": "string"
221221
}
222+
},
223+
{
224+
"in": "body",
225+
"name": "approvalStatus",
226+
"description": "The approval status to update the event request to. Allowed approval statuses are: 'pending', 'approved', 'rejected'.",
227+
"required": true,
228+
"schema": {
229+
"type": "string",
230+
"enum": [
231+
"pending",
232+
"approved",
233+
"rejected"
234+
],
235+
"example": "approved"
236+
}
222237
}
223238
],
224239
"responses": {
@@ -238,7 +253,7 @@
238253
"example": "Event request updated successfully"
239254
},
240255
"data": {
241-
"$ref": "#/components/schemas/EventRequest"
256+
"$ref": "#/components/schemas/PrivateEventRequest"
242257
}
243258
}
244259
}
@@ -297,7 +312,7 @@
297312
"data": {
298313
"type": "array",
299314
"items": {
300-
"$ref": "#/components/schemas/EventRequest"
315+
"$ref": "#/components/schemas/PublicEventRequest"
301316
}
302317
}
303318
}
@@ -1590,9 +1605,59 @@
15901605
}
15911606
}
15921607
},
1593-
"EventRequest": {
1608+
"PublicEventRequest": {
1609+
"type": "object",
1610+
"properties": {
1611+
"netid": {
1612+
"type": "string",
1613+
"description": "The netid of the user submitting the event request.",
1614+
"example": "jdoe123"
1615+
},
1616+
"name": {
1617+
"type": "string",
1618+
"description": "The name of the event.",
1619+
"example": "Event Name"
1620+
},
1621+
"eventType": {
1622+
"type": "string",
1623+
"description": "The type of event.",
1624+
"example": "temporary"
1625+
},
1626+
"startDate": {
1627+
"type": "string",
1628+
"description": "The start date of the event.",
1629+
"example": "2025-01-01 12:00:00"
1630+
},
1631+
"endDate": {
1632+
"type": "string",
1633+
"description": "The end date of the event.",
1634+
"example": "2025-01-02 12:00:00"
1635+
},
1636+
"organizationName": {
1637+
"type": "string",
1638+
"description": "The name of the organization hosting the event.",
1639+
"example": "Organization Name"
1640+
},
1641+
"location": {
1642+
"type": "string",
1643+
"description": "The location of the event.",
1644+
"example": "Location Name"
1645+
},
1646+
"about": {
1647+
"type": "string",
1648+
"description": "The about section of the event.",
1649+
"example": "About the event."
1650+
}
1651+
}
1652+
},
1653+
"PrivateEventRequest": {
15941654
"type": "object",
15951655
"properties": {
1656+
"id": {
1657+
"type": "integer",
1658+
"description": "The id of the event request.",
1659+
"example": 1
1660+
},
15961661
"netid": {
15971662
"type": "string",
15981663
"description": "The netid of the user submitting the event request.",
@@ -1632,6 +1697,21 @@
16321697
"type": "string",
16331698
"description": "The about section of the event.",
16341699
"example": "About the event."
1700+
},
1701+
"approvalStatus": {
1702+
"type": "string",
1703+
"description": "The approval status of the event request.",
1704+
"example": "pending"
1705+
},
1706+
"createdAt": {
1707+
"type": "string",
1708+
"description": "The date and time the event request was created.",
1709+
"example": "2025-01-01 12:00:00"
1710+
},
1711+
"updatedAt": {
1712+
"type": "string",
1713+
"description": "The date and time the event request was last updated.",
1714+
"example": "2025-01-01 12:00:00"
16351715
}
16361716
}
16371717
}

src/utils/EventFormsUtils.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ function getApprovedEventForms() {
213213
* @param {Object} eventForm - The event form to convert.
214214
* @returns {Object} - The public event.
215215
*/
216-
function toPublicEvent({ name, netid, eventType, startDate, endDate, organizationName, about, location, approvalStatus }) {
216+
function toPublicEvent({ name, netid, eventType, startDate, endDate, organizationName, about, location }) {
217217
return {
218218
name,
219219
netid,
@@ -223,7 +223,6 @@ function toPublicEvent({ name, netid, eventType, startDate, endDate, organizatio
223223
organizationName,
224224
about,
225225
location,
226-
approvalStatus,
227226
}
228227
}
229228

0 commit comments

Comments
 (0)