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

17 lines
599 B
Python
Raw Normal View History

2024-04-13 22:43:03 +02:00
import uuid
from sqlalchemy import Uuid, Column, DateTime, Enum, Float, ForeignKey, String
from app.database import Base
from app.schemas.meter_value import Measurand, PhaseType
2024-04-19 00:08:29 +02:00
class MeterValue(Base):
2024-04-13 22:43:03 +02:00
__tablename__ = "meter_values"
id = Column(Uuid, primary_key=True, default=uuid.uuid4)
timestamp = Column(DateTime, index=True)
2024-04-19 00:08:29 +02:00
measurand = Column(Enum(Measurand), index=True)
phase_type = Column(Enum(PhaseType), nullable=True)
unit = Column(String, nullable=True)
2024-04-13 22:43:03 +02:00
value = Column(Float)
2024-04-19 00:08:29 +02:00
transaction_id = Column(String, ForeignKey("transactions.id"), index=True)