AashnaNarang / SurveyLab

0 stars 0 forks source link

questions included with survey response ordered #50

Closed AndrewHall797 closed 2 years ago

AndrewHall797 commented 2 years ago

Updated the show survey route to include the ordered questions.

Upon running the show survey route the following response is generated.

{
    "survey": {
        "id": 1,
        "title": "test1",
        "isLive": false,
        "wentLiveAt": null,
        "created_at": "2022-03-22T00:57:19.819Z",
        "updated_at": "2022-03-22T00:57:19.819Z"
    },
    "questions": [
        {
            "id": 1,
            "question": "test questions",
            "created_at": "2022-03-22T00:58:39.494Z",
            "updated_at": "2022-03-22T00:58:39.494Z",
            "survey_id": 1,
            "order": 1,
            "question_type": "text"
        },
        {
            "id": 2,
            "question": "test question 2",
            "created_at": "2022-03-22T00:58:52.698Z",
            "updated_at": "2022-03-22T00:58:52.698Z",
            "survey_id": 1,
            "order": 2,
            "question_type": "text"
        },
        {
            "id": 1,
            "question": "test1",
            "created_at": "2022-03-22T01:02:02.272Z",
            "updated_at": "2022-03-22T01:02:02.272Z",
            "survey_id": 1,
            "order": 3,
            "mc_options": [
                {
                    "id": 1,
                    "option": "option",
                    "created_at": "2022-03-22T01:02:59.119Z",
                    "updated_at": "2022-03-22T01:02:59.119Z",
                    "mc_question_id": 1
                },
                {
                    "id": 2,
                    "option": "option2",
                    "created_at": "2022-03-22T01:03:04.438Z",
                    "updated_at": "2022-03-22T01:03:04.438Z",
                    "mc_question_id": 1
                },
                {
                    "id": 3,
                    "option": "option3",
                    "created_at": "2022-03-22T01:03:10.855Z",
                    "updated_at": "2022-03-22T01:03:10.855Z",
                    "mc_question_id": 1
                },
                {
                    "id": 4,
                    "option": "option4",
                    "created_at": "2022-03-22T01:03:19.922Z",
                    "updated_at": "2022-03-22T01:03:19.922Z",
                    "mc_question_id": 1
                }
            ],
            "question_type": "mc"
        },
        {
            "id": 3,
            "question": "test question 3",
            "created_at": "2022-03-22T01:03:39.201Z",
            "updated_at": "2022-03-22T01:03:39.201Z",
            "survey_id": 1,
            "order": 4,
            "question_type": "text"
        }
    ]
}