28 lines
1 KiB
Python
28 lines
1 KiB
Python
import uuid
|
|
from sqlalchemy import ForeignKey, Numeric, Uuid, Boolean, Column, DateTime, String
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.database import Base
|
|
|
|
class ChargePoint(Base):
|
|
__tablename__ = "chargepoints"
|
|
|
|
id = Column(Uuid, primary_key=True, default=uuid.uuid4)
|
|
identity = Column(String, unique=True, index=True)
|
|
is_active = Column(Boolean, default=True)
|
|
password = Column(String)
|
|
price = Column(Numeric(10, 2))
|
|
|
|
last_seen = Column(DateTime, nullable=True)
|
|
vendor_name = Column(String, nullable=True)
|
|
model = Column(String, nullable=True)
|
|
serial_number = Column(String, nullable=True)
|
|
firmware_version = Column(String, nullable=True)
|
|
|
|
learn_user_id = Column(Uuid, ForeignKey("users.id"), nullable=True)
|
|
learn_until = Column(DateTime, nullable=True)
|
|
|
|
connectors = relationship("Connector", cascade="delete, delete-orphan")
|
|
transactions = relationship("Transaction", cascade="delete, delete-orphan")
|
|
variables = relationship("ChargepointVariable", cascade="delete, delete-orphan")
|