コード例 #1
0
 def put(self):
     claims = get_jwt_claims()
     if claims["admin"]:
         data = game_parser.parse_args()
         newgame = GameModel(title=data["title"],
                             description=data["description"],
                             riddles=int(data["riddles"]))
         newgame.save_to_db()
         return GameModel.serialize([newgame])
     else:
         return {
             "message":
             "Admin privileges are required to perform this action"
         }
コード例 #2
0
 def get(self, game_id):
     return GameModel.serialize([GameModel.find_by_id(game_id)])