Esempio n. 1
0
 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
Esempio n. 2
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