Files
serv_benchmark/backend/app/models/peripheral_history.py
Gilles Soulier c67befc549 addon
2026-01-05 16:08:01 +01:00

35 lines
1.0 KiB
Python
Executable File

"""
Linux BenchTools - Peripheral History Models
"""
from sqlalchemy import Column, Integer, String, DateTime, Text
from sqlalchemy.sql import func
from app.db.base import BasePeripherals
class PeripheralLocationHistory(BasePeripherals):
"""
History of peripheral movements (location changes, assignments)
"""
__tablename__ = "peripheral_location_history"
id = Column(Integer, primary_key=True, index=True)
peripheral_id = Column(Integer, nullable=False, index=True)
# Location changes
from_location_id = Column(Integer)
to_location_id = Column(Integer)
# Device assignments
from_device_id = Column(Integer)
to_device_id = Column(Integer)
# Action details
action = Column(String(50), nullable=False) # moved, assigned, unassigned, stored
timestamp = Column(DateTime, server_default=func.now())
notes = Column(Text)
user = Column(String(100))
def __repr__(self):
return f"<PeripheralLocationHistory(id={self.id}, action='{self.action}')>"