Skip to content

Commit 131d52d

Browse files
add version number to document put
1 parent ba5f5b3 commit 131d52d

File tree

7 files changed

+12
-4
lines changed

7 files changed

+12
-4
lines changed

app/src/components/blocks/_documentUpload/documentSelectStage/DocumentSelectStage.test.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import { JSX, useRef, useState } from 'react';
88
import * as ReactRouter from 'react-router-dom';
99
import usePatient from '../../../../helpers/hooks/usePatient';
1010
import { buildLgFile, buildPatientDetails } from '../../../../helpers/test/testBuilders';
11-
import {
12-
PDF_PARSING_ERROR_TYPE,
13-
} from '../../../../helpers/utils/fileUploadErrorMessages';
11+
import { PDF_PARSING_ERROR_TYPE } from '../../../../helpers/utils/fileUploadErrorMessages';
1412
import { getFormattedDate } from '../../../../helpers/utils/formatDate';
1513
import { formatNhsNumber } from '../../../../helpers/utils/formatNhsNumber';
1614
import { routeChildren, routes } from '../../../../types/generic/routes';

app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ function LloydGeorgeViewRecordStage({
111111

112112
const fileName = searchResults[0].fileName;
113113
const documentId = searchResults[0].id;
114+
const versionId = searchResults[0].version;
114115

115116
const response = await fetch(pdfObjectUrl);
116117
const blob = await response.blob();
@@ -120,7 +121,10 @@ function LloydGeorgeViewRecordStage({
120121
search: createSearchParams({ journey: 'update' }).toString(),
121122
};
122123
const options: NavigateOptions = {
123-
state: { journey: 'update', existingDocuments: [{ fileName, blob, documentId }] },
124+
state: {
125+
journey: 'update',
126+
existingDocuments: [{ fileName, blob, documentId, versionId }],
127+
},
124128
};
125129
navigate(to, options);
126130
};

app/src/helpers/requests/uploadDocuments.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ const uploadDocuments = async ({
104104
contentType: doc.file.type,
105105
docType: doc.docType,
106106
clientId: doc.id,
107+
versionId: doc.versionId,
107108
})),
108109
},
109110
],

app/src/pages/documentUploadPage/DocumentUploadPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type LocationState = {
5252
blob: Blob | null;
5353
fileName: string | null;
5454
documentId?: string | null;
55+
versionId: string;
5556
},
5657
];
5758
};
@@ -103,6 +104,7 @@ const DocumentUploadPage = (): React.JSX.Element => {
103104
state: DOCUMENT_UPLOAD_STATE.SELECTED,
104105
docType: DOCUMENT_TYPE.LLOYD_GEORGE,
105106
progress: 0,
107+
versionId: doc.versionId,
106108
}) as UploadDocument,
107109
) ?? [];
108110

app/src/types/generic/searchResult.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export type SearchResult = {
44
virusScannerResult: string;
55
id: string;
66
fileSize: number;
7+
version: string;
78
};

app/src/types/pages/UploadDocumentsPage/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export type UploadDocument = {
4747
error?: UPLOAD_FILE_ERROR_TYPE;
4848
errorCode?: string;
4949
validated?: boolean;
50+
versionId?: string;
5051
};
5152

5253
export type SearchResult = {

lambdas/services/document_reference_search_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ def _build_document_model(self, document: DocumentReference) -> dict:
175175
"created",
176176
"virus_scanner_result",
177177
"file_size",
178+
"version"
178179
},
179180
)
180181
return document_formatted

0 commit comments

Comments
 (0)