mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 07:05:36 +01:00
Add available types field
This commit is contained in:
@@ -140,6 +140,13 @@ class Book(ormar.Model):
|
||||
genres = ormar.ManyToMany(Genre, through=BookGenres)
|
||||
sequences = ormar.ManyToMany(Sequence, through=BookSequences)
|
||||
|
||||
@ormar.property_field
|
||||
def available_types(self) -> list[str]:
|
||||
if self.file_type == 'fb2' and self.source.name == 'flibusta':
|
||||
return ['fb2', 'epub', 'mobi']
|
||||
|
||||
return [self.file_type]
|
||||
|
||||
|
||||
class BookAnnotation(ormar.Model):
|
||||
class Meta(BaseMeta):
|
||||
|
||||
Reference in New Issue
Block a user