refactor: port AppAnnotationHitHistory (#30922)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Asuka Minato
2026-01-15 11:14:55 +09:00
committed by GitHub
parent 2f633de45e
commit d3923e7b56

View File

@ -1447,7 +1447,7 @@ class MessageAnnotation(Base):
return account return account
class AppAnnotationHitHistory(Base): class AppAnnotationHitHistory(TypeBase):
__tablename__ = "app_annotation_hit_histories" __tablename__ = "app_annotation_hit_histories"
__table_args__ = ( __table_args__ = (
sa.PrimaryKeyConstraint("id", name="app_annotation_hit_histories_pkey"), sa.PrimaryKeyConstraint("id", name="app_annotation_hit_histories_pkey"),
@ -1457,17 +1457,19 @@ class AppAnnotationHitHistory(Base):
sa.Index("app_annotation_hit_histories_message_idx", "message_id"), sa.Index("app_annotation_hit_histories_message_idx", "message_id"),
) )
id = mapped_column(StringUUID, default=lambda: str(uuid4())) id: Mapped[str] = mapped_column(StringUUID, default=lambda: str(uuid4()), init=False)
app_id = mapped_column(StringUUID, nullable=False) app_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
annotation_id: Mapped[str] = mapped_column(StringUUID, nullable=False) annotation_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
source = mapped_column(LongText, nullable=False) source: Mapped[str] = mapped_column(LongText, nullable=False)
question = mapped_column(LongText, nullable=False) question: Mapped[str] = mapped_column(LongText, nullable=False)
account_id = mapped_column(StringUUID, nullable=False) account_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
created_at = mapped_column(sa.DateTime, nullable=False, server_default=func.current_timestamp()) created_at: Mapped[datetime] = mapped_column(
score = mapped_column(Float, nullable=False, server_default=sa.text("0")) sa.DateTime, nullable=False, server_default=func.current_timestamp(), init=False
message_id = mapped_column(StringUUID, nullable=False) )
annotation_question = mapped_column(LongText, nullable=False) score: Mapped[float] = mapped_column(Float, nullable=False, server_default=sa.text("0"))
annotation_content = mapped_column(LongText, nullable=False) message_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
annotation_question: Mapped[str] = mapped_column(LongText, nullable=False)
annotation_content: Mapped[str] = mapped_column(LongText, nullable=False)
@property @property
def account(self): def account(self):