From ed43bd477c179f3916fd3ceb20af18485ccdbe8e Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 6 Aug 2021 11:08:58 +0200 Subject: [PATCH] we only need the data files --- .../migrations/versions/7ecb8ff7abad_documents.py | 2 +- ereuse_devicehub/resources/documents/models.py | 4 ++-- ereuse_devicehub/resources/documents/schemas.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ereuse_devicehub/migrations/versions/7ecb8ff7abad_documents.py b/ereuse_devicehub/migrations/versions/7ecb8ff7abad_documents.py index e111580d..087f272c 100644 --- a/ereuse_devicehub/migrations/versions/7ecb8ff7abad_documents.py +++ b/ereuse_devicehub/migrations/versions/7ecb8ff7abad_documents.py @@ -45,7 +45,7 @@ def upgrade(): sa.Column('owner_id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('file_name', sa.Unicode(), nullable=False), sa.Column('file_hash', sa.Unicode(), nullable=False), - sa.Column('url', sa.Unicode(), nullable=False), + sa.Column('url', sa.Unicode(), nullable=True), sa.ForeignKeyConstraint(['owner_id'], ['common.user.id'], ), sa.PrimaryKeyConstraint('id'), diff --git a/ereuse_devicehub/resources/documents/models.py b/ereuse_devicehub/resources/documents/models.py index fc24f190..ee2ac071 100644 --- a/ereuse_devicehub/resources/documents/models.py +++ b/ereuse_devicehub/resources/documents/models.py @@ -31,7 +31,7 @@ class Document(Thing): file_name.comment = """This is the name of the file when user up the document.""" file_hash = Column(db.CIText(), nullable=False) file_hash.comment = """This is the hash of the file produced from frontend.""" - url = db.Column(URL(), nullable=False) + url = db.Column(URL(), nullable=True) url.comment = """This is the url where resides the document.""" def __str__(self) -> str: @@ -50,7 +50,7 @@ class DataWipeDocument(JoinedTableMixin, Document): software = Column(CIText(), nullable=True) software.comment = """Which software is used""" - success = Column(Boolean) + success = Column(Boolean, default=False) success.comment = """If the erase was success""" def __str__(self) -> str: diff --git a/ereuse_devicehub/resources/documents/schemas.py b/ereuse_devicehub/resources/documents/schemas.py index 7129dc50..c9df245f 100644 --- a/ereuse_devicehub/resources/documents/schemas.py +++ b/ereuse_devicehub/resources/documents/schemas.py @@ -8,8 +8,8 @@ class DataWipeDocument(Thing): __doc__ = m.DataWipeDocument.__doc__ id = Integer(description=m.DataWipeDocument.id.comment, dump_only=True) type = SanitizedStr(default='DataWipeDocument') - url = URL(description=m.DataWipeDocument.url.comment) - success = Boolean(description=m.DataWipeDocument.success.comment) + url = URL(required= False, description=m.DataWipeDocument.url.comment) + success = Boolean(required=False, default=False, description=m.DataWipeDocument.success.comment) software = SanitizedStr(description=m.DataWipeDocument.software.comment) date = DateTime(data_key='endTime', required=False,