feat: track crawl run employee changes and verify dismissals
This commit is contained in:
@@ -41,6 +41,7 @@ class Employee(Base):
|
||||
|
||||
snapshots: Mapped[list["EmployeeSnapshot"]] = relationship(back_populates="employee")
|
||||
tabs: Mapped[list["ProfileTab"]] = relationship(back_populates="employee", cascade="all, delete-orphan")
|
||||
crawl_run_changes: Mapped[list["CrawlRunEmployeeChange"]] = relationship(back_populates="employee")
|
||||
|
||||
|
||||
class EmployeeSnapshot(Base):
|
||||
@@ -74,6 +75,31 @@ class CrawlRun(Base):
|
||||
dismissed_count: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
message: Mapped[str | None] = mapped_column(Text)
|
||||
|
||||
employee_changes: Mapped[list["CrawlRunEmployeeChange"]] = relationship(back_populates="crawl_run")
|
||||
|
||||
|
||||
class CrawlRunEmployeeChange(Base):
|
||||
__tablename__ = "crawl_run_employee_changes"
|
||||
__table_args__ = (
|
||||
Index("ix_crawl_run_employee_changes_run_id", "crawl_run_id"),
|
||||
Index("ix_crawl_run_employee_changes_employee_id", "employee_id"),
|
||||
Index("ix_crawl_run_employee_changes_change_type", "change_type"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
||||
crawl_run_id: Mapped[int] = mapped_column(ForeignKey("crawl_runs.id"), nullable=False)
|
||||
employee_id: Mapped[int | None] = mapped_column(ForeignKey("employees.id"))
|
||||
profile_key: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
profile_url: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
full_name: Mapped[str | None] = mapped_column(Text)
|
||||
change_type: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
profile_available: Mapped[bool | None] = mapped_column()
|
||||
message: Mapped[str | None] = mapped_column(Text)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=utcnow, nullable=False)
|
||||
|
||||
crawl_run: Mapped[CrawlRun] = relationship(back_populates="employee_changes")
|
||||
employee: Mapped[Employee | None] = relationship(back_populates="crawl_run_changes")
|
||||
|
||||
|
||||
class CrawlError(Base):
|
||||
__tablename__ = "crawl_errors"
|
||||
|
||||
Reference in New Issue
Block a user