diff --git a/lambdas/enums/metadata_field_names.py b/lambdas/enums/metadata_field_names.py index c0bb7952e..d170fb262 100755 --- a/lambdas/enums/metadata_field_names.py +++ b/lambdas/enums/metadata_field_names.py @@ -12,7 +12,8 @@ class DocumentReferenceMetadataFields(Enum): TTL = "TTL" TYPE = "Type" VIRUS_SCANNER_RESULT = "VirusScannerResult" - CURRENT_GP_ODS = "CurrentGpOds" + CURRENT_GP_ODS = "CurrentGpOds", + UPLOADED = 'Uploaded' @staticmethod def list() -> list[str]: diff --git a/lambdas/models/document_reference.py b/lambdas/models/document_reference.py index faaef22c6..48d89e8b3 100644 --- a/lambdas/models/document_reference.py +++ b/lambdas/models/document_reference.py @@ -42,6 +42,10 @@ class DocumentReference(BaseModel): alias=str(DocumentReferenceMetadataFields.CURRENT_GP_ODS.value), default=None ) + uploaded: str = Field( + alias=str(DocumentReferenceMetadataFields.UPLOADED.value), default=False + ) + def get_file_name_path(self): return pathlib.Path(self.file_name) diff --git a/lambdas/models/nhs_document_reference.py b/lambdas/models/nhs_document_reference.py index 7699ff38f..e5d44ff23 100644 --- a/lambdas/models/nhs_document_reference.py +++ b/lambdas/models/nhs_document_reference.py @@ -30,6 +30,7 @@ def __init__( self.deleted = "" self.virus_scanner_result = "Not Scanned" self.file_location = f"s3://{self.s3_bucket_name}/{self.s3_file_key}" + self.uploaded = False def set_deleted(self) -> None: self.deleted = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S.%fZ") @@ -51,6 +52,7 @@ def to_dict(self): DocumentReferenceMetadataFields.CONTENT_TYPE.value: self.content_type, DocumentReferenceMetadataFields.VIRUS_SCANNER_RESULT.value: self.virus_scanner_result, DocumentReferenceMetadataFields.CURRENT_GP_ODS.value: self.current_gp_ods, + DocumentReferenceMetadataFields.UPLOADED.value: self.uploaded, } return document_metadata diff --git a/lambdas/tests/unit/enums/test_metadata_field_names.py b/lambdas/tests/unit/enums/test_metadata_field_names.py index e30172f94..0fe7b82f8 100755 --- a/lambdas/tests/unit/enums/test_metadata_field_names.py +++ b/lambdas/tests/unit/enums/test_metadata_field_names.py @@ -8,7 +8,8 @@ def test_can_get_one_field_name(): def test_returns_all_as_list(): subject = DocumentReferenceMetadataFields.list() - assert len(subject) == 11 + print(subject) + assert len(subject) == 12 assert DocumentReferenceMetadataFields.ID.value in subject assert DocumentReferenceMetadataFields.CONTENT_TYPE.value in subject assert DocumentReferenceMetadataFields.CREATED.value in subject @@ -20,3 +21,4 @@ def test_returns_all_as_list(): assert DocumentReferenceMetadataFields.TTL.value in subject assert DocumentReferenceMetadataFields.VIRUS_SCANNER_RESULT.value in subject assert DocumentReferenceMetadataFields.CURRENT_GP_ODS.value in subject + assert DocumentReferenceMetadataFields.UPLOADED.value in subject