File size: 1,063 Bytes
b7a7f32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from typing import Optional, List, Dict, Any  # noqa

from pydantic import BaseModel

from schemas import Name


class QuizAnswerBase(BaseModel):
    marks_obtained: int = None
    options_selected: Dict[int, Any]
    quiz_id: int
    student_id: int


class QuizAnswerCreate(QuizAnswerBase):
    pass


class QuizAnswerUpdate(QuizAnswerBase):
    marks_obtained: int = None
    options_selected: Dict[int, Any] = None
    quiz_id: int = None
    student_id: int = None


class QuizAnswerInDBBase(QuizAnswerBase):
    id: Optional[int]

    class Config:
        orm_mode = True


class QuizAnswerInDB(QuizAnswerInDBBase):
    pass


class QuizAnswer(QuizAnswerInDBBase):
    pass


class QuizAnsweronlySelected(BaseModel):
    id: Optional[int]
    options_selected: Dict[int, Any]
    quiz_id: int
    student_id: int

    class Config:
        orm_mode = True


class QuizAnswerwithName(BaseModel):
    id: Optional[int]
    marks_obtained: int
    options_selected: Dict[int, Any]
    quiz_id: int
    student: Name

    class Config:
        orm_mode = True