Esempio n. 1
0
 def put_book(book_id: str):
     try:
         book = Book.json_deserialize(request.json)
         book.book_id = int(book_id)
         book_service.update_book(book)
         return jsonify(book.json())
     except ResourceNotFound as e:
         return e.message, 404
Esempio n. 2
0
 def post_book():
     book = Book.json_deserialize(request.json)
     book_service.register_book(book)
     app.logger.info(f'new book registered ID: {book.book_id}')
     return jsonify(book.json()), 201