File size: 854 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
from typing import Optional, List

from pydantic import BaseModel


# properties shared
class ProgramBase(BaseModel):
    name: str
    department_id: int


# properties to recieve via
class ProgramCreate(ProgramBase):
    max_sems: int


# properties to recive via API on Update
class ProgramUpdate(ProgramBase):
    name: Optional[str]
    department_id: Optional[int]


# properties to return via the api
class ProgramInDBBase(ProgramBase):
    id: Optional[int]

    class Config:
        orm_mode = True


class ProgramInDB(ProgramInDBBase):
    pass


class Program(ProgramInDBBase):
    pass


class GroupOfProgram(BaseModel):
    id: int
    sem: int

    class Config:
        orm_mode = True


class ProgramGroupReturn(BaseModel):
    name: str
    department_id: int
    groups: List[GroupOfProgram]

    class Config:
        orm_mode = True