File size: 814 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
from typing import Optional

from pydantic import BaseModel


# shared properties
class CourseBase(BaseModel):
    course_code: str
    course_name: str
    course_credit: int
    department_id: int


# properties to  recieve via API on creation
class CourseCreate(CourseBase):
    pass


# properties to recieve via API on update
class CourseUpdate(CourseBase):
    course_code: Optional[str]
    course_name: Optional[str]
    course_credit: Optional[int]
    department_id: Optional[int]


class CourseInDBBase(CourseBase):
    id: Optional[int]

    class Config:
        orm_mode = True


class CourseInDB(CourseInDBBase):
    pass


class Course(CourseInDBBase):
    pass


class CourseMin(BaseModel):
    id: Optional[int]
    course_code: str
    course_name: str

    class Config:
        orm_mode = True