refactor(sound_played): remove unused fields ip_address and user_agent from SoundPlayed model
This commit is contained in:
@@ -23,9 +23,6 @@ class SoundPlayed(db.Model):
|
||||
Integer, ForeignKey("sounds.id"), nullable=False
|
||||
)
|
||||
|
||||
# Additional context
|
||||
ip_address: Mapped[str | None] = mapped_column(String(45), nullable=True)
|
||||
user_agent: Mapped[str | None] = mapped_column(String(500), nullable=True)
|
||||
|
||||
# Timestamp
|
||||
played_at: Mapped[datetime] = mapped_column(
|
||||
@@ -46,8 +43,6 @@ class SoundPlayed(db.Model):
|
||||
"id": self.id,
|
||||
"user_id": self.user_id,
|
||||
"sound_id": self.sound_id,
|
||||
"ip_address": self.ip_address,
|
||||
"user_agent": self.user_agent,
|
||||
"played_at": self.played_at.isoformat(),
|
||||
"user": {
|
||||
"id": self.user.id,
|
||||
@@ -67,16 +62,12 @@ class SoundPlayed(db.Model):
|
||||
cls,
|
||||
user_id: int,
|
||||
sound_id: int,
|
||||
ip_address: str | None = None,
|
||||
user_agent: str | None = None,
|
||||
commit: bool = True,
|
||||
) -> "SoundPlayed":
|
||||
"""Create a new sound played record."""
|
||||
play_record = cls(
|
||||
user_id=user_id,
|
||||
sound_id=sound_id,
|
||||
ip_address=ip_address,
|
||||
user_agent=user_agent,
|
||||
)
|
||||
|
||||
db.session.add(play_record)
|
||||
|
||||
Reference in New Issue
Block a user