30 lines
988 B
Python
30 lines
988 B
Python
from app.core.database import Base
|
||
from sqlalchemy import Column, Integer, String, DateTime, Enum, ForeignKey
|
||
from sqlalchemy.orm import relationship
|
||
from datetime import datetime
|
||
import enum
|
||
|
||
|
||
class AuditAction(enum.Enum):
|
||
booking_create = "booking_create"
|
||
booking_delete = "booking_delete"
|
||
topup_create = "topup_create"
|
||
# Weitere Aktionen können hier ergänzt werden, z. B.:
|
||
# topup_confirm = "topup_confirm"
|
||
# user_update = "user_update"
|
||
|
||
|
||
class AuditLog(Base):
|
||
__tablename__ = "audit_logs"
|
||
|
||
id = Column(Integer, primary_key=True, index=True)
|
||
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||
action = Column(String, nullable=False)
|
||
amount_cents = Column(Integer, nullable=True)
|
||
old_balance_cents = Column(Integer, nullable=True)
|
||
new_balance_cents = Column(Integer, nullable=True)
|
||
info = Column(String, nullable=True)
|
||
created_at = Column(DateTime, default=datetime.utcnow)
|
||
|
||
user = relationship("User")
|