@@ -44,6 +44,15 @@ class ReadingStatus(str, Enum):
4444 did_not_finish = "did_not_finish"
4545
4646
47+ class AcquisitionStatus (str , Enum ):
48+ """Enum of a book's current availability to the user."""
49+
50+ owned = "owned"
51+ borrowed = "borrowed"
52+ digital_access = "digital_access"
53+ to_acquire = "to_acquire"
54+
55+
4756class UserRole (str , Enum ):
4857 """Enum of possible user roles."""
4958
@@ -79,6 +88,7 @@ def normalize_empty_cover_url(cls, data: dict) -> dict:
7988 blurb : Optional [str ] = None
8089 rating : Optional [int ] = Field (default = None , ge = 1 , le = 5 )
8190 reading_status : ReadingStatus = Field (default = ReadingStatus .want_to_read , index = True )
91+ acquisition_status : AcquisitionStatus = Field (default = AcquisitionStatus .owned , index = True )
8292 user_id : Optional [int ] = Field (default = None , foreign_key = "user.id" , index = True )
8393 date_added : datetime = Field (
8494 default_factory = utcnow ,
@@ -97,7 +107,7 @@ def normalize_empty_cover_url(cls, data: dict) -> dict:
97107class Tag (SQLModel , table = True ):
98108 """A user-specific tag that can be applied to books."""
99109
100- __tablename__ = "tag"
110+ __tablename__ : str = "tag"
101111 __table_args__ = (sa .UniqueConstraint ("user_id" , "name" , name = "uq_tag_user_id_name" ),)
102112
103113 id : Optional [int ] = Field (default = None , primary_key = True )
@@ -112,7 +122,7 @@ class Tag(SQLModel, table=True):
112122class BookTag (SQLModel , table = True ):
113123 """Many-to-many association between books and tags."""
114124
115- __tablename__ = "book_tag"
125+ __tablename__ : str = "book_tag"
116126
117127 book_id : int = Field (foreign_key = "book.id" , primary_key = True )
118128 tag_id : int = Field (foreign_key = "tag.id" , primary_key = True , index = True )
@@ -178,7 +188,7 @@ class ApiKey(SQLModel, table=True):
178188class ReadingProgress (SQLModel , table = True ):
179189 """A page-number reading progress entry for a book."""
180190
181- __tablename__ = "reading_progress"
191+ __tablename__ : str = "reading_progress"
182192
183193 id : Optional [int ] = Field (default = None , primary_key = True )
184194 book_id : int = Field (foreign_key = "book.id" , index = True )
@@ -212,7 +222,7 @@ class OidcLink(SQLModel, table=True):
212222class EmbedToken (SQLModel , table = True ):
213223 """A scoped embed token for iframe/dashboard integrations."""
214224
215- __tablename__ = "embed_token"
225+ __tablename__ : str = "embed_token"
216226
217227 id : Optional [int ] = Field (default = None , primary_key = True )
218228 user_id : int = Field (foreign_key = "user.id" , index = True )
@@ -242,7 +252,7 @@ class EmbedToken(SQLModel, table=True):
242252class ImportMapping (SQLModel , table = True ):
243253 """A saved column-mapping configuration for data import."""
244254
245- __tablename__ = "import_mapping"
255+ __tablename__ : str = "import_mapping"
246256 __table_args__ = (
247257 sa .UniqueConstraint ("user_id" , "name" , name = "uq_import_mapping_user_id_name" ),
248258 )
0 commit comments