Making API more uniform
This commit is contained in:
parent
a1c312edcd
commit
710432ef12
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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."""
|
||||
|
|
|
@ -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 '<Tag {0.id} org:{0.org_id} device:{0.device_id}>'.format(self)
|
||||
|
||||
|
|
Reference in a new issue