nhsx / antibody-web

Web application for finger prick covid19 antibody Lateral Flow Tests (LFT) and interpreting results
MIT License
28 stars 10 forks source link

Ldat 251 retrieve image endpoint #92

Closed barnc closed 4 years ago

barnc commented 4 years ago

Context

We need an endpoint for fetching results messages off the queue, which will live alongside our existing serverless api. This needs to be clearly segregated from our take test endpoints.

Changes proposed in this pull request

We add an endpoint /results/next that hits the SQS queue, retrieves the guid of the test record, then generates a signed download URL for that image. This is then returned to the user. Tests are also included for this endpoint.

Guidance to review

Fire up the app and then hit http://localhost:4000/dev/results/next with a GET request, check you get a url back, and check if you open that url you can see an image. Make sure there are images in the queue (run through the regular upload process).

Link to Jira task

https://bluesquirrel.atlassian.net/browse/LDAT-251

barnc commented 4 years ago

Some thoughts:

Currently return a 204 when the queue is empty - does this feel appropriate?

Currently unauthenticated - we'll need to hook up a second authoriser function at some point to interface with cognito.

I've realised our existing file uploads weren't working as the data uri -> file code had been removed (i believe by myself accidentally), so there's some minor changes in there to get that up and working again (There might be some dodgy messages in the queue as a result of that).