vantoan19 / CodeToGive2022_Backend

0 stars 0 forks source link

GET Work Motivations Questions/Assessment API #1

Closed nhtoby311 closed 2 years ago

nhtoby311 commented 2 years ago

export type Question = { type: string question_id: number description: string answered_value?: number answers: Answer[] image?: { src: string alt: string } }

export type Answer = { answer_id: number description: string question_id: number test_id: number }

- Desired object: 

```yaml
{
  test_id: 1,
  title: "Work motivation test",
  questions: [
    {
      type: "MOTIVATION_QUESTION",
      description: "Question1",
      question_id: 12,
      answered_value: 125,
      answers: [
        {
          description: "1",
          answer_id: 123,
          question_id: 12,
          test_id: 1,
        },
        {
          description: "2",
          answer_id: 124,
          question_id: 12,
          test_id: 1,
        },
        {
          description: "3",
          answer_id: 125,
          question_id: 12,
          test_id: 1,
        },
        {
          description: "4",
          answer_id: 126,
          question_id: 12,
          test_id: 1,
        },
        {
          description: "5",
          answer_id: 127,
          question_id: 12,
          test_id: 1,
        },
      ],
      image: {
        src: "https://images.unsplash.com/photo-1556741533-6e6a62bd8b49?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8cmVjZXB0aW9uaXN0fGVufDB8fDB8fA%3D%3D&auto=format&fit=crop&w=500&q=60",
        alt: "Alt text",
      },
    },
    {
      type: "MOTIVATION_QUESTION",
      description: "Question2",
      question_id: 13,

      answers: [
        {
          description: "1",
          answer_id: 128,
          question_id: 13,
          test_id: 1,
        },
        {
          description: "2",
          answer_id: 129,
          question_id: 13,
          test_id: 1,
        },
        {
          description: "3",
          answer_id: 130,
          question_id: 13,
          test_id: 1,
        },
        {
          description: "4",
          answer_id: 131,
          question_id: 13,
          test_id: 1,
        },
        {
          description: "5",
          answer_id: 132,
          question_id: 13,
          test_id: 1,
        },
      ],
      image: {
        src: "https://images.unsplash.com/photo-1664555723834-ec251e81a3ff?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1199&q=80",
        alt: "Alt text",
      },
    },
    {
      type: "MOTIVATION_QUESTION",
      description: "Question3",
      question_id: 14,

      answers: [
        {
          description: "1",
          answer_id: 133,
          question_id: 14,
          test_id: 1,
        },
        {
          description: "2",
          answer_id: 134,
          question_id: 14,
          test_id: 1,
        },
        {
          description: "3",
          answer_id: 135,
          question_id: 14,
          test_id: 1,
        },
        {
          description: "4",
          answer_id: 136,
          question_id: 14,
          test_id: 1,
        },
        {
          description: "5",
          answer_id: 137,
          question_id: 14,
          test_id: 1,
        },
      ],
      image: {
        src: "https://images.unsplash.com/photo-1657299143471-231353519c63?ixlib=rb-1.2.1&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80",
        alt: "Alt text",
      },
    },
  ],
}
vantoan19 commented 2 years ago

I thought "label"s are tied to "FOR_BLIND_PP", "SOCIAL", "ENGLISH",...

nhtoby311 commented 2 years ago

what are these values? The label i mean just for displaying the text of the answer

vantoan19 commented 2 years ago

We agreed that labels will be used for job suggestion (labels are similar to skills in Linkedin). "description" or "answer" or "ans_desc" will be better

nhtoby311 commented 2 years ago

Ok! I update the post above, along with types from Frontend

nhtoby311 commented 2 years ago

The desired route for API should be /user, as now we are going to have user so it makes more sense

nhtoby311 commented 2 years ago

Due to the release of Technical Challenge, we have to change to Slider, scale from 1-5 design. Therefore the object also being changed

vantoan19 commented 2 years ago

/api/assessments/{uuid}/work-motivation-test

vantoan19 commented 2 years ago

Do you need "answered_value" for the UI? And answer's"label" will be changed to "description" to avoid confusion with "labels"

vantoan19 commented 2 years ago

To be identical with other tests, motivation test's answer should follow multiple choices format.

"questions": [
    {
      "type": "MOTIVATION_QUESTION",
      "description": "Question1",
      "question_id": 1,
      "answers": [
        {
          "description": "1",
          "answer_id": 123,
          "question_id": 1
        },
        {
          "description": "2",
          "answer_id": 124,
          "question_id": 1
        },
       {
          "description": "3",
          "answer_id": 125,
          "question_id": 1
        },
        {
          "description": "4",
          "answer_id": 126,
          "question_id": 1
        },
       {
          "description": "5",
          "answer_id": 127,
          "question_id": 1
        }
      ],
    }
]
vantoan19 commented 2 years ago

Consider the following information: index, answered_value Are they neccessary?

nhtoby311 commented 2 years ago

Frontend Important:

vantoan19 commented 2 years ago

Minor note: "id"s might be confusing, so they will be named with a prefix depending on which they indicate. Ex: test_id, question_id, answer_id, label_id,...

nhtoby311 commented 2 years ago

Updated the desired Object