UoaWDCC / uasc-web

Project with the University of Auckland Snowsports Club Website & Booking System. Established in 2023.
https://uasc.co.nz
6 stars 2 forks source link

Rewrite SSE endpoint to return map of reservations per event ID #787

Closed jeffplays2005 closed 1 month ago

jeffplays2005 commented 1 month ago

I've changed the method in the controller to use the modified method.

Also changed EventService to return a Record instead of just a number.

Updated tests

github-actions[bot] commented 1 month ago

Visit the preview URL for this PR (updated for commit 85beba4):

https://uasc-ceebc--pr787-786-backend-rewrite-1yks42u1.web.app

(expires Tue, 08 Oct 2024 10:38:01 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 36296ceaed1d43e92e7d5e81a72a7bd987560bfa

jeffplays2005 commented 1 month ago

Note that this endpoint still doesn't have tests due to the nature of it having an open socket.

I've conducted some manual tests but had an inability to add an event of the correct data structure which results in problems with fetching all the events with a later date.

See the images attached below: The following image depicts that the endpoint returns an object instead of a number now:

Screenshot 2024-10-01 at 12 22 53 PM

Upon adding an event with the admin endpoint, the event doesn't seem to be fetched (this is perhaps due to some firestore timestamp issue again)

Note that the first dump was of just fetching regular events(this included the new event I created) but upon filtering with dates in Firestone, it only returns the empty lists after.

Screenshot 2024-10-01 at 12 24 32 PM

Despite the errors with running the manual requests on Swagger, the service methods still pass the expected tests.

JSON event that was tested ```json { "data": { "title": "string", "description": "string", "image_url": "string", "location": "string", "physical_start_date": { "seconds": 1738321200, "nanoseconds": 0 }, "start_date": { "seconds": 1738321200, "nanoseconds": 0 }, "end_date": { "seconds": 1738321200, "nanoseconds": 0 }, "physical_end_date": { "seconds": 1738321200, "nanoseconds": 0 }, "max_occupancy": 30 } } ```
bcho892 commented 1 month ago

do we not have confirmation that the endpoint can provide signups for each event id?

jeffplays2005 commented 1 month ago

do we not have confirmation that the endpoint can provide signups for each event id?

I've tested the function in the service tests and this endpoint essentially just returns that. I'll try and get some jest tests set up if it's doable.

It isn't working when I manually add a payload to the admin/events POST method

jeffplays2005 commented 1 month ago
Screenshot 2024-10-01 at 11 33 43 PM

Works properly now, can assume that the counts will be accurate as the service methods have been tested and the SSE just returns the tested service methods.

The changes on the admin endpoint should convert the raw timestamps to firestore timestamps

JSON event tested with ```json { "data": { "title": "string", "description": "string", "image_url": "string", "location": "string", "start_date": { "seconds": 1738321200, "nanoseconds": 0 }, "end_date": { "seconds": 1738321200, "nanoseconds": 0 }, "physical_start_date": { "seconds": 0, "nanoseconds": 0 }, "physical_end_date": { "seconds": 0, "nanoseconds": 0 }, "max_occupancy": 30 } } ```