This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
devicehub-teal/ereuse_devicehub/resources/device/views.py
2018-05-13 15:13:12 +02:00

15 lines
429 B
Python

from ereuse_devicehub.resources.device.models import Device
from teal.resource import View
class DeviceView(View):
def one(self, id: int):
"""Gets one device."""
device = Device.query.filter_by(id=id).one()
return self.schema.jsonify(device)
def find(self, args: dict):
"""Gets many devices"""
devices = Device.query.all()
return self.schema.jsonify(devices, many=True)