You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a controller to handle saving and submitting of Responses as documented in the application process spec.
The controller should contain
A GET method that retrieves a response for a given event_id for the logged-in user. A serialized JSON response is returned of the form illustrated below.
A POST method that accepts a JSON serialized response and saves the response to the database. This will make use of the data model created in Create data model for Response and Answer #21. If a response already exists (the response_id is populated in the JSON received), it should be updated, else a new response should be inserted and the new ID returned.
A DELETE method that accepts a response_id and sets the is_withdrawn flag and the withdrawn_timestamp on the Response object
Definition of Done
This task is done when
A new controller exists in api/app/response/api.py implementing methods described above which communicate using JSON of the form illustrated below
Unit tests exist for the response api
Checks exist in the API to ensure that a user can only retrieve/update/delete their own responses
An example of the JSON serialization of the Response/Answer model (NOTE: The response_id field should only be populated if the user is updating their response)
{
"response_id": 1,
"answers": [
{"question_id": 1, "value": "answer 1"},
{"question_id": 2, "value": "stuff"),
{"question_id": 3, "value": "hello world")
],
"is_submitted": false
}
The text was updated successfully, but these errors were encountered:
Create a controller to handle saving and submitting of Responses as documented in the application process spec.
The controller should contain
Definition of Done
This task is done when
An example of the JSON serialization of the Response/Answer model (NOTE: The response_id field should only be populated if the user is updating their response)
{
"response_id": 1,
"answers": [
{"question_id": 1, "value": "answer 1"},
{"question_id": 2, "value": "stuff"),
{"question_id": 3, "value": "hello world")
],
"is_submitted": false
}
The text was updated successfully, but these errors were encountered: