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.
2018-04-27 17:16:43 +00:00
|
|
|
from ereuse_devicehub.resources.device.models import Device
|
2018-04-10 15:06:39 +00:00
|
|
|
from teal.resource import View
|
|
|
|
|
|
|
|
|
|
|
|
class DeviceView(View):
|
2018-04-27 17:16:43 +00:00
|
|
|
def one(self, id: int):
|
2018-04-10 15:06:39 +00:00
|
|
|
"""Gets one device."""
|
2018-05-11 16:58:48 +00:00
|
|
|
device = Device.query.filter_by(id=id).one()
|
2018-05-13 13:13:12 +00:00
|
|
|
return self.schema.jsonify(device)
|
2018-05-11 16:58:48 +00:00
|
|
|
|
|
|
|
def find(self, args: dict):
|
|
|
|
"""Gets many devices"""
|
|
|
|
devices = Device.query.all()
|
2018-05-13 13:13:12 +00:00
|
|
|
return self.schema.jsonify(devices, many=True)
|