Skip to content

Commit

Permalink
Update /v1/subscription/<walletAddress>. Add /v1/nodes/<uuid>, get_no…
Browse files Browse the repository at this point in the history
…des().
  • Loading branch information
freQniK committed Nov 29, 2023
1 parent f26ea49 commit dc3ac38
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions meile_plan_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,13 @@ def new_user():
return (jsonify({'username': user.username}), 201,
{'Location': url_for('get_user', id=user.id, _external=True)})

'''
@app.route('/api/users/<int:id>')
def get_user(id):
user = User.query.get(id)
if not user:
abort(400)
return jsonify({'username': user.username})
'''

@app.route('/api/token')
@auth.login_required
def get_auth_token():
Expand Down Expand Up @@ -296,7 +295,7 @@ def get_plan_subscriptions():
@auth.login_required
def get_current_subscriber(walletAddress):

query = f"SELECT * from meile_subscriptions WHERE wallet = {walletAddress}"
query = f"SELECT * from meile_subscriptions WHERE wallet = '{walletAddress}'"

c = GetDBCursor()
c.execute(query)
Expand All @@ -313,7 +312,25 @@ def get_current_subscriber(walletAddress):
except Exception as e:
print(str(e))
abort(404)

@app.route('/v1/nodes/<uuid>', methods=['POST'])
@auth.login_required
def get_nodes(uuid):

query = f"SELECT node_address FROM plan_nodes WHERE uuid = '{uuid}'"


c = GetDBCursor()
c.execute(query)

result = c.fetchall()

try:
return jsonify(result)
except Exception as e:
print(str(e))
abort(404)

def UpdateMeileSubscriberDB():
pass

Expand Down

0 comments on commit dc3ac38

Please sign in to comment.