Skip to content

Add location list endpoints#62

Merged
ezwelty merged 1 commit intomainfrom
location-lists
Apr 18, 2026
Merged

Add location list endpoints#62
ezwelty merged 1 commit intomainfrom
location-lists

Conversation

@ezwelty
Copy link
Copy Markdown
Contributor

@ezwelty ezwelty commented Apr 14, 2026

Preview docs: https://petstore.swagger.io/?url=https://raw.githubusercontent.com/falling-fruit/api/location-lists/docs/openapi.yml

  • Add, edit, delete, get (by list id, user id) location lists
  • Locations are added to the end of the list. The legacy custom ordering of existing lists in locations_routes.position is maintained, but no endpoint is (yet?) provided to reorder locations.
  • No endpoint is (yet?) provided to access location lists publicly. The legacy routes.is_public is ignored.
  • GET /locations and GET /locations/:id now support authentication, in which case the former returns in_list: boolean for each location and the latter returns lists (array of Location Lists). I was worried the former would add a high overhead but I didn't notice any significant performance hit in my scant testing. But I have to wonder – does it make sense to return thousands of booleans when we could just have a small array of location ids?

Closes #8

* Add, edit, delete, get (by list id, user id) location lists
* Reordering locations is not currently supported (maintains locations_routes.position but no endpoint to change it)
* Only private lists are currently supported (ignores routes.is_public)

Closes #8
@wbazant
Copy link
Copy Markdown

wbazant commented Apr 15, 2026

Thanks, I think that will work for the UI!

It didn't seem useful to let users customise ordering of locations or lists, the public routes are interesting for one day if we see people invested in their Falling Fruit profiles or if they want to share lists?

For GET /locations including in_list, you're right that it is a lot of in_list: false being returned, it's also the heaviest table, could even one day be moved out into indexed search for extra good searching. I can also be querying for the lists on start-up, or we could add a list of saved location ids to the user payload for one less API call.

Having in_list on GET /locations payload has a benefit of the data being fresh - if the user opens their app, and then saves a location on their desktop, the app will still show the location as saved after moving the map. Not sure how much it matters, I thought of it because we also have the 'recent activity' data not updating on the app - falling-fruit/falling-fruit-web#1007 .

@ezwelty
Copy link
Copy Markdown
Contributor Author

ezwelty commented Apr 16, 2026

@wbazant The in_list attribute is not stored in the locations table, but rather generated dynamically in SQL, but seems too have very little overhead. As for bandwidth, I realize that the repeated in_list: false in the JSON payload is highly compressible by GZIP and has basically zero impact. There is a small storage overhead once uncompressed, but that's of secondary concern.

So if you think the current implementation is the best/easiest way to keep the map up to date with location lists, then we can go with what I already have? (and iterate later if needed) Otherwise, good alternatives would be to query GET /locations/lists or I could add the option to embed all user location lists in the GET /users payload.

@wbazant
Copy link
Copy Markdown

wbazant commented Apr 16, 2026

Happy to go with the current version, that would be easiest for the ui too, and we can change it if needed one day.

@ezwelty ezwelty merged commit b0a2157 into main Apr 18, 2026
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.

Add endpoints to routes table (location lists)

2 participants