mirror of
https://github.com/bellingcat/auto-archiver-api.git
synced 2026-06-11 04:58:33 +03:00
Format and lint shared directory (#64)
This commit is contained in:
@@ -42,7 +42,9 @@ class Archive(Base):
|
||||
id = Column(String, primary_key=True, index=True)
|
||||
url = Column(String, index=True)
|
||||
result = Column(JSON, default=None)
|
||||
public = Column(Boolean, default=True) # if public=false, access by group and author
|
||||
public = Column(
|
||||
Boolean, default=True
|
||||
) # if public=false, access by group and author
|
||||
deleted = Column(Boolean, default=False)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
@@ -52,7 +54,11 @@ class Archive(Base):
|
||||
author_id = Column(String, ForeignKey("users.email"))
|
||||
sheet_id = Column(String, ForeignKey("sheets.id"), default=None)
|
||||
|
||||
tags = relationship("Tag", back_populates="archives", secondary=association_table_archive_tags)
|
||||
tags = relationship(
|
||||
"Tag",
|
||||
back_populates="archives",
|
||||
secondary=association_table_archive_tags,
|
||||
)
|
||||
group = relationship("Group", back_populates="archives")
|
||||
author = relationship("User", back_populates="archives")
|
||||
urls = relationship("ArchiveUrl", back_populates="archive")
|
||||
@@ -75,7 +81,11 @@ class Tag(Base):
|
||||
id = Column(String, primary_key=True, index=True)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
archives = relationship("Archive", back_populates="tags", secondary=association_table_archive_tags)
|
||||
archives = relationship(
|
||||
"Archive",
|
||||
back_populates="tags",
|
||||
secondary=association_table_archive_tags,
|
||||
)
|
||||
|
||||
|
||||
class User(Base):
|
||||
@@ -85,7 +95,9 @@ class User(Base):
|
||||
|
||||
archives = relationship("Archive", back_populates="author")
|
||||
sheets = relationship("Sheet", back_populates="author")
|
||||
groups = relationship("Group", back_populates="users", secondary=association_table_user_groups)
|
||||
groups = relationship(
|
||||
"Group", back_populates="users", secondary=association_table_user_groups
|
||||
)
|
||||
|
||||
|
||||
class Group(Base):
|
||||
@@ -101,7 +113,9 @@ class Group(Base):
|
||||
|
||||
archives = relationship("Archive", back_populates="group")
|
||||
sheets = relationship("Sheet", back_populates="group")
|
||||
users = relationship("User", back_populates="groups", secondary=association_table_user_groups)
|
||||
users = relationship(
|
||||
"User", back_populates="groups", secondary=association_table_user_groups
|
||||
)
|
||||
|
||||
|
||||
class Sheet(Base):
|
||||
@@ -110,11 +124,27 @@ class Sheet(Base):
|
||||
id = Column(String, primary_key=True, index=True, doc="Google Sheet ID")
|
||||
name = Column(String, default=None)
|
||||
author_id = Column(String, ForeignKey("users.email"))
|
||||
group_id = Column(String, ForeignKey("groups.id"), doc="Group ID, user must be in a group to create a sheet.")
|
||||
frequency = Column(String, default="daily", doc="Frequency of archiving: hourly, daily, weekly.")
|
||||
group_id = Column(
|
||||
String,
|
||||
ForeignKey("groups.id"),
|
||||
doc="Group ID, user must be in a group to create a sheet.",
|
||||
)
|
||||
frequency = Column(
|
||||
String,
|
||||
default="daily",
|
||||
doc="Frequency of archiving: hourly, daily, weekly.",
|
||||
)
|
||||
# TODO: stats is not being used, consider removing
|
||||
stats = Column(JSON, default={}, doc="Sheet statistics like total links, total rows, ...")
|
||||
last_url_archived_at = Column(DateTime(timezone=True), server_default=func.now(), doc="Last time a new link was archived.")
|
||||
stats = Column(
|
||||
JSON,
|
||||
default={},
|
||||
doc="Sheet statistics like total links, total rows, ...",
|
||||
)
|
||||
last_url_archived_at = Column(
|
||||
DateTime(timezone=True),
|
||||
server_default=func.now(),
|
||||
doc="Last time a new link was archived.",
|
||||
)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user