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
示例#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