From 34f63d3f1e3fd9e65c4acd6a97bec22f902e8412 Mon Sep 17 00:00:00 2001 From: Nils Ove Tendenes Date: Wed, 8 Jan 2025 14:15:38 +0100 Subject: [PATCH] chore: use new backend in data-service-catalog --- apps/catalog-portal/.env.serve.e2e | 1 + apps/catalog-portal/app/actions/actions.ts | 2 +- .../data-service-catalog-frontend-env.yaml | 4 ++-- .../data-service-catalog-frontend-env.yaml | 4 ++-- .../data-service-catalog-frontend-env.yaml | 4 ++-- .../src/lib/data-service/api/index.ts | 22 ++++++++++++++----- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/apps/catalog-portal/.env.serve.e2e b/apps/catalog-portal/.env.serve.e2e index 9ffc89cf7..fc106943d 100644 --- a/apps/catalog-portal/.env.serve.e2e +++ b/apps/catalog-portal/.env.serve.e2e @@ -14,6 +14,7 @@ CONCEPT_CATALOG_BASE_URI=https://catalog-portal.staging.fellesdatakatalog.digdir CONCEPT_CATALOG_FRONTEND=https://begrepskatalog.staging.fellesdatakatalog.digdir.no DATASET_CATALOG_BASE_URI=https://dataset-catalog.staging.fellesdatakatalog.digdir.no DATASERVICE_CATALOG_BASE_URI=https://dataservice-catalog.staging.fellesdatakatalog.digdir.no +DATA_SERVICE_CATALOG_BASE_URI=https://data-service-catalog.api.staging.fellesdatakatalog.digdir.no CONCEPT_CATALOG_BASE_URI=https://concept-catalog.staging.fellesdatakatalog.digdir.no RECORDS_OF_PROCESSING_ACTIVITIES_GUI_BASE_URI=https://registrering-protokoll.staging.fellesdatakatalog.digdir.no SERVICE_CATALOG_BASE_URI=https://service-catalog.api.staging.fellesdatakatalog.digdir.no diff --git a/apps/catalog-portal/app/actions/actions.ts b/apps/catalog-portal/app/actions/actions.ts index 632729661..206f6adb2 100644 --- a/apps/catalog-portal/app/actions/actions.ts +++ b/apps/catalog-portal/app/actions/actions.ts @@ -2,7 +2,7 @@ import { getAllDatasetCatalogs, - getAllDataServiceCatalogs, + oldGetAllDataServiceCatalogs as getAllDataServiceCatalogs, getAllConceptCatalogs, getAllServiceCatalogs, getAllProcessingActivities, diff --git a/deploy/demo/data-service-catalog-frontend/data-service-catalog-frontend-env.yaml b/deploy/demo/data-service-catalog-frontend/data-service-catalog-frontend-env.yaml index cad0a1235..5a73529b8 100644 --- a/deploy/demo/data-service-catalog-frontend/data-service-catalog-frontend-env.yaml +++ b/deploy/demo/data-service-catalog-frontend/data-service-catalog-frontend-env.yaml @@ -70,11 +70,11 @@ spec: secretKeyRef: name: commonurl-demo key: DATA_SERVICE_CATALOG_FRONTEND - - name: DATASERVICE_CATALOG_BASE_URI + - name: DATA_SERVICE_CATALOG_BASE_URI valueFrom: secretKeyRef: name: commonurl-demo - key: DATASERVICE_CATALOG_BASE_URI + key: DATA_SERVICE_CATALOG_BASE_URI - name: CATALOG_PORTAL_BASE_URI valueFrom: secretKeyRef: diff --git a/deploy/prod/data-service-catalog-frontend/data-service-catalog-frontend-env.yaml b/deploy/prod/data-service-catalog-frontend/data-service-catalog-frontend-env.yaml index 877c3d4bc..5b6ebf0ca 100644 --- a/deploy/prod/data-service-catalog-frontend/data-service-catalog-frontend-env.yaml +++ b/deploy/prod/data-service-catalog-frontend/data-service-catalog-frontend-env.yaml @@ -70,11 +70,11 @@ spec: secretKeyRef: name: commonurl-prod key: FDK_BASE_URI - - name: DATASERVICE_CATALOG_BASE_URI + - name: DATA_SERVICE_CATALOG_BASE_URI valueFrom: secretKeyRef: name: commonurl-prod - key: DATASERVICE_CATALOG_BASE_URI + key: DATA_SERVICE_CATALOG_BASE_URI - name: CATALOG_PORTAL_BASE_URI valueFrom: secretKeyRef: diff --git a/deploy/staging/data-service-catalog-frontend/data-service-catalog-frontend-env.yaml b/deploy/staging/data-service-catalog-frontend/data-service-catalog-frontend-env.yaml index c902d0d8f..98f7f12dc 100644 --- a/deploy/staging/data-service-catalog-frontend/data-service-catalog-frontend-env.yaml +++ b/deploy/staging/data-service-catalog-frontend/data-service-catalog-frontend-env.yaml @@ -65,11 +65,11 @@ spec: secretKeyRef: name: commonurl-staging key: FDK_BASE_URI - - name: DATASERVICE_CATALOG_BASE_URI + - name: DATA_SERVICE_CATALOG_BASE_URI valueFrom: secretKeyRef: name: commonurl-staging - key: DATASERVICE_CATALOG_BASE_URI + key: DATA_SERVICE_CATALOG_BASE_URI - name: CATALOG_PORTAL_BASE_URI valueFrom: secretKeyRef: diff --git a/libs/data-access/src/lib/data-service/api/index.ts b/libs/data-access/src/lib/data-service/api/index.ts index 45d5697fe..67996df39 100644 --- a/libs/data-access/src/lib/data-service/api/index.ts +++ b/libs/data-access/src/lib/data-service/api/index.ts @@ -1,7 +1,19 @@ -const path = `${process.env.DATASERVICE_CATALOG_BASE_URI}`; +const oldPath = `${process.env.DATASERVICE_CATALOG_BASE_URI}`; +const path = `${process.env.DATA_SERVICE_CATALOG_BASE_URI}`; + +export const oldGetAllDataServiceCatalogs = async (accessToken: string) => { + const resource = `${oldPath}/catalogs`; + const options = { + headers: { + Authorization: `Bearer ${accessToken}`, + 'Content-Type': 'application/json', + }, + }; + return await fetch(resource, options); +}; export const getAllDataServices = async (catalogId: string, accessToken: string) => { - const resource = `${path}/catalogs/${catalogId}/dataservices`; + const resource = `${path}/internal/catalogs/${catalogId}/data-services`; const options = { headers: { Authorization: `Bearer ${accessToken}`, @@ -13,7 +25,7 @@ export const getAllDataServices = async (catalogId: string, accessToken: string) }; export const getDataServiceById = async (catalogId: string, dataServiceId: string, accessToken: string) => { - const resource = `${path}/catalogs/${catalogId}/dataservices/${dataServiceId}`; + const resource = `${path}/internal/catalogs/${catalogId}/data-services/${dataServiceId}`; const options = { headers: { Authorization: `Bearer ${accessToken}`, @@ -25,7 +37,7 @@ export const getDataServiceById = async (catalogId: string, dataServiceId: strin }; export const getAllDataServiceCatalogs = async (accessToken: string) => { - const resource = `${path}/catalogs`; + const resource = `${path}/internal/catalogs/count`; const options = { headers: { Authorization: `Bearer ${accessToken}`, @@ -36,7 +48,7 @@ export const getAllDataServiceCatalogs = async (accessToken: string) => { }; export const deleteDataService = async (catalogId: string, dataServiceId: string, accessToken: string) => { - const resource = `${path}/catalogs/${catalogId}/dataservices/${dataServiceId}`; + const resource = `${path}/internal/catalogs/${catalogId}/data-services/${dataServiceId}`; const options = { headers: { Authorization: `Bearer ${accessToken}`,