Skip to content

Commit

Permalink
adds fileSize to document reference
Browse files Browse the repository at this point in the history
  • Loading branch information
SuttonMashing committed Dec 13, 2024
1 parent 168301b commit 6fee95f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<SearchResult>;
Expand Down Expand Up @@ -108,6 +109,7 @@ const AvailableFilesTable = ({
)}
<Table.Cell className={'table-column-header'}>Filename</Table.Cell>
<Table.Cell className={'table-column-header'}>Upload date</Table.Cell>
<Table.Cell className={'table-column-header'}>File Size</Table.Cell>
</Table.Row>
</Table.Head>
<Table.Body>
Expand Down Expand Up @@ -147,6 +149,12 @@ const AvailableFilesTable = ({
>
{getFormattedDatetime(new Date(result.created))}
</Table.Cell>
<Table.Cell
id={'available-files-row-' + index + '-file-size'}
data-testid="file-size"
>
{result.fileSize}
</Table.Cell>
</Table.Row>
))}
</Table.Body>
Expand Down
1 change: 1 addition & 0 deletions app/src/helpers/test/testBuilders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ const buildSearchResult = (searchResultOverride?: Partial<SearchResult>) => {
created: moment().format(),
virusScannerResult: 'Clean',
ID: '1234qwer-241ewewr',
fileSize: 224,
...searchResultOverride,
};
return result;
Expand Down
1 change: 1 addition & 0 deletions app/src/types/generic/searchResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export type SearchResult = {
created: string;
virusScannerResult: string;
ID: string;
fileSize: number;
};
1 change: 1 addition & 0 deletions lambdas/models/document_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6fee95f

Please sign in to comment.