File size: 780 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
from fastapi import FastAPI, File, Form, UploadFile
from schemas.class_session import ClassSessionCreate
from typing import List, Optional
from datetime import datetime


class ClassSessionCreateForm:
    def __init__(
        self,
        start_time: datetime = Form(...),
        end_time: datetime = Form(...),
        instructor: Optional[str] = Form(None),
        group: int = Form(...),
        description: str = Form(...),
        file: Optional[List[UploadFile]] = File(None),
    ):
        self.start_time = start_time
        self.end_time = end_time

        if instructor:
            self.instructor = instructor.split(",")
        else:
            self.instructor = []

        self.group = group
        self.description = description
        self.file = file