Skip to content

Commit

Permalink
Merge branch 'master' into DTSCCI-1440
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudha-deshpande authored Jan 16, 2025
2 parents 4eb9bbc + 0bbabc3 commit 794e182
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import multer from 'multer';
import { UploadAdditionalDocument } from 'common/models/generalApplication/UploadAdditionalDocument';
import { generateRedisKey } from 'modules/draft-store/draftStoreService';
import { constructResponseUrlWithIdAndAppIdParams } from 'common/utils/urlFormatter';
import { getCancelUrl } from 'services/features/generalApplication/generalApplicationService';
import {getApplicationIndex, getCancelUrl} from 'services/features/generalApplication/generalApplicationService';
import { getClaimDetailsById, getSummaryList, removeSelectedDocument, uploadSelectedFile } from 'services/features/generalApplication/additionalDocumentService';

const uploadAdditionalDocumentsController = Router();
Expand Down Expand Up @@ -39,7 +39,8 @@ uploadAdditionalDocumentsController.get(GA_UPLOAD_ADDITIONAL_DOCUMENTS_URL, (asy
await removeSelectedDocument(redisKey, claim, Number(index) - 1);
}
const cancelUrl = await getCancelUrl(id, claim);
const backLinkUrl = constructResponseUrlWithIdAndAppIdParams(id,gaId, GA_VIEW_APPLICATION_URL);
const index = await getApplicationIndex(id, gaId, req);
const backLinkUrl = `${constructResponseUrlWithIdAndAppIdParams(id, gaId, GA_VIEW_APPLICATION_URL)}?index=${index + 1}`;
const formattedSummary = getSummaryList(gaDetails.uploadAdditionalDocuments, id, gaId, lng);
res.render(viewPath, { cancelUrl, backLinkUrl, form, formattedSummary });
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import {NextFunction, RequestHandler, Response, Router} from 'express';
import {
GA_RESPONSE_VIEW_APPLICATION_URL,
GA_UPLOAD_DOCUMENT_DIRECTIONS_ORDER_CYA_URL,
GA_UPLOAD_DOCUMENT_DIRECTIONS_ORDER_URL,
GA_UPLOAD_DOCUMENT_DIRECTIONS_ORDER_URL, GA_VIEW_APPLICATION_URL,
} from 'routes/urls';
import {AppRequest} from 'models/AppRequest';
import {GenericForm} from 'form/models/genericForm';
Expand All @@ -12,7 +11,7 @@ import {
getCancelUrl,
} from 'services/features/generalApplication/generalApplicationService';
import {getClaimById} from 'modules/utilityService';
import {constructResponseUrlWithIdAndAppIdParams, constructResponseUrlWithIdParams} from 'common/utils/urlFormatter';
import {constructResponseUrlWithIdAndAppIdParams} from 'common/utils/urlFormatter';
import multer from 'multer';
import {generateRedisKeyForGA} from 'modules/draft-store/draftStoreService';
import {UploadGAFiles} from 'models/generalApplication/uploadGAFiles';
Expand All @@ -39,7 +38,7 @@ const upload = multer({
async function renderView(form: GenericForm<UploadGAFiles>, claim: Claim, claimId: string, gaId: string, req: AppRequest, res: Response, formattedSummary: SummarySection): Promise<void> {
const cancelUrl = await getCancelUrl(claimId, claim);
const currentUrl = constructResponseUrlWithIdAndAppIdParams(claimId, gaId, GA_UPLOAD_DOCUMENT_DIRECTIONS_ORDER_URL);
const backLinkUrl = `${constructResponseUrlWithIdParams(claimId, GA_RESPONSE_VIEW_APPLICATION_URL)}?applicationId=${gaId}&index=1`;
const backLinkUrl = `${constructResponseUrlWithIdAndAppIdParams(claimId,gaId, GA_VIEW_APPLICATION_URL)}?applicationId=${gaId}&index=1`;
const applicationResponse = await getApplicationFromGAService(req, gaId);
const directionOrderDocUrl = getDirectionOrderDocumentUrl(claimId, applicationResponse);
res.render(viewPath, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jest.mock('../../../../../../../main/modules/draft-store/draftStoreService', ()

jest.mock('../../../../../../../main/services/features/generalApplication/generalApplicationService', () => ({
getCancelUrl: jest.fn(),
getApplicationIndex: jest.fn(),
}));

describe('uploadAdditionalDocumentsController', () => {
Expand Down

0 comments on commit 794e182

Please sign in to comment.