diff --git a/.changeset/khaki-bobcats-join.md b/.changeset/khaki-bobcats-join.md index d06feeb9..964183b1 100644 --- a/.changeset/khaki-bobcats-join.md +++ b/.changeset/khaki-bobcats-join.md @@ -1,5 +1,5 @@ --- -"@frameless/overige-object-api": major +"@frameless/overige-objecten-api": major --- Create Overige Objecten API applicatie diff --git a/.eslintignore b/.eslintignore index 6e1a9bc2..8d3e985f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -29,4 +29,4 @@ gql **/yarn-error.log **/.strapi-updater.json **/generated -apps/overige-object-api/src/types +apps/overige-objecten-api/src/types diff --git a/.eslintrc.js b/.eslintrc.js index 3e259299..6506eec9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -51,8 +51,8 @@ module.exports = { parser: '@typescript-eslint/parser', parserOptions: { project: [ - './apps/overige-object-api/tsconfig.json', - './apps/overige-object-api/tsconfig.test.json', + './apps/overige-objecten-api/tsconfig.json', + './apps/overige-objecten-api/tsconfig.test.json', './apps/kennisbank-dashboard/src/admin/tsconfig.json', './apps/kennisbank-dashboard/tsconfig.json', './apps/kennisbank-frontend/tsconfig.json', diff --git a/.gitignore b/.gitignore index eec411bf..6706cd8d 100644 --- a/.gitignore +++ b/.gitignore @@ -132,6 +132,6 @@ dist/ **/**/public/*.txt ############################ -# overige-object-api +# overige-objecten-api ############################ -apps/overige-object-api/src/types \ No newline at end of file +apps/overige-objecten-api/src/types \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 3f618078..f5dbe9f7 100644 --- a/.prettierignore +++ b/.prettierignore @@ -19,4 +19,4 @@ yarn.lock .strapi-updater.json generated gql -apps/overige-object-api/src/types +apps/overige-objecten-api/src/types diff --git a/Dockerfile.dev b/Dockerfile.dev index b81f4872..c59d748f 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -15,7 +15,7 @@ COPY ./apps/pdc-sc/package.json apps/pdc-sc/package.json COPY ./apps/vth-dashboard/package.json apps/vth-dashboard/package.json COPY ./apps/vth-frontend/package.json apps/vth-frontend/package.json COPY ./apps/kennisbank-dashboard/package.json apps/kennisbank-dashboard/package.json -COPY ./apps/overige-object-api/package.json apps/overige-object-api/package.json +COPY ./apps/overige-objecten-api/package.json apps/overige-objecten-api/package.json COPY ./apps/kennisbank-frontend/package.json apps/kennisbank-frontend/package.json COPY ./packages/catalogi-data/package.json packages/catalogi-data/package.json COPY ./packages/preview-button/package.json packages/preview-button/package.json @@ -55,7 +55,7 @@ RUN npm run build --workspace @frameless/upl && \ npm run build --workspace @frameless/strapi-plugin-uuid-field && \ npm run build --workspace @frameless/strapi-plugin-env-label && \ npm run build --workspace @frameless/strapi-plugin-language && \ - npm run build --workspace @frameless/overige-object-api + npm run build --workspace @frameless/overige-objecten-api # Build target production # ########################### diff --git a/apps/overige-object-api/README.md b/apps/overige-objecten-api/README.md similarity index 72% rename from apps/overige-object-api/README.md rename to apps/overige-objecten-api/README.md index c10e8ac5..4f38fd85 100644 --- a/apps/overige-object-api/README.md +++ b/apps/overige-objecten-api/README.md @@ -1,6 +1,6 @@ -# overige-object-api +# overige-objecten-api -The **overige-object-api** is a microservice built with Node.js that maps certain PDC product fields to the **kennisartikel** and **VAC** fields. +The **overige-objecten-api** is a microservice built with Node.js that maps certain PDC product fields to the **kennisartikel** and **VAC** fields. ## Features @@ -31,8 +31,8 @@ Authorization: Bearer API_TOKEN Ensure that you have the following environment variables in the `.pdc.prod.env` file before starting: ```shell -OVERIGE_OBJECT_API_PORT=4001 -OVERIGE_OBJECT_API_CORS=http://localhost:3000 # If using multiple domains, separate them with a comma (e.g., 'http://localhost:3000, http://localhost:3001'). +OVERIGE_OBJECTEN_API_PORT=4001 +OVERIGE_OBJECTEN_API_CORS=http://localhost:3000 # If using multiple domains, separate them with a comma (e.g., 'http://localhost:3000, http://localhost:3001'). ``` To start the service, open a terminal in the project root and run: @@ -43,12 +43,12 @@ cd bin && bash ./deploy.sh pdc-dashboard prod up --build ### 2. Start without Docker -Create an .env file in the apps/overige-object-api directory with the following environment variables: +Create an .env file in the apps/overige-objecten-api directory with the following environment variables: ```shell STRAPI_PRIVATE_URL=http://127.0.0.1:1337/ -OVERIGE_OBJECT_API_PORT=4001 -OVERIGE_OBJECT_API_CORS='' # Required for client-side application +OVERIGE_OBJECTEN_API_PORT=4001 +OVERIGE_OBJECTEN_API_CORS='' # Required for client-side application ``` Then, follow these steps: @@ -67,10 +67,10 @@ Then, follow these steps: ``` -3. Start the overige-object-api server: +3. Start the overige-objecten-api server: ```shell - yarn workspace @frameless/overige-object-api dev + yarn workspace @frameless/overige-objecten-api dev ``` diff --git a/apps/overige-object-api/jest.config.ts b/apps/overige-objecten-api/jest.config.ts similarity index 100% rename from apps/overige-object-api/jest.config.ts rename to apps/overige-objecten-api/jest.config.ts diff --git a/apps/overige-object-api/package.json b/apps/overige-objecten-api/package.json similarity index 82% rename from apps/overige-object-api/package.json rename to apps/overige-objecten-api/package.json index 329e7694..63ea3ef5 100644 --- a/apps/overige-object-api/package.json +++ b/apps/overige-objecten-api/package.json @@ -1,9 +1,9 @@ { - "name": "@frameless/overige-object-api", + "name": "@frameless/overige-objecten-api", "version": "0.0.0", "private": true, "author": "@frameless", - "description": "Overige Object API for PDC", + "description": "Overige Objecten API for PDC", "license": "EUPL-1.2", "keywords": [], "scripts": { @@ -16,8 +16,8 @@ "dev": "NODE_ENV=development nodemon src/server.ts", "clean": "rimraf dist src/types", "generate-types": "openapi-typescript src/docs/openapi.yaml --output src/types/openapi.ts", - "test": "OVERIGE_OBJECT_API_PORT=3000 jest --coverage --forceExit --verbose", - "test:watch": "OVERIGE_OBJECT_API_PORT=3000 jest --watch" + "test": "OVERIGE_OBJECTEN_API_PORT=3000 jest --coverage --forceExit --verbose", + "test:watch": "OVERIGE_OBJECTEN_API_PORT=3000 jest --watch" }, "dependencies": { "cors": "2.8.5", @@ -46,6 +46,6 @@ "repository": { "type": "git+ssh", "url": "git@github.com:frameless/strapi.git", - "directory": "apps/overige-object-api" + "directory": "apps/overige-objecten-api" } } diff --git a/apps/overige-object-api/src/__mocks__/getStrapiKennisartikelData.ts b/apps/overige-objecten-api/src/__mocks__/getStrapiKennisartikelData.ts similarity index 100% rename from apps/overige-object-api/src/__mocks__/getStrapiKennisartikelData.ts rename to apps/overige-objecten-api/src/__mocks__/getStrapiKennisartikelData.ts diff --git a/apps/overige-object-api/src/__mocks__/index.ts b/apps/overige-objecten-api/src/__mocks__/index.ts similarity index 100% rename from apps/overige-object-api/src/__mocks__/index.ts rename to apps/overige-objecten-api/src/__mocks__/index.ts diff --git a/apps/overige-object-api/src/__mocks__/kennisartikelObject.ts b/apps/overige-objecten-api/src/__mocks__/kennisartikelObject.ts similarity index 100% rename from apps/overige-object-api/src/__mocks__/kennisartikelObject.ts rename to apps/overige-objecten-api/src/__mocks__/kennisartikelObject.ts diff --git a/apps/overige-object-api/src/__mocks__/objectsResponseData.ts b/apps/overige-objecten-api/src/__mocks__/objectsResponseData.ts similarity index 100% rename from apps/overige-object-api/src/__mocks__/objectsResponseData.ts rename to apps/overige-objecten-api/src/__mocks__/objectsResponseData.ts diff --git a/apps/overige-object-api/src/__mocks__/vacObject.ts b/apps/overige-objecten-api/src/__mocks__/vacObject.ts similarity index 100% rename from apps/overige-object-api/src/__mocks__/vacObject.ts rename to apps/overige-objecten-api/src/__mocks__/vacObject.ts diff --git a/apps/overige-object-api/src/controllers/index.ts b/apps/overige-objecten-api/src/controllers/index.ts similarity index 100% rename from apps/overige-object-api/src/controllers/index.ts rename to apps/overige-objecten-api/src/controllers/index.ts diff --git a/apps/overige-object-api/src/controllers/objects/index.test.ts b/apps/overige-objecten-api/src/controllers/objects/index.test.ts similarity index 100% rename from apps/overige-object-api/src/controllers/objects/index.test.ts rename to apps/overige-objecten-api/src/controllers/objects/index.test.ts diff --git a/apps/overige-object-api/src/controllers/objects/index.ts b/apps/overige-objecten-api/src/controllers/objects/index.ts similarity index 100% rename from apps/overige-object-api/src/controllers/objects/index.ts rename to apps/overige-objecten-api/src/controllers/objects/index.ts diff --git a/apps/overige-object-api/src/controllers/objecttypes/index.test.ts b/apps/overige-objecten-api/src/controllers/objecttypes/index.test.ts similarity index 100% rename from apps/overige-object-api/src/controllers/objecttypes/index.test.ts rename to apps/overige-objecten-api/src/controllers/objecttypes/index.test.ts diff --git a/apps/overige-object-api/src/controllers/objecttypes/index.ts b/apps/overige-objecten-api/src/controllers/objecttypes/index.ts similarity index 100% rename from apps/overige-object-api/src/controllers/objecttypes/index.ts rename to apps/overige-objecten-api/src/controllers/objecttypes/index.ts diff --git a/apps/overige-object-api/src/controllers/openapi/index.test.ts b/apps/overige-objecten-api/src/controllers/openapi/index.test.ts similarity index 100% rename from apps/overige-object-api/src/controllers/openapi/index.test.ts rename to apps/overige-objecten-api/src/controllers/openapi/index.test.ts diff --git a/apps/overige-object-api/src/controllers/openapi/index.ts b/apps/overige-objecten-api/src/controllers/openapi/index.ts similarity index 100% rename from apps/overige-object-api/src/controllers/openapi/index.ts rename to apps/overige-objecten-api/src/controllers/openapi/index.ts diff --git a/apps/overige-object-api/src/docs/kennisartikel.json b/apps/overige-objecten-api/src/docs/kennisartikel.json similarity index 100% rename from apps/overige-object-api/src/docs/kennisartikel.json rename to apps/overige-objecten-api/src/docs/kennisartikel.json diff --git a/apps/overige-object-api/src/docs/openapi.yaml b/apps/overige-objecten-api/src/docs/openapi.yaml similarity index 99% rename from apps/overige-object-api/src/docs/openapi.yaml rename to apps/overige-objecten-api/src/docs/openapi.yaml index 034a3339..a8e963df 100644 --- a/apps/overige-object-api/src/docs/openapi.yaml +++ b/apps/overige-objecten-api/src/docs/openapi.yaml @@ -1,7 +1,7 @@ openapi: "3.0.0" info: - title: Overige Object API - description: API to manage Overige Object resources + title: Overige Objecten API + description: API to manage Overige Objecten resources version: 1.0.0 servers: - url: http://localhost:4001/api/v1 diff --git a/apps/overige-object-api/src/docs/vac.json b/apps/overige-objecten-api/src/docs/vac.json similarity index 100% rename from apps/overige-object-api/src/docs/vac.json rename to apps/overige-objecten-api/src/docs/vac.json diff --git a/apps/overige-object-api/src/queries/index.ts b/apps/overige-objecten-api/src/queries/index.ts similarity index 100% rename from apps/overige-object-api/src/queries/index.ts rename to apps/overige-objecten-api/src/queries/index.ts diff --git a/apps/overige-object-api/src/routers/index.ts b/apps/overige-objecten-api/src/routers/index.ts similarity index 100% rename from apps/overige-object-api/src/routers/index.ts rename to apps/overige-objecten-api/src/routers/index.ts diff --git a/apps/overige-object-api/src/routers/objects/index.ts b/apps/overige-objecten-api/src/routers/objects/index.ts similarity index 100% rename from apps/overige-object-api/src/routers/objects/index.ts rename to apps/overige-objecten-api/src/routers/objects/index.ts diff --git a/apps/overige-object-api/src/routers/objecttypes/index.ts b/apps/overige-objecten-api/src/routers/objecttypes/index.ts similarity index 100% rename from apps/overige-object-api/src/routers/objecttypes/index.ts rename to apps/overige-objecten-api/src/routers/objecttypes/index.ts diff --git a/apps/overige-object-api/src/routers/openapi/index.ts b/apps/overige-objecten-api/src/routers/openapi/index.ts similarity index 100% rename from apps/overige-object-api/src/routers/openapi/index.ts rename to apps/overige-objecten-api/src/routers/openapi/index.ts diff --git a/apps/overige-object-api/src/server.ts b/apps/overige-objecten-api/src/server.ts similarity index 93% rename from apps/overige-object-api/src/server.ts rename to apps/overige-objecten-api/src/server.ts index b1d96997..af6be389 100644 --- a/apps/overige-object-api/src/server.ts +++ b/apps/overige-objecten-api/src/server.ts @@ -25,11 +25,11 @@ interface OpenApiValidationErrorTypes { // Validate environment variables envAvailability({ env: process.env, - keys: ['STRAPI_PRIVATE_URL', 'OVERIGE_OBJECT_API_PORT'], + keys: ['STRAPI_PRIVATE_URL', 'OVERIGE_OBJECTEN_API_PORT'], }); const swaggerDocument: any = yaml.load(fs.readFileSync(path.join(__dirname, './docs/openapi.yaml'), 'utf8')); -const whitelist = process.env.OVERIGE_OBJECT_API_CORS?.split(', ') || []; +const whitelist = process.env.OVERIGE_OBJECTEN_API_CORS?.split(', ') || []; const corsOption: CorsOptions = { origin: (origin, callback) => { if (!origin || whitelist.indexOf(origin) !== -1) { @@ -48,7 +48,7 @@ const apiSpec = path.join(__dirname, './docs/openapi.yaml'); const app = express(); app.use(express.json()); -const port = process.env.OVERIGE_OBJECT_API_PORT; +const port = process.env.OVERIGE_OBJECTEN_API_PORT; // Centralized error handler middleware const globalErrorHandler = (err: ErrorHandler, _req: Request, res: Response, _next: NextFunction) => { if (err instanceof ErrorHandler || (err as ErrorHandler)?.isOperational) { @@ -127,7 +127,7 @@ app.use(globalErrorHandler); if (process.env.NODE_ENV !== 'test') { app.listen(port, () => { // eslint-disable-next-line no-console - console.log(`Overige Object app listening on port ${port}!`); + console.log(`Overige Objecten app listening on port ${port}!`); }); } diff --git a/apps/overige-object-api/src/strapi-product-type.ts b/apps/overige-objecten-api/src/strapi-product-type.ts similarity index 100% rename from apps/overige-object-api/src/strapi-product-type.ts rename to apps/overige-objecten-api/src/strapi-product-type.ts diff --git a/apps/overige-object-api/src/tests/jest.setup.ts b/apps/overige-objecten-api/src/tests/jest.setup.ts similarity index 100% rename from apps/overige-object-api/src/tests/jest.setup.ts rename to apps/overige-objecten-api/src/tests/jest.setup.ts diff --git a/apps/overige-object-api/src/utils/envAvailability.ts b/apps/overige-objecten-api/src/utils/envAvailability.ts similarity index 100% rename from apps/overige-object-api/src/utils/envAvailability.ts rename to apps/overige-objecten-api/src/utils/envAvailability.ts diff --git a/apps/overige-object-api/src/utils/errorHandler.ts b/apps/overige-objecten-api/src/utils/errorHandler.ts similarity index 100% rename from apps/overige-object-api/src/utils/errorHandler.ts rename to apps/overige-objecten-api/src/utils/errorHandler.ts diff --git a/apps/overige-object-api/src/utils/fetchData.ts b/apps/overige-objecten-api/src/utils/fetchData.ts similarity index 100% rename from apps/overige-object-api/src/utils/fetchData.ts rename to apps/overige-objecten-api/src/utils/fetchData.ts diff --git a/apps/overige-object-api/src/utils/generateKennisartikelObject.ts b/apps/overige-objecten-api/src/utils/generateKennisartikelObject.ts similarity index 100% rename from apps/overige-object-api/src/utils/generateKennisartikelObject.ts rename to apps/overige-objecten-api/src/utils/generateKennisartikelObject.ts diff --git a/apps/overige-object-api/src/utils/getPaginatedResponse.ts b/apps/overige-objecten-api/src/utils/getPaginatedResponse.ts similarity index 100% rename from apps/overige-object-api/src/utils/getPaginatedResponse.ts rename to apps/overige-objecten-api/src/utils/getPaginatedResponse.ts diff --git a/apps/overige-object-api/src/utils/getTheServerURL.ts b/apps/overige-objecten-api/src/utils/getTheServerURL.ts similarity index 100% rename from apps/overige-object-api/src/utils/getTheServerURL.ts rename to apps/overige-objecten-api/src/utils/getTheServerURL.ts diff --git a/apps/overige-object-api/src/utils/index.ts b/apps/overige-objecten-api/src/utils/index.ts similarity index 100% rename from apps/overige-object-api/src/utils/index.ts rename to apps/overige-objecten-api/src/utils/index.ts diff --git a/apps/overige-object-api/src/utils/readFile.ts b/apps/overige-objecten-api/src/utils/readFile.ts similarity index 100% rename from apps/overige-object-api/src/utils/readFile.ts rename to apps/overige-objecten-api/src/utils/readFile.ts diff --git a/apps/overige-object-api/src/utils/vacData.ts b/apps/overige-objecten-api/src/utils/vacData.ts similarity index 100% rename from apps/overige-object-api/src/utils/vacData.ts rename to apps/overige-objecten-api/src/utils/vacData.ts diff --git a/apps/overige-object-api/tsconfig.json b/apps/overige-objecten-api/tsconfig.json similarity index 100% rename from apps/overige-object-api/tsconfig.json rename to apps/overige-objecten-api/tsconfig.json diff --git a/apps/overige-object-api/tsconfig.test.json b/apps/overige-objecten-api/tsconfig.test.json similarity index 100% rename from apps/overige-object-api/tsconfig.test.json rename to apps/overige-objecten-api/tsconfig.test.json diff --git a/docker-compose.pdc.dev.yml b/docker-compose.pdc.dev.yml index db0edf4e..a69f8ab7 100644 --- a/docker-compose.pdc.dev.yml +++ b/docker-compose.pdc.dev.yml @@ -104,18 +104,19 @@ services: depends_on: - pdc_strapi - pdc_strapi_db - overige-object-api: - container_name: overige-object-api + overige-objecten-api: + container_name: overige-objecten-api build: context: . dockerfile: Dockerfile.dev restart: unless-stopped - command: yarn workspace @frameless/overige-object-api start + volumes: + - ./apps/overige-objecten-api/src/docs:/opt/app/apps/overige-objecten-api/dist/src/docs + command: yarn workspace @frameless/overige-objecten-api start environment: STRAPI_PRIVATE_URL: ${STRAPI_PRIVATE_URL} - FRONTEND_PUBLIC_URL: ${FRONTEND_PUBLIC_URL} - OVERIGE_OBJECT_API_PORT: ${OVERIGE_OBJECT_API_PORT} - OVERIGE_OBJECT_API_CORS: ${OVERIGE_OBJECT_API_CORS} + OVERIGE_OBJECTEN_API_PORT: ${OVERIGE_OBJECTEN_API_PORT} + OVERIGE_OBJECTEN_API_CORS: ${OVERIGE_OBJECTEN_API_CORS} ports: - "4001:4001" networks: diff --git a/docker-compose.pdc.prod.yml b/docker-compose.pdc.prod.yml index feb85c18..2330512c 100644 --- a/docker-compose.pdc.prod.yml +++ b/docker-compose.pdc.prod.yml @@ -91,18 +91,19 @@ services: depends_on: - pdc_strapi - pdc_strapi_db - overige-object-api: - container_name: overige-object-api + overige-objecten-api: + container_name: overige-objecten-api build: context: . dockerfile: Dockerfile.prod restart: unless-stopped - command: yarn start:overige-object-api + volumes: + - ./apps/overige-objecten-api/src/docs:/opt/app/apps/overige-objecten-api/dist/src/docs + command: yarn start:overige-objecten-api environment: STRAPI_PRIVATE_URL: ${STRAPI_PRIVATE_URL} - FRONTEND_PUBLIC_URL: ${FRONTEND_PUBLIC_URL} - OVERIGE_OBJECT_API_PORT: ${OVERIGE_OBJECT_API_PORT} - OVERIGE_OBJECT_API_CORS: ${OVERIGE_OBJECT_API_CORS} + OVERIGE_OBJECTEN_API_PORT: ${OVERIGE_OBJECTEN_API_PORT} + OVERIGE_OBJECTEN_API_CORS: ${OVERIGE_OBJECTEN_API_CORS} ports: - "4001:4001" networks: diff --git a/package.json b/package.json index 2e445a60..ca98bb79 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "start:kennisbank-frontend": "npm run --workspace @frameless/kennisbank-frontend start", "start:kennisbank-dashboard": "npm run --workspace @frameless/kennisbank-dashboard start", "start:pdc-sc": "npm run --workspace @frameless/pdc-sc start", - "start:overige-object-api": "yarn workspace @frameless/overige-object-api start", + "start:overige-objecten-api": "yarn workspace @frameless/overige-objecten-api start", "build": "npm run --workspaces build --if-present", "build:frontend": "npm run build --workspace @frameless/${APP}", "build:strapi": "npm run build --workspace @frameless/${APP}",