City-of-Helsinki/harrastuspassi-backend

Hobby filtering by HobbyEvent's attributes

Opened this issue · 3 comments

Should the retrieveHobbies query be filterable by the attributes of the HobbyEvents of the Hobby?

F. ex. Retrieving all the Hobbies with Events on Wednesday from 11am to 9pm.

If so, what would be the best way to do it?

@indigane @jussih Feel free to share opinions.

There would be an use-case for this in the frontend implementation, though the lack of the query can currently be circumvented by creating a distinct list of the hobbies based on the filtered retrieveHobbyEvents query in the frontend.

Frontend is filterable, and wants to list hobbies and the next upcoming event related to the listed hobbies.

If we want for the backend to support this, there are at least two options

  • Add a query param to event-list endpoint, that will filter the results to only show the next upcoming event per hobby. In other words distinct by hobby, and show only the next upcoming, or none if no upcoming.

  • Add all the filtering options from event-list endpoint to hobby-list endpoint such that when filtering, the hobbies will be filtered by the events related to them (via JOIN).

Thoughts?