simple-ocpp-cs/app/models/chargepoint.py

26 lines
897 B
Python
Raw Normal View History

2024-04-13 22:43:03 +02:00
import uuid
2024-04-19 00:08:29 +02:00
from sqlalchemy import ForeignKey, Numeric, Uuid, Boolean, Column, DateTime, String
2024-03-28 21:23:25 +01:00
from sqlalchemy.orm import relationship
2024-04-13 22:43:03 +02:00
from app.database import Base
2024-03-28 21:23:25 +01:00
class ChargePoint(Base):
__tablename__ = "chargepoints"
2024-04-13 22:43:03 +02:00
id = Column(Uuid, primary_key=True, default=uuid.uuid4)
2024-04-19 00:08:29 +02:00
identity = Column(String, unique=True, index=True)
2024-03-28 21:23:25 +01:00
is_active = Column(Boolean, default=True)
password = Column(String)
2024-04-19 00:08:29 +02:00
price = Column(Numeric(10, 2))
2024-03-28 21:23:25 +01:00
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)
2024-03-28 21:23:25 +01:00
2024-04-19 00:08:29 +02:00
learn_user_id = Column(Uuid, ForeignKey("users.id"), nullable=True)
learn_until = Column(DateTime, nullable=True)
2024-04-13 22:43:03 +02:00
connectors = relationship("Connector", cascade="delete, delete-orphan")