diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index 062acfd2..4b3ac8c3 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -489,7 +489,10 @@ class DataStorage(JoinedComponentTableMixin, Component): @property def privacy(self): - """Returns the privacy compliance state of the data storage.""" + """Returns the privacy compliance state of the data storage. + + This is, the last erasure performed to the data storage. + """ from ereuse_devicehub.resources.event.models import EraseBasic try: ev = self.last_event_of(EraseBasic) diff --git a/ereuse_devicehub/resources/device/views.py b/ereuse_devicehub/resources/device/views.py index 0eead26c..1ec1736a 100644 --- a/ereuse_devicehub/resources/device/views.py +++ b/ereuse_devicehub/resources/device/views.py @@ -62,6 +62,7 @@ class Filters(query.Query): class Sorting(query.Sort): id = query.SortField(Device.id) created = query.SortField(Device.created) + updated = query.SortField(Device.updated) class DeviceView(View): diff --git a/ereuse_devicehub/resources/event/schemas.py b/ereuse_devicehub/resources/event/schemas.py index b32f2dec..3f100bab 100644 --- a/ereuse_devicehub/resources/event/schemas.py +++ b/ereuse_devicehub/resources/event/schemas.py @@ -75,6 +75,7 @@ class Deallocate(EventWithMultipleDevices): class EraseBasic(EventWithOneDevice): steps = NestedOn('Step', many=True) standards = f.List(EnumField(enums.ErasureStandards), dump_only=True) + certificate = URL(dump_only=True) class EraseSectors(EraseBasic): diff --git a/ereuse_devicehub/resources/lot/models.py b/ereuse_devicehub/resources/lot/models.py index a8615358..baebd05b 100644 --- a/ereuse_devicehub/resources/lot/models.py +++ b/ereuse_devicehub/resources/lot/models.py @@ -75,6 +75,10 @@ class Lot(Thing): super().__init__(id=uuid.uuid4(), name=name, closed=closed, description=description) Path(self) # Lots have always one edge per default. + @property + def type(self) -> str: + return self.__class__.__name__ + @property def url(self) -> urlutils.URL: """The URL where to GET this event.""" diff --git a/ereuse_devicehub/resources/tag/model.py b/ereuse_devicehub/resources/tag/model.py index a4692f6e..85b7d68e 100644 --- a/ereuse_devicehub/resources/tag/model.py +++ b/ereuse_devicehub/resources/tag/model.py @@ -89,6 +89,10 @@ class Tag(Thing): UniqueConstraint(secondary, org_id, name='one secondary tag per organization') ) + @property + def type(self) -> str: + return self.__class__.__name__ + def __repr__(self) -> str: return ''.format(self)