Skip to content

Commit

Permalink
Refactor VergunningenV2 documents endpoint to decos endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
TerryvanWalen committed Feb 3, 2025
1 parent 216c922 commit d6aff49
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 18 deletions.
7 changes: 3 additions & 4 deletions src/server/routing/bff-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ export const BffEndpoints = {
'/services/stadspas/transactions/:transactionsKeyEncrypted?',
STADSPAS_BLOCK_PASS: '/services/stadspas/block/:transactionsKeyEncrypted',

// Vergunningen V2
VERGUNNINGENv2_DOCUMENTS_LIST: `/services/vergunningen/v2/documents`,
VERGUNNINGENv2_DOCUMENT_DOWNLOAD:
'/services/vergunningen/v2/documents/download',
// Decos
DECOS_DOCUMENTS_LIST: `/services/decos/documents`,
DECOS_DOCUMENT_DOWNLOAD: '/services/decos/documents/download',

// Vergunningen / Koppel api
VERGUNNINGEN_DOCUMENT_DOWNLOAD:
Expand Down
11 changes: 4 additions & 7 deletions src/server/routing/router-protected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
import { attachDocumentDownloadRoute } from '../services/shared/document-download-route-handler';
import { fetchErfpachtV2DossiersDetail } from '../services/simple-connect/erfpacht';
import { fetchBBDocument } from '../services/toeristische-verhuur/toeristische-verhuur-powerbrowser-bb-vergunning';
import { fetchVergunningDocumentsList } from '../services/vergunningen-v2/vergunningen-route-handlers';
import { fetchDecosDocumentsList } from '../services/vergunningen-v2/vergunningen-route-handlers';
import { fetchZorgnedJZDDocument } from '../services/wmo/wmo-route-handlers';
import { fetchWpiDocument } from '../services/wpi/api-service';

Expand Down Expand Up @@ -156,15 +156,12 @@ router.get(
}
);

// Vergunningen V2
router.get(
BffEndpoints.VERGUNNINGENv2_DOCUMENTS_LIST,
fetchVergunningDocumentsList
);
// Decos (Vergunningen, Horeca, Toeristische verhuur, Parkeren)
router.get(BffEndpoints.DECOS_DOCUMENTS_LIST, fetchDecosDocumentsList);

attachDocumentDownloadRoute(
router,
BffEndpoints.VERGUNNINGENv2_DOCUMENT_DOWNLOAD,
BffEndpoints.DECOS_DOCUMENT_DOWNLOAD,
fetchDecosDocument
);

Expand Down
2 changes: 1 addition & 1 deletion src/server/services/decos/decos-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ export function transformDecosZaakFrontend<T extends DecosZaakBase>(
steps: [],
// Adds an url with encrypted id to the BFF Detail page api for zaken.
fetchDocumentsUrl: generateFullApiUrlBFF(
BffEndpoints.VERGUNNINGENv2_DOCUMENTS_LIST,
BffEndpoints.DECOS_DOCUMENTS_LIST,
[{ id: idEncrypted }]
),
link: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect, vi, Mock } from 'vitest';

import { fetchVergunningDocumentsList } from './vergunningen-route-handlers';
import { fetchDecosDocumentsList } from './vergunningen-route-handlers';
import {
getAuthProfileAndToken,
RequestMock,
Expand Down Expand Up @@ -58,7 +58,7 @@ describe('fetchVergunningDocumentsList', () => {

const res = ResponseMock.new();

await fetchVergunningDocumentsList(
await fetchDecosDocumentsList(
req as RequestWithQueryParams<{ id: string }>,
res
);
Expand All @@ -75,7 +75,7 @@ describe('fetchVergunningDocumentsList', () => {

const res = ResponseMock.new();

await fetchVergunningDocumentsList(
await fetchDecosDocumentsList(
req as RequestWithQueryParams<{ id: string }>,
res
);
Expand All @@ -99,7 +99,7 @@ describe('fetchVergunningDocumentsList', () => {

const res = ResponseMock.new();

await fetchVergunningDocumentsList(
await fetchDecosDocumentsList(
req as RequestWithQueryParams<{ id: string }>,
res
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { fetchDecosDocumentList } from '../decos/decos-service';
import { DecosZaakBase } from '../decos/decos-types';
import { decryptEncryptedRouteParamAndValidateSessionID } from '../shared/decrypt-route-param';

export async function fetchVergunningDocumentsList(
export async function fetchDecosDocumentsList(
req: RequestWithQueryParams<{ id: string }>,
res: Response
) {
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/vergunningen-v2/vergunningen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function addEncryptedDocumentDownloadUrl(
return {
...document,
// Adds an url to the BFF api for document download which accepts an encrypted ID only
url: generateFullApiUrlBFF(BffEndpoints.VERGUNNINGENv2_DOCUMENT_DOWNLOAD, [
url: generateFullApiUrlBFF(BffEndpoints.DECOS_DOCUMENT_DOWNLOAD, [
{ id: documentIdEncrypted },
]),
};
Expand Down

0 comments on commit d6aff49

Please sign in to comment.