def to_object(self, json_obj: dict):
        book = Book()

        book.title = json_obj['title']
        book.description = json_obj['description']
        book.cover_url = json_obj['coverUrl']
        book.author_id = json_obj['author_id']
        return book
 def instantiate_book(self, found_book_info):
     new_book = Book(found_book_info["title"], found_book_info["author"],
                     found_book_info["year"])
     new_book.id = str(found_book_info["_id"])
     new_book.isAvailable = found_book_info["isAvailable"]
     new_book.waitingList = found_book_info["waitingList"]
     new_book.description = found_book_info["description"]
     new_book.publisher = found_book_info["publisher"]
     return new_book
Beispiel #3
0
 def map_to_model(entity: dict):
     model = Book()
     model.id = str(entity['_id'])
     model.title = entity['title']
     model.description = entity['description']
     model.cover_url = entity['coverUrl']
     model.author_id = entity['author_id']
     model.updated = entity['updated']
     model.created = entity['created']
     return model
 def add_new_book(self, title, author, year, description, publisher):
     new_book = Book(title, author, year)
     new_book.description = description
     new_book.publisher = publisher
     self.client.add_new_book_db(new_book)