From 91f5fa4e75248af98456e463d8fff758d9344b62 Mon Sep 17 00:00:00 2001 From: emmdim Date: Wed, 11 Dec 2019 00:35:17 +0100 Subject: [PATCH] Adds deposit field in Computer --- ereuse_devicehub/resources/device/models.py | 3 ++- ereuse_devicehub/resources/device/models.pyi | 1 + ereuse_devicehub/resources/device/schemas.py | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index 26298909..4d809f80 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -375,9 +375,10 @@ class Computer(Device): id = Column(BigInteger, ForeignKey(Device.id), primary_key=True) chassis = Column(DBEnum(ComputerChassis), nullable=False) chassis.comment = """The physical form of the computer. - + It is a subset of the Linux definition of DMI / DMI decode. """ + deposit = Column(Integer, check_range('deposit',min=0,max=100), default=0) def __init__(self, chassis, **kwargs) -> None: chassis = ComputerChassis(chassis) diff --git a/ereuse_devicehub/resources/device/models.pyi b/ereuse_devicehub/resources/device/models.pyi index fe4e47e3..5e75b933 100644 --- a/ereuse_devicehub/resources/device/models.pyi +++ b/ereuse_devicehub/resources/device/models.pyi @@ -141,6 +141,7 @@ class DisplayMixin: class Computer(DisplayMixin, Device): components = ... # type: Column chassis = ... # type: Column + deposit = ... # type: Column def __init__(self, **kwargs) -> None: super().__init__(**kwargs) diff --git a/ereuse_devicehub/resources/device/schemas.py b/ereuse_devicehub/resources/device/schemas.py index 6fc4c1a5..14c34fef 100644 --- a/ereuse_devicehub/resources/device/schemas.py +++ b/ereuse_devicehub/resources/device/schemas.py @@ -121,7 +121,9 @@ class Computer(Device): dump_only=True, collection_class=set, description=m.Computer.privacy.__doc__) - + deposit = Integer(dump_only=True, + data_key='deposit', + description=m.Computer.deposit.__doc__) class Desktop(Computer): __doc__ = m.Desktop.__doc__