Skip to content

Commit

Permalink
Add new Mention model
Browse files Browse the repository at this point in the history
  • Loading branch information
mtomilov committed Jan 20, 2025
1 parent 6628257 commit 964eabe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions h/models/mention.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sqlalchemy as sa
from sqlalchemy.orm import Mapped, mapped_column

from h.db import Base
from h.db.mixins import Timestamps
Expand All @@ -8,17 +9,17 @@
class Mention(Base, Timestamps): # pragma: nocover
__tablename__ = "mention"

id = sa.Column(sa.Integer, autoincrement=True, primary_key=True)
id: Mapped[int] = mapped_column(sa.Integer, autoincrement=True, primary_key=True)

annotation_id = sa.Column(
annotation_id: Mapped[int] = mapped_column(
sa.Integer,
sa.ForeignKey("annotation_slim.id", ondelete="CASCADE"),
nullable=False,
)
"""FK to annotation_slim.id"""
annotation = sa.orm.relationship("AnnotationSlim")

user_id = sa.Column(
user_id: Mapped[int] = mapped_column(
sa.Integer,
sa.ForeignKey("user.id", ondelete="CASCADE"),
nullable=False,
Expand All @@ -27,5 +28,5 @@ class Mention(Base, Timestamps): # pragma: nocover
"""FK to user.id"""
user = sa.orm.relationship("User")

def __repr__(self):
def __repr__(self) -> str:
return helpers.repr_(self, ["id", "annotation_id", "user_id"])

0 comments on commit 964eabe

Please sign in to comment.