Add WIP details API

This commit is contained in:
Danila Fedorin 2020-05-12 17:32:47 -07:00
parent 5a20130c37
commit a57f8170e7

View File

@ -48,3 +48,11 @@ def collar_history(id):
order_by(DataPoint.datetime.desc()).\
all()
return jsonify([point.to_dict() for point in data_points])
@app.route('/collars/<int:id>/details')
@jwt_required
def collar_detail(id):
collar = Collar.query.filter_by(id=id).first()
if collar is None: abort(404)
return jsonify({'id': collar.id, 'name': collar.name })