/ theprofessor / schemas / studentschemas.py
swadhingithub 2nd step · 2/2/2024
85573d0
38 lines · 2.2 KB
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
from typing import Optional, List
from uuid import UUID
from pydantic import BaseModel,EmailStr,Field
from models.studentmodel import Student

class StudentBase(BaseModel):
    name: str=Field(...,description="Name of the student")
    email: EmailStr=Field(...,description="Email of the student")
    username: str=Field(...,min_length=5,max_length=23,description="Username of the student")
    password: str=Field(...,min_length=8,max_length=23,description="Password of the student")
    frist_name: Optional[str]=Field(None,description="First name of the student")
    last_name: Optional[str]=Field(None,description="Last name of the student")
    is_active: Optional[bool]=Field(True,description="Is the student active")
    is_superuser: Optional[bool]=Field(False,description="Is the student superuser")
    userpicture: Optional[str]=Field(None,description="Profile picture of the student")
    

class StudentOut(BaseModel):
    name: str=Field(...,description="Name of the student")
    email: EmailStr=Field(...,description="Email of the student")
    username: str=Field(...,min_length=5,max_length=23,description="Username of the student")
    frist_name: Optional[str]=Field(None,description="First name of the student")
    last_name: Optional[str]=Field(None,description="Last name of the student")
    is_active: Optional[bool]=Field(True,description="Is the student active")
    is_superuser: Optional[bool]=Field(False,description="Is the student superuser")
    userpicture: Optional[str]=Field(None,description="Profile picture of the student")
    
    
class StudentUpdate(BaseModel):
    name: Optional[str]=Field(None,description="Name of the student")
    email: Optional[EmailStr]=Field(None,description="Email of the student")
    username: Optional[str]=Field(None,min_length=5,max_length=23,description="Username of the student")
    frist_name: Optional[str]=Field(None,description="First name of the student")
    last_name: Optional[str]=Field(None,description="Last name of the student")
    is_active: Optional[bool]=Field(None,description="Is the student active")
    is_superuser: Optional[bool]=Field(None,description="Is the student superuser")
    userpicture: Optional[str]=Field(None,description="Profile picture of the student")