Skip to content

Commit

Permalink
Adjustable api routing (#139)
Browse files Browse the repository at this point in the history
* refactoring(architecture): available POST as alias for PATCH

* release: services and web client

* fix(client): correctly toggle API trough ENV
  • Loading branch information
setaman authored Jan 24, 2022
1 parent fa90bc3 commit 291de52
Show file tree
Hide file tree
Showing 23 changed files with 254 additions and 100 deletions.
27 changes: 27 additions & 0 deletions core/services/asset-management/apiDoc/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/services/asset-management/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "asset-management",
"version": "17.2.3",
"version": "17.2.4",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions core/services/asset-management/routes/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
29 changes: 29 additions & 0 deletions core/services/resource-management/apiDoc/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/services/resource-management/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 1 addition & 0 deletions core/services/resource-management/routes/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
26 changes: 26 additions & 0 deletions core/services/review-management/apiDoc/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion core/services/review-management/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 1 addition & 0 deletions core/services/review-management/routes/reviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
28 changes: 28 additions & 0 deletions core/services/service-management/apiDoc/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/services/service-management/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "service-management",
"version": "0.1.0",
"version": "0.1.1",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions core/services/service-management/routes/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
22 changes: 22 additions & 0 deletions core/services/user-management/apiDoc/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/services/user-management/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
1 change: 1 addition & 0 deletions core/services/user-management/routes/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
1 change: 1 addition & 0 deletions core/web-client/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env*
13 changes: 13 additions & 0 deletions core/web-client/.env.default
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions core/web-client/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit 291de52

Please sign in to comment.