How do I append a record to a listed object?

Options
I finally figured out how to edit the event_id record in the member table with the event_id found in the event_reservation table.

But, each time a user RSVPed for an event, the current event_id record in member gets replaced with the even_id of the new reservation.

Users will make multiple reservations over the time of their membership, so I need event_id in member to be a list of all reservations for that specific user.

Below are screenshots of my tables and how I designed the API.

Does anyone have an idea how I can remedy this?
[event reservation table.png][member table.png][input json.png][output.png][1 add reservation.png][2 get reservation.png][3 get member.png][4 member webflow id.png][5 get member member reservations.png][6 assign reservation.png]

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Working with arrays in the database can be tricky. One thing to keep in mind if that's how you'd like to structure it is: each time you make an update to an array you are updating the entire thing. See this post for an example video for updating a list - https://community.xano.com/c/apis/update-a-list-from-a-table-using-api

    Depending on how many reservations a user will have you may want to consider having an individual record per reservation. 
  • Christopher McNeil
    Options
    Thanks, Michael. That's a good point. I'm assuming a few hundred users may rsvp at least three times a week once launched. And I'm anticipating membership (monthly users) and reservations (daily engagement) reaching low thousands within a few months.

    I want to record users' reservations in an object to display current and previous reservations on a dedicated page.

    I currently have a table that captures an individual record per reservation.
    [event reservation table.png]
    Would it be possible to display to a user their reservations using just the table you've recommended? 
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Yes because you would just filter by something like the user id or auth user id - or in your case likely the member_webflow_id to get the records only belonging to the user. 
  • Christopher McNeil
    Options
    Awesome, that's the route I'll go then. Thanks again.