diff --git a/slack_backup/objects.py b/slack_backup/objects.py index caf316d..9b1beec 100644 --- a/slack_backup/objects.py +++ b/slack_backup/objects.py @@ -229,14 +229,14 @@ class Message(Base): channel = relationship("Channel", back_populates="messages") reactions = relationship("Reaction", back_populates="message") - files = relationship("File", back_populates="message") + file = relationship("File", uselist=False, back_populates="message") attachments = relationship("Attachment", back_populates="message") def __init__(self, data_dict=None): self.update(data_dict) def datetime(self): - return datetime.fromtimestamp(self.ts) + return datetime.fromtimestamp(float(self.ts)) def update(self, data_dict): data_dict = data_dict or {} @@ -256,7 +256,7 @@ class File(Base): filepath = Column(Text) message_id = Column(Integer, ForeignKey('messages.id')) - message = relationship('Message', back_populates='files') + message = relationship('Message', back_populates='file') def __init__(self, data_dict=None): self.update(data_dict)