AashnaNarang / SurveyLab

0 stars 0 forks source link

Survey question with responses #76

Closed AndrewHall797 closed 2 years ago

AndrewHall797 commented 2 years ago

Users the already existing survey show route.

If there are responses they are included under the returned json.

image

{
    "survey": {
        "id": 10,
        "title": "sdad",
        "isLive": true,
        "wentLiveAt": "2022-04-01T19:45:02.425Z",
        "created_at": "2022-04-01T19:44:42.639Z",
        "updated_at": "2022-04-01T19:45:02.425Z"
    },
    "questions": [
        {
            "id": 4,
            "question": "dsad",
            "created_at": "2022-04-01T19:45:02.130Z",
            "updated_at": "2022-04-01T19:45:02.130Z",
            "survey_id": 10,
            "order": 0,
            "question_type": "text",
            "text_responses": [
                "dasd"
            ]
        },
        {
            "id": 5,
            "question": "dsa",
            "created_at": "2022-04-01T19:45:02.298Z",
            "updated_at": "2022-04-01T19:45:02.298Z",
            "survey_id": 10,
            "order": 1,
            "mc_options": [
                {
                    "id": 15,
                    "option": "sda",
                    "created_at": "2022-04-01T19:45:02.302Z",
                    "updated_at": "2022-04-01T19:45:02.302Z",
                    "mc_question_id": 5
                },
                {
                    "id": 16,
                    "option": "da",
                    "created_at": "2022-04-01T19:45:02.304Z",
                    "updated_at": "2022-04-01T19:45:02.304Z",
                    "mc_question_id": 5
                },
                {
                    "id": 17,
                    "option": "ad",
                    "created_at": "2022-04-01T19:45:02.305Z",
                    "updated_at": "2022-04-01T19:45:02.305Z",
                    "mc_question_id": 5
                }
            ],
            "question_type": "mc",
            "mc_responses": {
                "sda": 1
            }
        }
    ]
}

closes https://github.com/AashnaNarang/SYSC4806/issues/71

AndrewHall797 commented 2 years ago

One sec forgot specs!