Closed fec-jli closed 1 week ago
This PR will fix sql error in slack #bots-db-alerts-aurora
sql query: https://fecgov.slack.com/archives/C3W9XBBJL/p1730837872044529
1-2 developer
/candidates/ and candidate/search /committees/ and committee/search
/candidates/
candidate/search
/committees/
committee/search
1) checkout branch, run 'pytest' 2) test urls test CandidateList urls: without 'q' should get 422 http://127.0.0.1:5000/v1/candidates/?sort=receipts http://127.0.0.1:5000/v1/candidates/?&sort=-receipts
tet CandidateList urls: should return some results http://127.0.0.1:5000/v1/candidates/?q=joh&sort=receipts http://127.0.0.1:5000/v1/candidates/?q=joh&sort=-receipts http://127.0.0.1:5000/v1/candidates/?q=joh&sort=name
test CommitteeList urls: without 'q' should get 422 http://127.0.0.1:5000/v1/committees/?sort=receipts http://127.0.0.1:5000/v1/committees/?sort=-receipts
tet CommitteeList urls: should return some results http://127.0.0.1:5000/v1/committees/?sort=receipts&q=joh http://127.0.0.1:5000/v1/committees/?sort=-receipts&q=joh http://127.0.0.1:5000/v1/committees/?sort=name
After release to Prod: 1)Error urls (without passing q): https://api.open.fec.gov/v1/candidates/?sort=receipts&api_key=DEMO_KEY "message": "Cannot sort on receipts when parameter 'q' is not set”,
q
https://api.open.fec.gov/v1/committees/?sort=receipts&api_key=DEMO_KEY
2)Correct urls (pass q and sort): https://api.open.fec.gov/v1/candidates/?q=joh&sort=receipts&api_key=DEMO_KEY
https://api.open.fec.gov/v1/committees/?sort=receipts&q=joh&api_key=DEMO_KEY
Summary (required)
This PR will fix sql error in slack #bots-db-alerts-aurora
sql query: https://fecgov.slack.com/archives/C3W9XBBJL/p1730837872044529
Required reviewers
1-2 developer
Impacted areas of the application
/candidates/
andcandidate/search
/committees/
andcommittee/search
How to test
1) checkout branch, run 'pytest' 2) test urls test CandidateList urls: without 'q' should get 422 http://127.0.0.1:5000/v1/candidates/?sort=receipts http://127.0.0.1:5000/v1/candidates/?&sort=-receipts
tet CandidateList urls: should return some results http://127.0.0.1:5000/v1/candidates/?q=joh&sort=receipts http://127.0.0.1:5000/v1/candidates/?q=joh&sort=-receipts http://127.0.0.1:5000/v1/candidates/?q=joh&sort=name
test CommitteeList urls: without 'q' should get 422 http://127.0.0.1:5000/v1/committees/?sort=receipts http://127.0.0.1:5000/v1/committees/?sort=-receipts
tet CommitteeList urls: should return some results http://127.0.0.1:5000/v1/committees/?sort=receipts&q=joh http://127.0.0.1:5000/v1/committees/?sort=-receipts&q=joh http://127.0.0.1:5000/v1/committees/?sort=name
After release to Prod: 1)Error urls (without passing
q
): https://api.open.fec.gov/v1/candidates/?sort=receipts&api_key=DEMO_KEY "message": "Cannot sort on receipts when parameter 'q' is not set”,https://api.open.fec.gov/v1/committees/?sort=receipts&api_key=DEMO_KEY
2)Correct urls (pass
q
and sort): https://api.open.fec.gov/v1/candidates/?q=joh&sort=receipts&api_key=DEMO_KEYhttps://api.open.fec.gov/v1/committees/?sort=receipts&q=joh&api_key=DEMO_KEY