Police-Data-Accessibility-Project / data-sources-app

An API and UI for using and maintaining the Data Sources database
MIT License
2 stars 5 forks source link

Reorganize and expand `data-sources` endpoints #366

Open maxachis opened 1 month ago

maxachis commented 1 month ago

To reorganize data-sources, partly in line with the requirements in #362, I propose the following:

Associate all endpoints with the data-sources namespace. In other words, all endpoints affecting the data sources begin with /data-sources/. The changes would be as follows:

The rationale for this is as follows:

  1. This helps consolidate relevant endpoints into a singular namespace, which will help with organization of the documentation and reduce redundancy.
  2. Breaking up the GET and POST methods of /data-sources enables better clarity in endpoint logic, and additionally enables performing #365 to add a GET method to /data-sources/add which retrieves all columns which can be added.
  3. This will make it easier to expand data-sources logic in the future, by associating them with a separate namespace.
  4. The data-sources/link-to-agency endpoint enables us to add management of linking logic between data sources and agencies, which previously was only done by https://github.com/Police-Data-Accessibility-Project/data-sources-mirror and by directly interfacing with the database, rather than through an endpoint.
josh-chamberlain commented 1 month ago

The namespace idea is a good one. Most of these make sense to me. My comments here apply, but what about:

GET data-sources/ gets all (I think we should prefer the search endpoint for most use cases) GET data-sources/{data_source_id} gets one GET data-sources/id/{data_source_id} could be used if needed POST data-sources/ adds one PUT data-sources/{data_source_id} changes one GET data-sources/search gets multiple too

josh-chamberlain commented 1 month ago

We might just want to talk this through, though. It's pretty foundational