Commit 3dfbc2c5 authored by Cédric Bonhomme's avatar Cédric Bonhomme

Limit the number of return epcis event to 10. And test if there is at leat on result.

parent 514c593a
......@@ -17,8 +17,11 @@ class EPCISEventAPI(Resource):
def get(self):
"""
Return the 10 last EPCIS event.
"""
result = models.EPCISEvent.objects()
result = models.EPCISEvent.objects[:10]
if result.count == 0:
return jsonify(result="no epcis event")
epcis_events = [epcis_event.data for epcis_event in result]
return jsonify(result="ok", epcis_events=epcis_events)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment