ibs/sql_app/schemas.py
HeshamTB f1cbd6d265 jwt auth
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-04-13 05:24:06 +03:00

48 lines
777 B
Python

from typing import Any, List, Optional
from pydantic import BaseModel
class IotEntityBase(BaseModel):
id: int
description: str
class IotEntityCreate(IotEntityBase):
pass
class IotEntity(IotEntityBase):
id: int
description: str
class Config:
orm_mode = True
class UserBase(BaseModel):
email: str
username: str
class UserCreate(UserBase):
password: str
class User(UserBase):
id: int
is_active: bool
authorized_devices: List[IotEntity] = []
class Config:
orm_mode = True
class Token(BaseModel):
access_token : str
token_type : str
class TokenData(BaseModel):
username : str
# Token can conatin information. But we are already recording this in a database
# for scalability.