Skip to content

Commit

Permalink
Regenerate schema and update endpoint in controller and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffplays2005 committed Nov 2, 2024
1 parent 0512b2a commit 48c3a2c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 31 deletions.
44 changes: 21 additions & 23 deletions client/src/models/__generated__/schema.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/src/middleware/__generated__/routes.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions server/src/middleware/__generated__/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions server/src/middleware/tests/AdminController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ describe("AdminController endpoint tests", () => {
).toEqual(newDate)
})
})
describe("GET /events/:id", () => {
describe("GET /admin/events/:id", () => {
const event1: Event = {
title: "UASC New event",
physical_start_date: dateToFirestoreTimeStamp(new Date()),
Expand All @@ -862,15 +862,15 @@ describe("AdminController endpoint tests", () => {

it("should return the event details for a valid event ID", async () => {
const { id: id1 } = await eventService.createEvent(event1)
const res = await request.get(`/events/${id1}`).send()
const res = await request.get(`/admin/events/${id1}`).send()
expect(res.status).toEqual(200)
expect(res.body.data).toBeDefined()
expect(res.body.data.title).toEqual("UASC New event")
expect(res.body.data.location).toEqual("UASC")
})

it("should return 404 if the event does not exist", async () => {
const res = await request.get("/events/random-event").send()
const res = await request.get("/admin/events/random-event").send()
expect(res.status).toEqual(404)
expect(res.body.error).toEqual("Event not found.")
})
Expand Down
2 changes: 1 addition & 1 deletion server/src/service-layer/controllers/AdminController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,8 @@ export class AdminController extends Controller {
this.setStatus(200)
}

@Get("{id}")
@SuccessResponse("200", "Successfully fetched the event")
@Get("events/{id}")
public async getEventById(@Path() id: string): Promise<GetEventResponse> {
try {
const eventService = new EventService()
Expand Down

0 comments on commit 48c3a2c

Please sign in to comment.