db: api to get all entires
This commit is contained in:
parent
c1b216dd11
commit
19af4bff34
|
@ -107,5 +107,22 @@ def update_token_by_id(id):
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return '', 204
|
return '', 204
|
||||||
|
|
||||||
|
# get all tokens
|
||||||
|
@app.route('/token/all', methods=['GET'])
|
||||||
|
def get_all_tokens():
|
||||||
|
tokens = Token.query.all()
|
||||||
|
tokens_info = [{
|
||||||
|
'id': token.id,
|
||||||
|
'email': token.email,
|
||||||
|
'access_token': token.access_token,
|
||||||
|
'refresh_token': token.refresh_token,
|
||||||
|
'expiration_seconds': int(token.expiration_seconds),
|
||||||
|
'readwise_api_key': token.readwise_api_key,
|
||||||
|
'active': token.active,
|
||||||
|
'created_at': int(token.created_at.timestamp()),
|
||||||
|
'updated_at': int(token.updated_at.timestamp())
|
||||||
|
} for token in tokens]
|
||||||
|
return jsonify({'tokens': tokens_info}), 200
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host='0.0.0.0', port=5000, debug=True)
|
app.run(host='0.0.0.0', port=5000, debug=True)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user