HeshamTB
b0dc22070e
- Classes in models describe tables in database - Classes in schemas desribe pydantic models to read from the API. - database provides a connection and sessions to the database. - crud exposes the interface to the database, i.e. actions we can take from the application onto the database Signed-off-by: HeshamTB <hishaminv@gmail.com>
38 lines
522 B
Python
38 lines
522 B
Python
from typing import 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
|
|
|
|
|
|
class UserCreate(UserBase):
|
|
password: str
|
|
|
|
|
|
class User(UserBase):
|
|
id: int
|
|
is_active: bool
|
|
authorized_devices: list[IotEntity] = []
|
|
|
|
class Config:
|
|
orm_mode = True
|