admin notifications and data explorer backend
This commit is contained in:
@@ -432,6 +432,29 @@ class ServiceNotification(Base):
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), index=True)
|
||||
|
||||
|
||||
class AdminNotification(Base):
|
||||
__tablename__ = "admin_notifications"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
event_type: Mapped[str] = mapped_column(String(80), index=True)
|
||||
severity: Mapped[str] = mapped_column(String(24), default="info", server_default="info", index=True)
|
||||
title: Mapped[str] = mapped_column(String(180))
|
||||
body: Mapped[str | None] = mapped_column(Text)
|
||||
entity_type: Mapped[str | None] = mapped_column(String(80), index=True)
|
||||
entity_id: Mapped[str | None] = mapped_column(String(80), index=True)
|
||||
status: Mapped[str] = mapped_column(String(24), default="unread", server_default="unread", index=True)
|
||||
idempotency_key: Mapped[str] = mapped_column(String(180), unique=True, index=True)
|
||||
metadata_json: Mapped[dict | None] = mapped_column(JSON)
|
||||
telegram_status: Mapped[str] = mapped_column(String(24), default="pending", server_default="pending", index=True)
|
||||
telegram_error: Mapped[str | None] = mapped_column(Text)
|
||||
read_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
|
||||
dismissed_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), index=True)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now(), onupdate=func.now()
|
||||
)
|
||||
|
||||
|
||||
class ServiceWorkItem(Base):
|
||||
__tablename__ = "service_work_items"
|
||||
|
||||
@@ -625,3 +648,19 @@ class AuditLog(Base):
|
||||
user_agent: Mapped[str | None] = mapped_column(String(256))
|
||||
metadata_json: Mapped[dict | None] = mapped_column(JSON)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), index=True)
|
||||
|
||||
|
||||
class AdminExportJob(Base):
|
||||
__tablename__ = "admin_export_jobs"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
requested_by_user_id: Mapped[int | None] = mapped_column(ForeignKey("users.id", ondelete="SET NULL"), index=True)
|
||||
source: Mapped[str] = mapped_column(String(80), index=True)
|
||||
export_format: Mapped[str] = mapped_column(String(16), default="json", server_default="json")
|
||||
status: Mapped[str] = mapped_column(String(24), default="ready", server_default="ready", index=True)
|
||||
reason: Mapped[str | None] = mapped_column(Text)
|
||||
filters_json: Mapped[dict | None] = mapped_column(JSON)
|
||||
result_text: Mapped[str | None] = mapped_column(Text)
|
||||
row_count: Mapped[int] = mapped_column(Integer, default=0, server_default="0")
|
||||
expires_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), index=True)
|
||||
|
||||
Reference in New Issue
Block a user