Adds the admin backend foundation: AuditLog + Setting models/migration, an admin-only dashboard with KPI cards, and user management (search, ban/suspend/activate, tier override, trust adjust) with audit logging on every write action. Smoke suite extended to 64 checks.
17 lines
522 B
Python
17 lines
522 B
Python
"""Admin-editable runtime settings (registration_open, flag_threshold, etc.)."""
|
|
from datetime import datetime
|
|
from sqlalchemy import JSON
|
|
from app.extensions import db
|
|
|
|
|
|
class Setting(db.Model):
|
|
__tablename__ = "settings"
|
|
|
|
key = db.Column(db.String(80), primary_key=True)
|
|
value = db.Column(JSON, nullable=True)
|
|
updated_at = db.Column(db.DateTime, default=datetime.utcnow,
|
|
onupdate=datetime.utcnow, nullable=False)
|
|
|
|
def __repr__(self):
|
|
return f"<Setting {self.key}>"
|