Zocom-LIA / codecrafters-quizapp

quizapp using serverless framework aws .
1 stars 0 forks source link

Create quiz data model #9

Open ioannismarkou opened 1 week ago

ioannismarkou commented 1 week ago

Prerequisite: Study single vs. multi table.

ioannismarkou commented 1 week ago

A JSON example of our data model:

[
    {
        "PK": "QUIZ#quiz1",
        "SK": "METADATA",
        "EntityType": "Quiz",
        "title": "Python Basics",
        "description": "A quiz on basic Python concepts",
        "createdAt": "2024-09-25"
    },
    {
        "PK": "QUIZ#quiz1",
        "SK": "QUESTION#question1",
        "EntityType": "Question",
        "text": "Which of the following is used to create a function in Python?",
        "type": "multiple-choice",
        "correctAnswer": [
            "ANSWER#answer3"
        ]
    },
    {
        "PK": "QUIZ#quiz1#QUESTION#question1",
        "SK": "ANSWER#answer1",
        "EntityType": "Answer",
        "answer_text": "func"
    },
    {
        "PK": "QUIZ#quiz1#QUESTION#question1",
        "SK": "ANSWER#answer2",
        "EntityType": "Answer",
        "answer_text": "define"
    },
    {
        "PK": "QUIZ#quiz1#QUESTION#question1",
        "SK": "ANSWER#answer3",
        "EntityType": "Answer",
        "answer_text": "def"
    },
    {
        "PK": "QUIZ#quiz1#QUESTION#question1",
        "SK": "ANSWER#answer4",
        "EntityType": "Answer",
        "answer_text": "function"
    },
    {
        "PK": "QUIZ#quiz1#QUESTION#question2",
        "SK": "QUESTION#question2",
        "EntityType": "Question",
        "text": "Which of the following are primitive data types in Python? (Select all that apply)",
        "type": "multiple-select",
        "correctAnswer": [
            "ANSWER#answer1",
            "ANSWER#answer3",
            "ANSWER#answer5",
            "ANSWER#answer6"
        ]
    },
    {
        "PK": "QUIZ#quiz1#QUESTION#question2",
        "SK": "ANSWER#answer1",
        "EntityType": "Answer",
        "answer_text": "int"
    },
    {
        "PK": "QUIZ#quiz1#QUESTION#question2",
        "SK": "ANSWER#answer2",
        "EntityType": "Answer",
        "answer_text": "list"
    },
    {
        "PK": "QUIZ#quiz1#QUESTION#question2",
        "SK": "ANSWER#answer3",
        "EntityType": "Answer",
        "answer_text": "str"
    },
    {
        "PK": "QUIZ#quiz1#QUESTION#question2",
        "SK": "ANSWER#answer4",
        "EntityType": "Answer",
        "answer_text": "dict"
    },
    {
        "PK": "QUIZ#quiz1#QUESTION#question2",
        "SK": "ANSWER#answer5",
        "EntityType": "Answer",
        "answer_text": "float"
    },
    {
        "PK": "QUIZ#quiz1#QUESTION#question2",
        "SK": "ANSWER#answer6",
        "EntityType": "Answer",
        "answer_text": "bool"
    },
    {
        "PK": "RESULT",
        "SK": "QUIZ#quiz1#2024-09-25T12:00:00Z",
        "EntityType": "Result",
        "quizTitle": "Python Basics",
        "date": "2024-09-25T12:00:00Z",
        "score": 80
    }
]

There's also a table representation of the above example.