Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

jeffplays2005
Copy link
Contributor

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

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
@jeffplays2005 jeffplays2005 linked an issue Sep 30, 2024 that may be closed by this pull request
7 tasks
Copy link

github-actions bot commented Sep 30, 2024

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
Copy link
Contributor Author

jeffplays2005 commented Sep 30, 2024

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
{
    "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
    }
}

@choden-dev
Copy link
Member

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

@jeffplays2005
Copy link
Contributor Author

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
Copy link
Contributor Author

jeffplays2005 commented Oct 1, 2024

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
{
  "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
  }
}

@jeffplays2005 jeffplays2005 merged commit f6a3545 into master Oct 2, 2024
8 checks passed
@jeffplays2005 jeffplays2005 deleted the 786-backend-rewrite-sse-endpoint-to-return-a-map-of-reservations-per-event-id branch October 2, 2024 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BACKEND] Rewrite SSE endpoint to return a map of reservations per event id
2 participants