@@ -42,7 +42,9 @@ class Archive(Base):
4242 id = Column (String , primary_key = True , index = True )
4343 url = Column (String , index = True )
4444 result = Column (JSON , default = None )
45- public = Column (Boolean , default = True ) # if public=false, access by group and author
45+ public = Column (
46+ Boolean , default = True
47+ ) # if public=false, access by group and author
4648 deleted = Column (Boolean , default = False )
4749 created_at = Column (DateTime (timezone = True ), server_default = func .now ())
4850 updated_at = Column (DateTime (timezone = True ), onupdate = func .now ())
@@ -52,7 +54,11 @@ class Archive(Base):
5254 author_id = Column (String , ForeignKey ("users.email" ))
5355 sheet_id = Column (String , ForeignKey ("sheets.id" ), default = None )
5456
55- tags = relationship ("Tag" , back_populates = "archives" , secondary = association_table_archive_tags )
57+ tags = relationship (
58+ "Tag" ,
59+ back_populates = "archives" ,
60+ secondary = association_table_archive_tags ,
61+ )
5662 group = relationship ("Group" , back_populates = "archives" )
5763 author = relationship ("User" , back_populates = "archives" )
5864 urls = relationship ("ArchiveUrl" , back_populates = "archive" )
@@ -75,7 +81,11 @@ class Tag(Base):
7581 id = Column (String , primary_key = True , index = True )
7682 created_at = Column (DateTime (timezone = True ), server_default = func .now ())
7783
78- archives = relationship ("Archive" , back_populates = "tags" , secondary = association_table_archive_tags )
84+ archives = relationship (
85+ "Archive" ,
86+ back_populates = "tags" ,
87+ secondary = association_table_archive_tags ,
88+ )
7989
8090
8191class User (Base ):
@@ -85,7 +95,9 @@ class User(Base):
8595
8696 archives = relationship ("Archive" , back_populates = "author" )
8797 sheets = relationship ("Sheet" , back_populates = "author" )
88- groups = relationship ("Group" , back_populates = "users" , secondary = association_table_user_groups )
98+ groups = relationship (
99+ "Group" , back_populates = "users" , secondary = association_table_user_groups
100+ )
89101
90102
91103class Group (Base ):
@@ -101,7 +113,9 @@ class Group(Base):
101113
102114 archives = relationship ("Archive" , back_populates = "group" )
103115 sheets = relationship ("Sheet" , back_populates = "group" )
104- users = relationship ("User" , back_populates = "groups" , secondary = association_table_user_groups )
116+ users = relationship (
117+ "User" , back_populates = "groups" , secondary = association_table_user_groups
118+ )
105119
106120
107121class Sheet (Base ):
@@ -110,11 +124,27 @@ class Sheet(Base):
110124 id = Column (String , primary_key = True , index = True , doc = "Google Sheet ID" )
111125 name = Column (String , default = None )
112126 author_id = Column (String , ForeignKey ("users.email" ))
113- group_id = Column (String , ForeignKey ("groups.id" ), doc = "Group ID, user must be in a group to create a sheet." )
114- frequency = Column (String , default = "daily" , doc = "Frequency of archiving: hourly, daily, weekly." )
127+ group_id = Column (
128+ String ,
129+ ForeignKey ("groups.id" ),
130+ doc = "Group ID, user must be in a group to create a sheet." ,
131+ )
132+ frequency = Column (
133+ String ,
134+ default = "daily" ,
135+ doc = "Frequency of archiving: hourly, daily, weekly." ,
136+ )
115137 # TODO: stats is not being used, consider removing
116- stats = Column (JSON , default = {}, doc = "Sheet statistics like total links, total rows, ..." )
117- last_url_archived_at = Column (DateTime (timezone = True ), server_default = func .now (), doc = "Last time a new link was archived." )
138+ stats = Column (
139+ JSON ,
140+ default = {},
141+ doc = "Sheet statistics like total links, total rows, ..." ,
142+ )
143+ last_url_archived_at = Column (
144+ DateTime (timezone = True ),
145+ server_default = func .now (),
146+ doc = "Last time a new link was archived." ,
147+ )
118148 created_at = Column (DateTime (timezone = True ), server_default = func .now ())
119149 updated_at = Column (DateTime (timezone = True ), onupdate = func .now ())
120150
0 commit comments