ShelterTechSF / sheltertech-go

GNU General Public License v3.0
1 stars 0 forks source link

Add saved searches APIs. #121

Closed richardxia closed 4 months ago

richardxia commented 4 months ago

This implements the list, get, post, and delete routes. It omits the put route for now, since we might not actually need it yet, and it will probably require some significant refactoring.

This one's a bit more complicated than the others, since we have a JSONB column for the search query information. On the API side, we want the frontend to be able to send eligibilities and categories by their names, but on the DB side, we want to save them as their integers IDs. In hindsight, maybe we should've just modeled the stuff in JSONB column in a normal, relational way, where the saved search API could return the entire eligibility object instead of its name.

We don't have time to change this before launch, but it might be a good post-launch tech debt payoff project.

lgarofalo commented 4 months ago

For correctness of code, I'd suggesting adding to the integration tests but otherwise seems ok

richardxia commented 4 months ago

Improved some minor error handling in https://github.com/ShelterTechSF/sheltertech-go/pull/121/commits/04d080f91d906da05f96a229d7cca77781eadf07, since it was helpful as I was debugging the integration with the frontend in https://github.com/ShelterTechSF/askdarcel-web/pull/1368.

I think I'm going to merge both of these PRs as soon as they pass CI. Thanks for the review, and sorry to not add the integration tests, but it's something I can do after the initial launch!