2018-10-04 08:59:31 +00:00
|
|
|
from typing import Callable, Iterable, Tuple
|
|
|
|
|
|
|
|
from ereuse_devicehub.resources.device import schemas
|
|
|
|
from ereuse_devicehub.resources.device.models import Manufacturer
|
2022-11-22 14:44:44 +00:00
|
|
|
from ereuse_devicehub.resources.device.views import (
|
|
|
|
DeviceMergeView,
|
|
|
|
DeviceView,
|
|
|
|
ManufacturerView,
|
|
|
|
)
|
2023-03-21 11:08:13 +00:00
|
|
|
from ereuse_devicehub.teal.resource import Converters, Resource
|
2018-10-04 08:59:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DeviceDef(Resource):
|
|
|
|
SCHEMA = schemas.Device
|
|
|
|
VIEW = DeviceView
|
2021-03-08 21:43:24 +00:00
|
|
|
ID_CONVERTER = Converters.string
|
2018-10-04 08:59:31 +00:00
|
|
|
AUTH = False # We manage this at each view
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder='static',
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder='templates',
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
|
|
|
|
|
|
|
device_merge = DeviceMergeView.as_view(
|
|
|
|
'merge-devices', definition=self, auth=app.auth
|
|
|
|
)
|
2020-10-27 18:12:46 +00:00
|
|
|
|
2020-07-07 12:58:37 +00:00
|
|
|
if self.AUTH:
|
|
|
|
device_merge = app.auth.requires_auth(device_merge)
|
2020-10-27 18:12:46 +00:00
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
path = '/<{value}:dev1_id>/merge/<{value}:dev2_id>'.format(
|
|
|
|
value=self.ID_CONVERTER.value
|
|
|
|
)
|
2020-10-27 18:12:46 +00:00
|
|
|
|
2021-02-11 19:38:18 +00:00
|
|
|
# self.add_url_rule(path, view_func=device_merge, methods={'POST'})
|
2020-07-07 12:58:37 +00:00
|
|
|
|
2018-10-04 08:59:31 +00:00
|
|
|
|
|
|
|
class ComputerDef(DeviceDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Computer
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2018-10-16 06:46:55 +00:00
|
|
|
|
2018-10-04 08:59:31 +00:00
|
|
|
|
|
|
|
class DesktopDef(ComputerDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Desktop
|
|
|
|
|
|
|
|
|
|
|
|
class LaptopDef(ComputerDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Laptop
|
|
|
|
|
|
|
|
|
|
|
|
class ServerDef(ComputerDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Server
|
|
|
|
|
|
|
|
|
|
|
|
class MonitorDef(DeviceDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Monitor
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2018-10-16 06:46:55 +00:00
|
|
|
|
2018-10-04 08:59:31 +00:00
|
|
|
|
|
|
|
class ComputerMonitorDef(MonitorDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.ComputerMonitor
|
|
|
|
|
|
|
|
|
|
|
|
class TelevisionSetDef(MonitorDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.TelevisionSet
|
|
|
|
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
class ProjectorDef(MonitorDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Projector
|
|
|
|
|
|
|
|
|
2018-10-04 08:59:31 +00:00
|
|
|
class MobileDef(DeviceDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Mobile
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2018-10-16 06:46:55 +00:00
|
|
|
|
2018-10-04 08:59:31 +00:00
|
|
|
|
|
|
|
class SmartphoneDef(MobileDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Smartphone
|
|
|
|
|
|
|
|
|
|
|
|
class TabletDef(MobileDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Tablet
|
|
|
|
|
|
|
|
|
|
|
|
class CellphoneDef(MobileDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Cellphone
|
|
|
|
|
|
|
|
|
|
|
|
class ComponentDef(DeviceDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Component
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2018-10-16 06:46:55 +00:00
|
|
|
|
2018-10-04 08:59:31 +00:00
|
|
|
|
|
|
|
class GraphicCardDef(ComponentDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.GraphicCard
|
|
|
|
|
|
|
|
|
|
|
|
class DataStorageDef(ComponentDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.DataStorage
|
|
|
|
|
|
|
|
|
|
|
|
class HardDriveDef(DataStorageDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.HardDrive
|
|
|
|
|
|
|
|
|
|
|
|
class SolidStateDriveDef(DataStorageDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.SolidStateDrive
|
|
|
|
|
|
|
|
|
|
|
|
class MotherboardDef(ComponentDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Motherboard
|
|
|
|
|
|
|
|
|
|
|
|
class NetworkAdapterDef(ComponentDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.NetworkAdapter
|
|
|
|
|
|
|
|
|
|
|
|
class RamModuleDef(ComponentDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.RamModule
|
|
|
|
|
|
|
|
|
|
|
|
class ProcessorDef(ComponentDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Processor
|
|
|
|
|
|
|
|
|
|
|
|
class SoundCardDef(ComponentDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.SoundCard
|
|
|
|
|
|
|
|
|
|
|
|
class DisplayDef(ComponentDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Display
|
|
|
|
|
|
|
|
|
2019-06-29 14:26:14 +00:00
|
|
|
class BatteryDef(ComponentDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Battery
|
|
|
|
|
|
|
|
|
2019-07-01 18:39:32 +00:00
|
|
|
class CameraDef(ComponentDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Camera
|
|
|
|
|
|
|
|
|
2018-10-23 13:37:37 +00:00
|
|
|
class ComputerAccessoryDef(DeviceDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.ComputerAccessory
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class MouseDef(ComputerAccessoryDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Mouse
|
|
|
|
|
|
|
|
|
|
|
|
class KeyboardDef(ComputerAccessoryDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Keyboard
|
|
|
|
|
|
|
|
|
|
|
|
class SAIDef(ComputerAccessoryDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.SAI
|
|
|
|
|
|
|
|
|
|
|
|
class MemoryCardReaderDef(ComputerAccessoryDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.MemoryCardReader
|
|
|
|
|
|
|
|
|
|
|
|
class NetworkingDef(DeviceDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Networking
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class RouterDef(NetworkingDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Router
|
|
|
|
|
|
|
|
|
|
|
|
class SwitchDef(NetworkingDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Switch
|
|
|
|
|
|
|
|
|
|
|
|
class HubDef(NetworkingDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Hub
|
|
|
|
|
|
|
|
|
|
|
|
class WirelessAccessPointDef(NetworkingDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.WirelessAccessPoint
|
|
|
|
|
|
|
|
|
|
|
|
class PrinterDef(DeviceDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Printer
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class LabelPrinterDef(PrinterDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.LabelPrinter
|
|
|
|
|
|
|
|
|
|
|
|
class SoundDef(DeviceDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Sound
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class MicrophoneDef(SoundDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Microphone
|
|
|
|
|
|
|
|
|
|
|
|
class VideoDef(DeviceDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Video
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class VideoScalerDef(VideoDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.VideoScaler
|
|
|
|
|
|
|
|
|
|
|
|
class VideoconferenceDef(VideoDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Videoconference
|
|
|
|
|
|
|
|
|
2018-11-12 10:59:49 +00:00
|
|
|
class CookingDef(DeviceDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Cooking
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2018-11-12 10:59:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Mixer(CookingDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Mixer
|
|
|
|
|
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class DIYAndGardeningDef(DeviceDef):
|
2019-07-01 18:39:32 +00:00
|
|
|
VIEW = None
|
2019-07-07 19:36:09 +00:00
|
|
|
SCHEMA = schemas.DIYAndGardening
|
2019-07-01 18:39:32 +00:00
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2019-07-02 08:42:56 +00:00
|
|
|
|
2019-07-01 18:39:32 +00:00
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class DrillDef(DIYAndGardeningDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Drill
|
|
|
|
|
|
|
|
|
|
|
|
class PackOfScrewdriversDef(DIYAndGardeningDef):
|
2019-07-01 18:39:32 +00:00
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.PackOfScrewdrivers
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2019-07-02 08:42:56 +00:00
|
|
|
|
2019-07-01 18:39:32 +00:00
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class HomeDef(DeviceDef):
|
2019-07-01 18:39:32 +00:00
|
|
|
VIEW = None
|
2019-07-07 19:36:09 +00:00
|
|
|
SCHEMA = schemas.Home
|
2019-07-01 18:39:32 +00:00
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2019-07-02 08:42:56 +00:00
|
|
|
|
2019-07-01 18:39:32 +00:00
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class DehumidifierDef(HomeDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Dehumidifier
|
|
|
|
|
|
|
|
|
|
|
|
class StairsDef(HomeDef):
|
2019-07-01 18:39:32 +00:00
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Stairs
|
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
|
|
|
|
class RecreationDef(DeviceDef):
|
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Recreation
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2019-07-02 08:42:56 +00:00
|
|
|
|
2019-07-01 18:39:32 +00:00
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class BikeDef(RecreationDef):
|
2019-07-01 18:39:32 +00:00
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Bike
|
|
|
|
|
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class RacketDef(RecreationDef):
|
2019-07-01 18:39:32 +00:00
|
|
|
VIEW = None
|
|
|
|
SCHEMA = schemas.Racket
|
|
|
|
|
|
|
|
|
2018-10-04 08:59:31 +00:00
|
|
|
class ManufacturerDef(Resource):
|
|
|
|
VIEW = ManufacturerView
|
|
|
|
SCHEMA = schemas.Manufacturer
|
|
|
|
AUTH = True
|
|
|
|
|
2019-01-21 15:08:55 +00:00
|
|
|
def init_db(self, db: 'db.SQLAlchemy', exclude_schema=None):
|
2018-10-04 08:59:31 +00:00
|
|
|
"""Loads the manufacturers to the database."""
|
2019-01-21 15:08:55 +00:00
|
|
|
if exclude_schema != 'common':
|
|
|
|
Manufacturer.add_all_to_session(db.session)
|
2022-11-29 15:49:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
class OtherDef(DeviceDef):
|
|
|
|
VIEW = None
|
2022-11-29 16:46:41 +00:00
|
|
|
SCHEMA = schemas.Computer
|
2022-11-29 15:49:23 +00:00
|
|
|
SCHEMA = schemas.Other
|
2022-11-29 16:46:41 +00:00
|
|
|
|
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder=None,
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder=None,
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|