Browse Source

repair bug & use app.route(...)

kunickyd 3 years ago
parent
commit
b4d333aaa7
1 changed files with 3 additions and 3 deletions
  1. 3 3
      app.py

+ 3 - 3
app.py

@@ -65,7 +65,7 @@ transferAssetsValidationErrors = [
     StatefulValidationError("Too long description", "Too long description", "Ensure that description length matches the criteria above (or just shorten it)")
     StatefulValidationError("Too long description", "Too long description", "Ensure that description length matches the criteria above (or just shorten it)")
 ]    
 ]    
 
 
-@app.get("/accounts/<string:accountId>/assets/")
+@app.route("/accounts/<string:accountId>/assets/", methods=['GET'])
 def get_account_assets(accountId): #TODO: add validation and error handling
 def get_account_assets(accountId): #TODO: add validation and error handling
 
 
     query = iroha.query('GetAccountAssets', account_id=accountId)
     query = iroha.query('GetAccountAssets', account_id=accountId)
@@ -85,11 +85,11 @@ def get_account_assets(accountId): #TODO: add validation and error handling
 
 
     return jsonify(response)
     return jsonify(response)
 
 
-@app.post("/assets/transfer/")
+@app.route("/assets/transfer/", methods=['POST'])
 def transfer_assets():
 def transfer_assets():
     data = request.get_json()
     data = request.get_json()
 
 
-    if data["transfers"] and len(data["transfers"]) > 1:
+    if data["transfers"] and len(data["transfers"]) > 0:
         commands = []
         commands = []
 
 
         for transfer in data["transfers"]:
         for transfer in data["transfers"]: