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

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

Correct bug in `/data-requests` endpoint schema #489

Closed maxachis closed 2 weeks ago

maxachis commented 1 month ago

Context

Brief description. Is this part of a parent issue?

@joshuagraber Reported attempting to make a request to /data-requests POST with an empty location_infos key, and got the following error:

DETAIL:  Missing left parenthesis or bracket.
CONTEXT:  unnamed portal parameter $3 = '...'
[SQL: INSERT INTO public.data_requests (submission_notes, creator_user_id, coverage_range, data_requirements, request_urgency, title) VALUES (%(submission_notes)s::VARCHAR, %(creator_user_id)s::INTEGER, %(coverage_range)s::DATERANGE, %(data_requirements)s::VARCHAR, %(request_urgency)s, %(title)s::VARCHAR) RETURNING public.data_requests.id]
[parameters: {'submission_notes': 'asdf', 'creator_user_id': 97, 'coverage_range': '2000-2005', 'data_requirements': 'asdf', 'request_urgency': 'Somewhat urgent (Less than a month)', 'title': 'asd'}]
(Background on this error at: https://sqlalche.me/e/20/9h9h)

He also mentioned passing an empty array and also getting an issue.

Requirements

Tests

Docs

Open questions