2022-03-03 13:49:26 +01:00
|
|
|
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
|
|
|
|
from sqlalchemy.orm import relationship
|
|
|
|
|
|
|
|
from .database import Base
|
|
|
|
|
|
|
|
|
|
|
|
class User(Base):
|
|
|
|
__tablename__ = "user_accounts"
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
|
|
email = Column(String, unique=True, index=True)
|
|
|
|
hashed_password = Column(String)
|
|
|
|
is_active = Column(Boolean, default=True)
|
|
|
|
|
2022-03-06 14:13:50 +01:00
|
|
|
#items = relationship("Item", back_populates="owner")
|
2022-03-03 13:49:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
class IotEntity(Base):
|
|
|
|
__tablename__ = "iot_entities"
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
|
|
description = Column(String, index=True)
|
2022-03-06 14:13:50 +01:00
|
|
|
owner_id = Column(Integer, ForeignKey("user_accounts.id"))
|
2022-03-03 13:49:26 +01:00
|
|
|
|
2022-03-06 14:13:50 +01:00
|
|
|
#owner = relationship("User", back_populates="items")
|