From 291de5239ca115887839f3a8fcb00f1c39b1a91f Mon Sep 17 00:00:00 2001 From: Sergej Atamantschuk Date: Mon, 24 Jan 2022 15:28:37 +0100 Subject: [PATCH] Adjustable api routing (#139) * refactoring(architecture): available POST as alias for PATCH * release: services and web client * fix(client): correctly toggle API trough ENV --- .../asset-management/apiDoc/openapi.yml | 27 +++ core/services/asset-management/package.json | 2 +- .../asset-management/routes/assets.js | 1 + .../resource-management/apiDoc/openapi.yml | 29 +++ .../services/resource-management/package.json | 2 +- .../resource-management/routes/resources.js | 1 + .../review-management/apiDoc/openapi.yml | 26 +++ core/services/review-management/package.json | 2 +- .../review-management/routes/reviews.js | 1 + .../service-management/apiDoc/openapi.yml | 28 +++ core/services/service-management/package.json | 2 +- .../service-management/routes/services.js | 1 + .../user-management/apiDoc/openapi.yml | 22 +++ core/services/user-management/package.json | 2 +- core/services/user-management/routes/users.js | 1 + core/web-client/.dockerignore | 1 + core/web-client/.env.default | 13 ++ core/web-client/entrypoint.sh | 3 + core/web-client/package-lock.json | 167 +++++++++--------- core/web-client/package.json | 2 +- core/web-client/src/api/apiFactory.js | 5 +- docker/.env.default | 3 + docker/docker-compose.yml | 13 +- 23 files changed, 254 insertions(+), 100 deletions(-) create mode 100644 core/web-client/.dockerignore create mode 100644 core/web-client/.env.default diff --git a/core/services/asset-management/apiDoc/openapi.yml b/core/services/asset-management/apiDoc/openapi.yml index 269f7fd4..f29863d8 100644 --- a/core/services/asset-management/apiDoc/openapi.yml +++ b/core/services/asset-management/apiDoc/openapi.yml @@ -178,6 +178,33 @@ paths: $ref: "#/components/responses/AssetAlreadyExistsError" "500": $ref: "#/components/responses/UnexpectedError" + post: + tags: + - assets + summary: Patch asset (alias for PATCH) + description: Use this method to do a partial update of the asset. In the request provided fields + will be merged with the existing asset object. + operationId: patchAsset + parameters: + - name: id + in: path + description: id of the asset + required: true + schema: + type: string + requestBody: + $ref: "#/components/requestBodies/AssetsPatch" + responses: + "200": + $ref: "#/components/responses/SuccessEmpty" + "406": + $ref: "#/components/responses/InvalidDataError" + "404": + $ref: "#/components/responses/NotFoundError" + "409": + $ref: "#/components/responses/AssetAlreadyExistsError" + "500": + $ref: "#/components/responses/UnexpectedError" delete: tags: - assets diff --git a/core/services/asset-management/package.json b/core/services/asset-management/package.json index b657acdb..38f40dcb 100644 --- a/core/services/asset-management/package.json +++ b/core/services/asset-management/package.json @@ -1,6 +1,6 @@ { "name": "asset-management", - "version": "17.2.3", + "version": "17.2.4", "description": "", "main": "index.js", "scripts": { diff --git a/core/services/asset-management/routes/assets.js b/core/services/asset-management/routes/assets.js index b94bdfdc..97517cbe 100644 --- a/core/services/asset-management/routes/assets.js +++ b/core/services/asset-management/routes/assets.js @@ -7,6 +7,7 @@ router.get("/", AssetsController.getAssets); router.get("/:id", AssetsController.getAsset); router.post("/", AssetsController.createAsset); router.patch("/:id", AssetsController.patchAsset); +router.post("/:id", AssetsController.patchAsset); router.delete("/:id", AssetsController.deleteAsset); router.put("/:id/entities", AssetsController.linkEntity); router.get("/:id/entities", AssetsController.getLinkedEntities); diff --git a/core/services/resource-management/apiDoc/openapi.yml b/core/services/resource-management/apiDoc/openapi.yml index e9b6c487..b0dc9a0c 100644 --- a/core/services/resource-management/apiDoc/openapi.yml +++ b/core/services/resource-management/apiDoc/openapi.yml @@ -175,6 +175,35 @@ paths: $ref: "#/components/responses/ResourceAlreadyExistsError" "500": $ref: "#/components/responses/UnexpectedError" + post: + tags: + - resources + summary: Post resource (alias for patch) + description: Use this method to do a partial update of the resource. In the request provided fields + will be merged with the existing resource object. Merge is always performed at the root level. Empty patches are + not accepted + operationId: patchResource + parameters: + - $ref: "#/components/parameters/useridParam" + - name: id + in: path + description: id of the resource + required: true + schema: + type: string + requestBody: + $ref: "#/components/requestBodies/ResourcesPatch" + responses: + "200": + $ref: "#/components/responses/SuccessEmpty" + "406": + $ref: "#/components/responses/InvalidDataError" + "404": + $ref: "#/components/responses/NotFoundError" + "409": + $ref: "#/components/responses/ResourceAlreadyExistsError" + "500": + $ref: "#/components/responses/UnexpectedError" delete: tags: - resources diff --git a/core/services/resource-management/package.json b/core/services/resource-management/package.json index 80e0c4d1..4be6cec9 100644 --- a/core/services/resource-management/package.json +++ b/core/services/resource-management/package.json @@ -1,6 +1,6 @@ { "name": "resource-management", - "version": "17.0.2", + "version": "17.0.3", "description": "Manages metadata of resources and publishes CRUD events to kafka", "repository": { "url": "https://gitlab.cc-asp.fraunhofer.de/diva/drm" diff --git a/core/services/resource-management/routes/resources.js b/core/services/resource-management/routes/resources.js index e2e52a68..1e4f30a2 100644 --- a/core/services/resource-management/routes/resources.js +++ b/core/services/resource-management/routes/resources.js @@ -7,6 +7,7 @@ router.get("/", ResourcesController.getResources); router.get("/:id", ResourcesController.getResource); router.post("/", ResourcesController.createResource); router.patch("/:id", ResourcesController.patchResource); +router.post("/:id", ResourcesController.patchResource); router.delete("/:id", ResourcesController.deleteResource); module.exports = router; diff --git a/core/services/review-management/apiDoc/openapi.yml b/core/services/review-management/apiDoc/openapi.yml index b3c5c889..bdda8850 100644 --- a/core/services/review-management/apiDoc/openapi.yml +++ b/core/services/review-management/apiDoc/openapi.yml @@ -164,6 +164,32 @@ paths: $ref: "#/components/responses/NotFoundError" "5XX": $ref: "#/components/responses/UnexpectedError" + post: + tags: + - reviews + summary: Post review (alias for patch) + description: Use this method to do a partial update of the review. In the request provided fields + will be merged with the existing review object. + operationId: patchReview + parameters: + - $ref: "#/components/parameters/actorIdParam" + - name: id + in: path + description: id of the asset + required: true + schema: + type: string + requestBody: + $ref: "#/components/requestBodies/ReviewPatch" + responses: + "200": + $ref: "#/components/responses/SuccessEmpty" + "406": + $ref: "#/components/responses/InvalidDataError" + "404": + $ref: "#/components/responses/NotFoundError" + "5XX": + $ref: "#/components/responses/UnexpectedError" delete: tags: diff --git a/core/services/review-management/package.json b/core/services/review-management/package.json index d28f5ba7..9c7f9dc3 100644 --- a/core/services/review-management/package.json +++ b/core/services/review-management/package.json @@ -1,6 +1,6 @@ { "name": "review-management", - "version": "1.1.2", + "version": "1.1.3", "description": "Manages entities reviews", "repository": { "url": "https://gitlab.cc-asp.fraunhofer.de/diva/drm" diff --git a/core/services/review-management/routes/reviews.js b/core/services/review-management/routes/reviews.js index fef0887f..9f621ea1 100644 --- a/core/services/review-management/routes/reviews.js +++ b/core/services/review-management/routes/reviews.js @@ -8,6 +8,7 @@ router.post("/", reviewsController.createReview); router.get("/", reviewsController.getReviews); router.get("/:id", reviewsController.getReview); router.patch("/:id", reviewsController.patchReview); +router.post("/:id", reviewsController.patchReview); router.delete("/:id", reviewsController.deleteReview); module.exports = router; diff --git a/core/services/service-management/apiDoc/openapi.yml b/core/services/service-management/apiDoc/openapi.yml index c38b05f5..1e31b46d 100644 --- a/core/services/service-management/apiDoc/openapi.yml +++ b/core/services/service-management/apiDoc/openapi.yml @@ -177,6 +177,34 @@ paths: $ref: "#/components/responses/InvalidDataError" "500": $ref: "#/components/responses/UnexpectedError" + post: + tags: + - services + summary: Post service (alias for patch) + description: Use this method to do a partial update of the service. In the request provided fields + will be merged with the existing service object. + operationId: patchService + parameters: + - $ref: "#/components/parameters/actorIdParam" + - name: id + in: path + description: id of the service + required: true + schema: + type: string + requestBody: + $ref: "#/components/requestBodies/ServicesPatch" + responses: + "200": + $ref: "#/components/responses/SuccessEmpty" + "4XX": + $ref: "#/components/responses/RequestValidationError" + "404": + $ref: "#/components/responses/NotFoundError" + "406": + $ref: "#/components/responses/InvalidDataError" + "500": + $ref: "#/components/responses/UnexpectedError" delete: tags: - services diff --git a/core/services/service-management/package.json b/core/services/service-management/package.json index de619459..30379e22 100644 --- a/core/services/service-management/package.json +++ b/core/services/service-management/package.json @@ -1,6 +1,6 @@ { "name": "service-management", - "version": "0.1.0", + "version": "0.1.1", "description": "", "main": "index.js", "scripts": { diff --git a/core/services/service-management/routes/services.js b/core/services/service-management/routes/services.js index b7efe871..f8dd0794 100644 --- a/core/services/service-management/routes/services.js +++ b/core/services/service-management/routes/services.js @@ -7,6 +7,7 @@ router.get("/", ServicesController.getServices); router.get("/:id", ServicesController.getService); router.post("/", ServicesController.createService); router.patch("/:id", ServicesController.patchService); +router.post("/:id", ServicesController.patchService); router.delete("/:id", ServicesController.deleteService); module.exports = router; diff --git a/core/services/user-management/apiDoc/openapi.yml b/core/services/user-management/apiDoc/openapi.yml index 5e44a7b7..2a0b2b0e 100644 --- a/core/services/user-management/apiDoc/openapi.yml +++ b/core/services/user-management/apiDoc/openapi.yml @@ -181,6 +181,28 @@ paths: $ref: "#/components/responses/UserAlreadyExistsError" "500": $ref: "#/components/responses/UnexpectedError" + post: + tags: + - users + summary: Post user (alias for PATCH) + description: Use this method to do a partial updated of the user document. In the request provided fields + will be merged with the existing user object. + operationId: patchUser + requestBody: + $ref: "#/components/requestBodies/UsersPatch" + responses: + "200": + $ref: "#/components/responses/SuccessEmpty" + "400": + $ref: "#/components/responses/RequestValidationError" + "406": + $ref: "#/components/responses/InvalidDataError" + "404": + $ref: "#/components/responses/NotFoundError" + "409": + $ref: "#/components/responses/UserAlreadyExistsError" + "500": + $ref: "#/components/responses/UnexpectedError" delete: tags: - users diff --git a/core/services/user-management/package.json b/core/services/user-management/package.json index d292f9c6..96d83731 100644 --- a/core/services/user-management/package.json +++ b/core/services/user-management/package.json @@ -1,6 +1,6 @@ { "name": "user-management", - "version": "5.0.3", + "version": "5.0.4", "description": "User management service with CRUD operations for users", "main": "index.js", "scripts": { diff --git a/core/services/user-management/routes/users.js b/core/services/user-management/routes/users.js index fc572457..f235f57b 100644 --- a/core/services/user-management/routes/users.js +++ b/core/services/user-management/routes/users.js @@ -9,6 +9,7 @@ router.get("/", usersController.getUsers); router.get("/:id", usersController.getUser); router.put("/:id", usersController.updateUser); router.patch("/:id", usersController.patchUser); +router.post("/:id", usersController.patchUser); router.delete("/:id", usersController.deleteUser); module.exports = router; diff --git a/core/web-client/.dockerignore b/core/web-client/.dockerignore new file mode 100644 index 00000000..81a38be6 --- /dev/null +++ b/core/web-client/.dockerignore @@ -0,0 +1 @@ +.env* diff --git a/core/web-client/.env.default b/core/web-client/.env.default new file mode 100644 index 00000000..be73dbdb --- /dev/null +++ b/core/web-client/.env.default @@ -0,0 +1,13 @@ +# Web Client runtime +#______________________ +# if using the nginx reverse proxy, make sure that this port is not reachable from external (set your firewall...) +WEB_CLIENT_PORT=70 +# if using the nginx reverse proxy example configuration, set VUE_APP_API_GATEWAY_URL to e.g. "https://your-diva-domain.com/api" +VUE_APP_API_GATEWAY_URL=http://localhost:8000 +VUE_APP_KEYCLOAK_URL=http://172.17.0.1:7000/auth +VUE_APP_KEYCLOAK_REALM=diva-kc-realm +VUE_APP_KEYCLOAK_CLIENT_ID=diva-kc-client +# disable registration for users +VUE_APP_REGISTER_AVAILABLE=true +# prohibit usage of PATCH request +VUE_APP_DISABLE_PATCH=false \ No newline at end of file diff --git a/core/web-client/entrypoint.sh b/core/web-client/entrypoint.sh index a8f6fb90..6d8a069f 100644 --- a/core/web-client/entrypoint.sh +++ b/core/web-client/entrypoint.sh @@ -22,6 +22,9 @@ do echo "VUE_APP_REGISTER_AVAILABLE: ${VUE_APP_REGISTER_AVAILABLE}" sed -i 's|register_available|'$VUE_APP_REGISTER_AVAILABLE'|g' $file + echo "VUE_APP_DISABLE_PATCH: ${VUE_APP_DISABLE_PATCH}" + sed -i 's|patch_available|'$VUE_APP_DISABLE_PATCH'|g' $file + echo "Hashing $file" hash=$(md5sum "$file" | cut -c1-8) echo "$hash" diff --git a/core/web-client/package-lock.json b/core/web-client/package-lock.json index 3a1580f9..d3375826 100644 --- a/core/web-client/package-lock.json +++ b/core/web-client/package-lock.json @@ -1,6 +1,6 @@ { "name": "web-client", - "version": "18.29.1", + "version": "18.32.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1823,6 +1823,16 @@ "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "dev": true }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "optional": true, + "requires": { + "color-convert": "^2.0.1" + } + }, "cacache": { "version": "13.0.1", "resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz", @@ -1849,6 +1859,53 @@ "unique-filename": "^1.1.1" } }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "optional": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "optional": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "optional": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "optional": true + }, + "loader-utils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", + "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", + "dev": true, + "optional": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -1865,6 +1922,16 @@ "minipass": "^3.1.1" } }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "optional": true, + "requires": { + "has-flag": "^4.0.0" + } + }, "terser-webpack-plugin": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz", @@ -1881,6 +1948,18 @@ "terser": "^4.6.12", "webpack-sources": "^1.4.3" } + }, + "vue-loader-v16": { + "version": "npm:vue-loader@16.8.3", + "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz", + "integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==", + "dev": true, + "optional": true, + "requires": { + "chalk": "^4.1.0", + "hash-sum": "^2.0.0", + "loader-utils": "^2.0.0" + } } } }, @@ -11885,87 +11964,6 @@ } } }, - "vue-loader-v16": { - "version": "npm:vue-loader@16.8.3", - "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz", - "integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==", - "dev": true, - "optional": true, - "requires": { - "chalk": "^4.1.0", - "hash-sum": "^2.0.0", - "loader-utils": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "optional": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "optional": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "optional": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "optional": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "optional": true - }, - "loader-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", - "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", - "dev": true, - "optional": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "optional": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, "vue-router": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.5.1.tgz", @@ -12096,11 +12094,6 @@ "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==", "dev": true }, - "vue2-leaflet": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/vue2-leaflet/-/vue2-leaflet-2.7.1.tgz", - "integrity": "sha512-K7HOlzRhjt3Z7+IvTqEavIBRbmCwSZSCVUlz9u4Rc+3xGCLsHKz4TAL4diAmfHElCQdPPVdZdJk8wPUt2fu6WQ==" - }, "vue2vis": { "version": "0.0.16", "resolved": "https://registry.npmjs.org/vue2vis/-/vue2vis-0.0.16.tgz", diff --git a/core/web-client/package.json b/core/web-client/package.json index b9816bc9..a7855f2f 100644 --- a/core/web-client/package.json +++ b/core/web-client/package.json @@ -1,6 +1,6 @@ { "name": "web-client", - "version": "18.32.0", + "version": "18.32.1", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/core/web-client/src/api/apiFactory.js b/core/web-client/src/api/apiFactory.js index 093730a1..b905aa20 100644 --- a/core/web-client/src/api/apiFactory.js +++ b/core/web-client/src/api/apiFactory.js @@ -1,4 +1,6 @@ import axios from "@/api/axios"; +let patchDisabledEnv = process.env.VUE_APP_DISABLE_PATCH || "patch_available"; +let patchDisabled = patchDisabledEnv.toString().toLowerCase() === "true"; const getByIdIfExists = (id, query, path) => axios.get(`${path}${id}`, { params: query }).catch((e) => { @@ -23,6 +25,7 @@ export default (path) => ({ getByIdIfExists: (id, query) => getByIdIfExists(id, query, path), update: (id, data) => axios.put(`${path}${id}`, data), create: (data) => axios.post(path, data), - patch: (id, patch) => axios.patch(`${path}${id}`, patch), + patch: (id, patch) => + axios[patchDisabled ? "post" : "patch"](`${path}${id}`, patch), delete: (id) => axios.delete(`${path}${id}`), }); diff --git a/docker/.env.default b/docker/.env.default index f2b26f42..e5455c57 100644 --- a/docker/.env.default +++ b/docker/.env.default @@ -15,7 +15,10 @@ VUE_APP_API_GATEWAY_URL=http://localhost:8000 VUE_APP_KEYCLOAK_URL=http://172.17.0.1:7000/auth VUE_APP_KEYCLOAK_REALM=diva-kc-realm VUE_APP_KEYCLOAK_CLIENT_ID=diva-kc-client +# disable registration for users VUE_APP_REGISTER_AVAILABLE=true +# prohibit using PATCH request +VUE_APP_DISABLE_PATCH=false # Core Services Ports diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index d85e4613..55ecee26 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -47,7 +47,7 @@ services: web-client: container_name: web-client - image: ${REGISTRY}web-client:18.32.0 + image: ${REGISTRY}web-client:18.32.1 ports: - ${WEB_CLIENT_PORT}:80 restart: always @@ -57,6 +57,7 @@ services: VUE_APP_KEYCLOAK_REALM: ${VUE_APP_KEYCLOAK_REALM} VUE_APP_KEYCLOAK_CLIENT_ID: ${VUE_APP_KEYCLOAK_CLIENT_ID} VUE_APP_REGISTER_AVAILABLE: ${VUE_APP_REGISTER_AVAILABLE} + VUE_APP_DISABLE_PATCH: ${VUE_APP_DISABLE_PATCH} networks: - core @@ -90,7 +91,7 @@ services: resource-management: <<: *base-core-service - image: ${REGISTRY}resource-management:17.0.2 + image: ${REGISTRY}resource-management:17.0.3 container_name: resource-management environment: <<: *base-core-service-env @@ -106,7 +107,7 @@ services: asset-management: <<: *base-core-service - image: ${REGISTRY}asset-management:17.2.3 + image: ${REGISTRY}asset-management:17.2.4 container_name: asset-management environment: <<: *base-core-service-env @@ -121,7 +122,7 @@ services: user-management: <<: *base-core-service - image: ${REGISTRY}user-management:5.0.3 + image: ${REGISTRY}user-management:5.0.4 container_name: user-management environment: <<: *base-core-service-env @@ -136,7 +137,7 @@ services: review-management: <<: *base-core-service - image: ${REGISTRY}review-management:1.1.2 + image: ${REGISTRY}review-management:1.1.3 container_name: reviews-management environment: <<: *base-core-service-env @@ -153,7 +154,7 @@ services: service-management: <<: *base-core-service - image: ${REGISTRY}service-management:0.1.0 + image: ${REGISTRY}service-management:0.1.1 container_name: service-management environment: <<: *base-core-service-env