meta options
This commit is contained in:
parent
4697dab339
commit
8726c931fa
21 changed files with 3028 additions and 3 deletions
|
|
@ -743,6 +743,49 @@ class UrmiportReport(Base):
|
|||
group: Mapped[UrmiportReportGroup] = relationship(back_populates="reports")
|
||||
|
||||
|
||||
class MetaConnection(Base):
|
||||
"""One Meta Login connection per customer. The user token never leaves the server."""
|
||||
|
||||
__tablename__ = "meta_connections"
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
user_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("user_accounts.id"), unique=True, index=True)
|
||||
meta_user_id: Mapped[str] = mapped_column(String(64), default="")
|
||||
meta_user_name: Mapped[str] = mapped_column(String(255), default="")
|
||||
granted_scopes: Mapped[str] = mapped_column(Text, default="")
|
||||
access_token: Mapped[str] = mapped_column(Text, default="")
|
||||
token_expires_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
status: Mapped[str] = mapped_column(String(32), default="disconnected")
|
||||
selected_page_id: Mapped[str] = mapped_column(String(64), default="")
|
||||
selected_page_name: Mapped[str] = mapped_column(String(255), default="")
|
||||
selected_ad_account_id: Mapped[str] = mapped_column(String(64), default="")
|
||||
selected_ad_account_name: Mapped[str] = mapped_column(String(255), default="")
|
||||
last_error: Mapped[str] = mapped_column(Text, default="")
|
||||
last_graph_code: Mapped[int | None] = mapped_column(nullable=True)
|
||||
connected_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now(), onupdate=func.now()
|
||||
)
|
||||
|
||||
|
||||
class MetaAuditEvent(Base):
|
||||
"""Customer-visible record of Meta connect, publish, and status changes."""
|
||||
|
||||
__tablename__ = "meta_audit_events"
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
user_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("user_accounts.id"), index=True)
|
||||
action: Mapped[str] = mapped_column(String(64))
|
||||
asset_type: Mapped[str] = mapped_column(String(32), default="")
|
||||
asset_label: Mapped[str] = mapped_column(String(255), default="")
|
||||
asset_id: Mapped[str] = mapped_column(String(64), default="")
|
||||
detail: Mapped[str] = mapped_column(Text, default="")
|
||||
status: Mapped[str] = mapped_column(String(16), default="success")
|
||||
error_message: Mapped[str] = mapped_column(Text, default="")
|
||||
graph_code: Mapped[int | None] = mapped_column(nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
|
||||
class PlatformSetting(Base):
|
||||
"""Runtime overrides for platform credentials (admin-editable)."""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue