From 6fee95fc63e322ad0b925d8f146796607ebb0015 Mon Sep 17 00:00:00 2001 From: Jack Sutton Date: Fri, 13 Dec 2024 15:56:55 +0000 Subject: [PATCH] adds fileSize to document reference --- .../LloydGeorgeSelectSearchResults.tsx | 8 ++++++++ app/src/helpers/test/testBuilders.ts | 1 + app/src/types/generic/searchResult.ts | 1 + lambdas/models/document_reference.py | 1 + 4 files changed, 11 insertions(+) diff --git a/app/src/components/blocks/_lloydGeorge/lloydGeorgeSelectSearchResults/LloydGeorgeSelectSearchResults.tsx b/app/src/components/blocks/_lloydGeorge/lloydGeorgeSelectSearchResults/LloydGeorgeSelectSearchResults.tsx index 8a7da7ecc..cc9ce9653 100644 --- a/app/src/components/blocks/_lloydGeorge/lloydGeorgeSelectSearchResults/LloydGeorgeSelectSearchResults.tsx +++ b/app/src/components/blocks/_lloydGeorge/lloydGeorgeSelectSearchResults/LloydGeorgeSelectSearchResults.tsx @@ -8,6 +8,7 @@ import { SEARCH_AND_DOWNLOAD_STATE } from '../../../../types/pages/documentSearc import ErrorBox from '../../../layout/errorBox/ErrorBox'; import PatientSummary from '../../../generic/patientSummary/PatientSummary'; import BackButton from '../../../generic/backButton/BackButton'; +import formatFileSize from '../../../../helpers/utils/formatFileSize'; export type Props = { searchResults: Array; @@ -108,6 +109,7 @@ const AvailableFilesTable = ({ )} Filename Upload date + File Size @@ -147,6 +149,12 @@ const AvailableFilesTable = ({ > {getFormattedDatetime(new Date(result.created))} + + {result.fileSize} + ))} diff --git a/app/src/helpers/test/testBuilders.ts b/app/src/helpers/test/testBuilders.ts index b73100c67..53523f93c 100644 --- a/app/src/helpers/test/testBuilders.ts +++ b/app/src/helpers/test/testBuilders.ts @@ -123,6 +123,7 @@ const buildSearchResult = (searchResultOverride?: Partial) => { created: moment().format(), virusScannerResult: 'Clean', ID: '1234qwer-241ewewr', + fileSize: 224, ...searchResultOverride, }; return result; diff --git a/app/src/types/generic/searchResult.ts b/app/src/types/generic/searchResult.ts index 769d93871..9225ba18e 100644 --- a/app/src/types/generic/searchResult.ts +++ b/app/src/types/generic/searchResult.ts @@ -3,4 +3,5 @@ export type SearchResult = { created: string; virusScannerResult: string; ID: string; + fileSize: number; }; diff --git a/lambdas/models/document_reference.py b/lambdas/models/document_reference.py index ff1b164d2..22f262b9f 100644 --- a/lambdas/models/document_reference.py +++ b/lambdas/models/document_reference.py @@ -45,6 +45,7 @@ class DocumentReference(BaseModel): uploaded: bool uploading: bool last_updated: int + file_size: int def get_file_name_path(self): return pathlib.Path(self.file_name)