File size: 1,232 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 tokenize import group
from typing import Optional, List, Any  # noqa

from datetime import datetime
from pydantic import BaseModel
from schemas import TeacherShort, CourseMin, GroupReturn


class AssignmentBase(BaseModel):
    due_date: datetime
    marks: int = None
    title: str
    contents: str = None
    files: List[Any] = None
    instructor: List[int]
    group: List[int]
    course_id: int


class AssignmentCreate(AssignmentBase):
    instructor: Optional[List[int]]


class AssignmentUpdate(AssignmentBase):
    due_date: datetime = None
    marks: int = None
    title: str = None
    contents: str = None
    files: List[Any] = None
    instructor: List[int] = None
    group: List[int] = None
    course_id: int = None


class AssignmentInDBBase(AssignmentBase):
    id: Optional[int]

    class Config:
        orm_mode = True


class AssignmentInDB(AssignmentInDBBase):
    pass


class Assignment(BaseModel):
    id: Optional[int]
    due_date: datetime = None
    marks: int = None
    title: str
    contents: str = None
    files: List[Any] = None
    instructor: List[TeacherShort]
    group: List[GroupReturn]
    course: CourseMin
    exists: Optional[bool]

    class Config:
        orm_mode = True