```
feat(auth): 添加用户权限获取接口并完善JWT令牌角色信息 - 在JWT令牌中添加用户角色信息 - 新增get_my_permissions接口用于获取当前用户权限码列表 - 重构认证回调逻辑,增加错误日志记录 - 更新用户信息获取接口使用Authorization头验证 ```
This commit is contained in:
@@ -13,6 +13,7 @@ class OLTDevice(Base):
|
||||
username = Column(String(100), nullable=False)
|
||||
password = Column(Text, nullable=False)
|
||||
slot_command = Column(String(50), nullable=False)
|
||||
region = Column(String(100), index=True)
|
||||
location = Column(String(200))
|
||||
description = Column(Text)
|
||||
created_at = Column(TIMESTAMP, server_default=func.now())
|
||||
@@ -72,6 +73,18 @@ class DuplicateMac(Base):
|
||||
last_seen_at = Column(TIMESTAMP, server_default=func.now(), onupdate=func.now())
|
||||
|
||||
|
||||
class DeviceDailySnapshot(Base):
|
||||
"""设备每日状态快照(用于趋势图,避免全量扫描历史表)"""
|
||||
__tablename__ = "device_daily_snapshots"
|
||||
|
||||
id = Column(BigInteger, primary_key=True, index=True)
|
||||
snapshot_date = Column(String(10), nullable=False, index=True) # YYYY-MM-DD
|
||||
total = Column(Integer, nullable=False, default=0)
|
||||
online = Column(Integer, nullable=False, default=0)
|
||||
offline = Column(Integer, nullable=False, default=0)
|
||||
created_at = Column(TIMESTAMP, server_default=func.now())
|
||||
|
||||
|
||||
class NewDevice(Base):
|
||||
"""新发现设备(OLT 扫描到但尚未补全信息的设备)"""
|
||||
__tablename__ = "new_devices"
|
||||
@@ -80,3 +93,18 @@ class NewDevice(Base):
|
||||
onu_device_id = Column(BigInteger, ForeignKey("onu_devices.id"), nullable=False, unique=True)
|
||||
olt_id = Column(BigInteger, ForeignKey("olt_devices.id"), nullable=False)
|
||||
discovered_at = Column(TIMESTAMP, server_default=func.now())
|
||||
|
||||
|
||||
class DeviceReplacement(Base):
|
||||
"""设备更换记录"""
|
||||
__tablename__ = "device_replacements"
|
||||
|
||||
id = Column(BigInteger, primary_key=True, index=True)
|
||||
onu_device_id = Column(BigInteger, ForeignKey("onu_devices.id"), nullable=False, index=True)
|
||||
old_mac = Column(String(17), nullable=False)
|
||||
new_mac = Column(String(17), nullable=False)
|
||||
reason = Column(Text)
|
||||
operator_id = Column(String(100)) # 操作人 user_id
|
||||
operator_name = Column(String(100))
|
||||
replaced_at = Column(TIMESTAMP, nullable=False, server_default=func.now())
|
||||
created_at = Column(TIMESTAMP, server_default=func.now())
|
||||
|
||||
Reference in New Issue
Block a user