diff --git a/CHANGELOG.md b/CHANGELOG.md index f1c9167baa..82b7b31b25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,8 @@ _**For better traceability add the corresponding GitHub issue number in each cha - #xxx fixed notification description on receiver side - #875 owasp dependency check tool is now used from github action image instead of maven plugin - XXX fixed display of semantic data model in parts as planned table +- #943 renamed distinctFilterValues API to searchable-values for the asBuilt, asPlanned and notification routes +- #943 changed these endpoints to POST with body instead of GET with parameters ### Known knowns - #786 Implemented short term solution for securing EDC Callback APIs diff --git a/docs/api/traceability-foss-backend.json b/docs/api/traceability-foss-backend.json index 371e20c363..adf8621301 100644 --- a/docs/api/traceability-foss-backend.json +++ b/docs/api/traceability-foss-backend.json @@ -31,18 +31,18 @@ "description": "The endpoint returns all policies .", "operationId": "policy", "responses": { - "200": { - "description": "Returns the policies", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IrsPolicyResponse" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authorization failed.", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -51,18 +51,18 @@ } } }, - "415": { - "description": "Unsupported media type", + "200": { + "description": "Returns the policies", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "$ref": "#/components/schemas/IrsPolicyResponse" } } } }, - "500": { - "description": "Internal server error.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -71,8 +71,8 @@ } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -81,8 +81,8 @@ } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -91,8 +91,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -101,8 +101,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -138,8 +138,8 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -148,8 +148,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -158,8 +158,8 @@ } } }, - "500": { - "description": "Internal server error.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -168,8 +168,8 @@ } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -178,16 +178,18 @@ } } }, - "200": { - "description": "Update successful", + "400": { + "description": "Bad request.", "content": { "application/json": { - + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, - "429": { - "description": "Too many requests.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -196,18 +198,16 @@ } } }, - "404": { - "description": "Not found.", + "200": { + "description": "Update successful", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } + } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -243,16 +243,6 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -283,8 +273,8 @@ } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -293,8 +283,8 @@ } } }, - "429": { - "description": "Too many requests.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -303,8 +293,8 @@ } } }, - "404": { - "description": "Not found.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -313,8 +303,18 @@ } } }, - "400": { - "description": "Bad request.", + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -363,8 +363,8 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -373,8 +373,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -383,8 +383,11 @@ } } }, - "500": { - "description": "Internal server error.", + "204": { + "description": "No content." + }, + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -393,8 +396,8 @@ } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -403,8 +406,8 @@ } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -413,8 +416,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -423,8 +426,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -432,9 +435,6 @@ } } } - }, - "204": { - "description": "No content." } }, "security": [ @@ -455,8 +455,8 @@ "description": "The endpoint returns a result of BPN EDC URL mappings.", "operationId": "getBpnEdcs", "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -465,8 +465,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -475,18 +475,23 @@ } } }, - "500": { - "description": "Internal server error.", + "200": { + "description": "Returns the paged result found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "maxItems": 2147483647, + "minItems": 0, + "type": "array", + "items": { + "$ref": "#/components/schemas/BpnEdcMappingResponse" + } } } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -495,8 +500,8 @@ } } }, - "429": { - "description": "Too many requests.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -505,23 +510,18 @@ } } }, - "200": { - "description": "Returns the paged result found", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { - "maxItems": 2147483647, - "minItems": 0, - "type": "array", - "items": { - "$ref": "#/components/schemas/BpnEdcMappingResponse" - } + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -530,8 +530,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -572,8 +572,8 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -582,8 +582,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -592,8 +592,8 @@ } } }, - "500": { - "description": "Internal server error.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -602,8 +602,8 @@ } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -612,8 +612,8 @@ } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -622,8 +622,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -647,8 +647,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -689,8 +689,8 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -699,8 +699,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -709,8 +709,8 @@ } } }, - "500": { - "description": "Internal server error.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -719,8 +719,8 @@ } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -729,8 +729,8 @@ } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -739,8 +739,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -764,8 +764,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -803,8 +803,8 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -813,8 +813,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -823,8 +823,8 @@ } } }, - "500": { - "description": "Internal server error.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -833,8 +833,8 @@ } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -843,8 +843,8 @@ } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -853,18 +853,18 @@ } } }, - "404": { - "description": "Not found.", + "200": { + "description": "Returns submodel payload", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "type": "string" } } } }, - "400": { - "description": "Bad request.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -873,12 +873,12 @@ } } }, - "200": { - "description": "Returns submodel payload", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/ErrorResponse" } } } @@ -920,16 +920,6 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -950,16 +940,6 @@ } } }, - "403": { - "description": "Forbidden.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "200": { "description": "Ok." }, @@ -995,6 +975,26 @@ }, "204": { "description": "No Content." + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1025,16 +1025,6 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -1055,8 +1045,8 @@ } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -1065,8 +1055,8 @@ } } }, - "429": { - "description": "Too many requests.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -1075,8 +1065,8 @@ } } }, - "404": { - "description": "Not found.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -1085,8 +1075,8 @@ } } }, - "400": { - "description": "Bad request.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -1104,6 +1094,16 @@ } } } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1145,8 +1145,8 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -1155,8 +1155,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -1165,8 +1165,11 @@ } } }, - "500": { - "description": "Internal server error.", + "204": { + "description": "No content." + }, + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -1175,8 +1178,8 @@ } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -1185,8 +1188,8 @@ } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -1195,8 +1198,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -1205,8 +1208,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -1214,9 +1217,6 @@ } } } - }, - "204": { - "description": "No content." } }, "security": [ @@ -1258,8 +1258,8 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -1268,8 +1268,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -1278,8 +1278,14 @@ } } }, - "500": { - "description": "Internal server error.", + "200": { + "description": "Ok." + }, + "204": { + "description": "No content." + }, + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -1288,8 +1294,8 @@ } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -1298,11 +1304,8 @@ } } }, - "200": { - "description": "Ok." - }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -1311,8 +1314,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -1321,8 +1324,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -1330,9 +1333,6 @@ } } } - }, - "204": { - "description": "No content." } }, "security": [ @@ -1364,8 +1364,8 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -1374,8 +1374,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -1384,8 +1384,11 @@ } } }, - "500": { - "description": "Internal server error.", + "200": { + "description": "Ok." + }, + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -1394,8 +1397,11 @@ } } }, - "403": { - "description": "Forbidden.", + "204": { + "description": "No content." + }, + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -1404,11 +1410,8 @@ } } }, - "200": { - "description": "Ok." - }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -1417,8 +1420,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -1427,11 +1430,8 @@ } } }, - "204": { - "description": "No content." - }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -1470,16 +1470,6 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -1500,16 +1490,6 @@ } } }, - "403": { - "description": "Forbidden.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "200": { "description": "Ok." }, @@ -1523,6 +1503,9 @@ } } }, + "204": { + "description": "No content." + }, "404": { "description": "Not found.", "content": { @@ -1533,9 +1516,6 @@ } } }, - "204": { - "description": "No content." - }, "400": { "description": "Bad request.", "content": { @@ -1545,18 +1525,38 @@ } } } - } - }, - "security": [ - { - "oAuth2": [ - "profile email" - ] - } - ] - } - }, - "/notifications/filter": { + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security": [ + { + "oAuth2": [ + "profile email" + ] + } + ] + } + }, + "/notifications/filter": { "post": { "tags": [ "Notifications" @@ -1575,16 +1575,6 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -1752,8 +1742,8 @@ } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -1762,8 +1752,8 @@ } } }, - "429": { - "description": "Too many requests.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -1772,8 +1762,8 @@ } } }, - "404": { - "description": "Not found.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -1782,8 +1772,18 @@ } } }, - "400": { - "description": "Bad request.", + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -1821,16 +1821,6 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -1851,8 +1841,8 @@ } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -1861,8 +1851,8 @@ } } }, - "429": { - "description": "Too many requests.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -1871,8 +1861,8 @@ } } }, - "404": { - "description": "Not found.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -1881,8 +1871,8 @@ } } }, - "400": { - "description": "Bad request.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -1900,6 +1890,16 @@ } } } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1943,95 +1943,95 @@ } } }, - "415": { - "description": "Unsupported media type.", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { "type": "string", "example": { - "message": "Unsupported media type." + "message": "Internal server error." } } } } }, - "200": { - "description": "Ok.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { - "maxItems": 2147483647, - "minItems": 0, - "type": "array", - "description": "PageResults", - "items": { - "$ref": "#/components/schemas/PageResultContractResponse" + "type": "string", + "example": { + "message": "Not found." } } } } }, - "400": { - "description": "Bad request.", + "200": { + "description": "Ok.", "content": { "application/json": { "schema": { - "type": "string", - "example": { - "message": "Bad request." + "maxItems": 2147483647, + "minItems": 0, + "type": "array", + "description": "PageResults", + "items": { + "$ref": "#/components/schemas/PageResultContractResponse" } } } } }, - "500": { - "description": "Internal server error.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { "type": "string", "example": { - "message": "Internal server error." + "message": "Authorization failed." } } } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { "type": "string", "example": { - "message": "Not found." + "message": "Forbidden." } } } } }, - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type.", "content": { "application/json": { "schema": { "type": "string", "example": { - "message": "Authorization failed." + "message": "Unsupported media type." } } } } }, - "403": { - "description": "Forbidden.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { "type": "string", "example": { - "message": "Forbidden." + "message": "Bad request." } } } @@ -2078,15 +2078,8 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } + "204": { + "description": "No Content." }, "415": { "description": "Unsupported media type", @@ -2108,8 +2101,8 @@ } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -2118,8 +2111,8 @@ } } }, - "429": { - "description": "Too many requests.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -2128,16 +2121,18 @@ } } }, - "200": { - "description": "OK.", + "400": { + "description": "Bad request.", "content": { "application/json": { - + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -2146,11 +2141,16 @@ } } }, - "204": { - "description": "No Content." + "200": { + "description": "OK.", + "content": { + "application/json": { + + } + } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -2196,18 +2196,21 @@ } }, "responses": { - "200": { - "description": "OK.", + "204": { + "description": "No Content." + }, + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ImportResponse" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "401": { - "description": "Authorization failed.", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -2216,8 +2219,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -2226,18 +2229,18 @@ } } }, - "500": { - "description": "Internal server error.", + "200": { + "description": "OK.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "$ref": "#/components/schemas/ImportResponse" } } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -2246,8 +2249,8 @@ } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -2256,8 +2259,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -2266,11 +2269,8 @@ } } }, - "204": { - "description": "No Content." - }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -2308,16 +2308,6 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -2338,6 +2328,36 @@ } } }, + "429": { + "description": "Too many requests.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "403": { "description": "Forbidden.", "content": { @@ -2348,6 +2368,69 @@ } } }, + "201": { + "description": "Created." + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security": [ + { + "oAuth2": [ + "profile email" + ] + } + ] + } + }, + "/assets/as-planned/searchable-values": { + "post": { + "tags": [ + "Assets", + "AssetsAsPlanned" + ], + "summary": "Get searchable values for a fieldName", + "description": "The endpoint returns searchable values for given fieldName.", + "operationId": "searchable-values", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchableAssetsRequest" + } + } + }, + "required": true + }, + "responses": { + "415": { + "description": "Unsupported media type", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "429": { "description": "Too many requests.", "content": { @@ -2378,8 +2461,40 @@ } } }, - "201": { - "description": "Created." + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "Returns searchable values for given fieldName.", + "content": { + "application/json": { + "schema": { + "maxItems": 2147483647, + "minItems": 0, + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -2410,16 +2525,6 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -2440,8 +2545,8 @@ } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -2642,8 +2747,8 @@ } } }, - "429": { - "description": "Too many requests.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -2652,8 +2757,8 @@ } } }, - "404": { - "description": "Not found.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -2662,8 +2767,18 @@ } } }, - "400": { - "description": "Bad request.", + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -2701,8 +2816,8 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -2711,8 +2826,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -2721,8 +2836,8 @@ } } }, - "500": { - "description": "Internal server error.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -2731,8 +2846,8 @@ } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -2741,8 +2856,8 @@ } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -2751,8 +2866,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -2761,8 +2876,11 @@ } } }, - "400": { - "description": "Bad request.", + "201": { + "description": "Created." + }, + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -2770,9 +2888,6 @@ } } } - }, - "201": { - "description": "Created." } }, "security": [ @@ -2784,27 +2899,28 @@ ] } }, - "/assets/as-built/detail-information": { + "/assets/as-built/searchable-values": { "post": { "tags": [ - "AssetsAsBuilt" + "AssetsAsBuilt", + "Assets" ], - "summary": "Searches for assets by ids.", - "description": "The endpoint searchs for assets by id and returns a list of them.", - "operationId": "getDetailInformation_1", + "summary": "Get searchable values for a fieldName", + "description": "The endpoint returns searchable values for given fieldName.", + "operationId": "searchable-values_1", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GetDetailInformationRequest" + "$ref": "#/components/schemas/SearchableAssetsRequest" } } }, "required": true }, "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -2813,8 +2929,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -2823,8 +2939,8 @@ } } }, - "500": { - "description": "Internal server error.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -2833,8 +2949,8 @@ } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -2843,8 +2959,8 @@ } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -2853,8 +2969,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -2864,7 +2980,7 @@ } }, "200": { - "description": "Returns the paged result found for Asset", + "description": "Returns searchable values for given fieldName.", "content": { "application/json": { "schema": { @@ -2872,36 +2988,150 @@ "minItems": 0, "type": "array", "items": { - "maxItems": 2147483647, - "type": "array", - "description": "Assets", - "items": { - "type": "object", - "properties": { - "id": { - "maxLength": 255, - "minLength": 0, - "type": "string", - "example": "urn:uuid:ceb6b964-5779-49c1-b5e9-0ee70528fcbd" - }, - "idShort": { - "maxLength": 255, - "minLength": 0, - "type": "string", - "example": "assembly-part-relationship" - }, - "semanticModelId": { - "maxLength": 255, - "minLength": 0, - "type": "string", - "example": "NO-246880451848384868750731" - }, - "businessPartner": { - "maxLength": 255, - "minLength": 0, - "type": "string", - "example": "BPNL00000003CSGV" - }, + "type": "string" + } + } + } + } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security": [ + { + "oAuth2": [ + "profile email" + ] + } + ] + } + }, + "/assets/as-built/detail-information": { + "post": { + "tags": [ + "AssetsAsBuilt" + ], + "summary": "Searches for assets by ids.", + "description": "The endpoint searchs for assets by id and returns a list of them.", + "operationId": "getDetailInformation_1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetDetailInformationRequest" + } + } + }, + "required": true + }, + "responses": { + "415": { + "description": "Unsupported media type", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many requests.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "Returns the paged result found for Asset", + "content": { + "application/json": { + "schema": { + "maxItems": 2147483647, + "minItems": 0, + "type": "array", + "items": { + "maxItems": 2147483647, + "type": "array", + "description": "Assets", + "items": { + "type": "object", + "properties": { + "id": { + "maxLength": 255, + "minLength": 0, + "type": "string", + "example": "urn:uuid:ceb6b964-5779-49c1-b5e9-0ee70528fcbd" + }, + "idShort": { + "maxLength": 255, + "minLength": 0, + "type": "string", + "example": "assembly-part-relationship" + }, + "semanticModelId": { + "maxLength": 255, + "minLength": 0, + "type": "string", + "example": "NO-246880451848384868750731" + }, + "businessPartner": { + "maxLength": 255, + "minLength": 0, + "type": "string", + "example": "BPNL00000003CSGV" + }, "manufacturerName": { "maxLength": 255, "minLength": 0, @@ -3055,8 +3285,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -3094,76 +3324,6 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "415": { - "description": "Unsupported media type", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Internal server error.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "403": { - "description": "Forbidden.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "429": { - "description": "Too many requests.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "404": { - "description": "Not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "200": { "description": "Returns the assets found", "content": { @@ -3350,6 +3510,76 @@ } } } + }, + "415": { + "description": "Unsupported media type", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "429": { + "description": "Too many requests.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3388,16 +3618,6 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -3418,16 +3638,6 @@ } } }, - "403": { - "description": "Forbidden.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "200": { "description": "Returns the updated asset", "content": { @@ -3644,6 +3854,26 @@ } } } + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3660,50 +3890,20 @@ "tags": [ "AssetsAsBuilt" ], - "summary": "Get asset by id", - "description": "The endpoint returns an asset filtered by id .", - "operationId": "assetById_1", - "parameters": [ - { - "name": "assetId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "415": { - "description": "Unsupported media type", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Internal server error.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } + "summary": "Get asset by id", + "description": "The endpoint returns an asset filtered by id .", + "operationId": "assetById_1", + "parameters": [ + { + "name": "assetId", + "in": "path", + "required": true, + "schema": { + "type": "string" } - }, + } + ], + "responses": { "200": { "description": "Returns the assets found", "content": { @@ -3891,8 +4091,18 @@ } } }, - "403": { - "description": "Forbidden.", + "415": { + "description": "Unsupported media type", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -3930,6 +4140,26 @@ } } } + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3968,16 +4198,6 @@ "required": true }, "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -3998,8 +4218,8 @@ } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -4195,8 +4415,8 @@ } } }, - "429": { - "description": "Too many requests.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -4205,8 +4425,8 @@ } } }, - "404": { - "description": "Not found.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -4215,8 +4435,18 @@ } } }, - "400": { - "description": "Bad request.", + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -4244,8 +4474,8 @@ "description": "The endpoint Triggers reload of shell descriptors.", "operationId": "reload", "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -4254,8 +4484,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -4264,8 +4494,11 @@ } } }, - "500": { - "description": "Internal server error.", + "202": { + "description": "Created registry reload job." + }, + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -4274,8 +4507,8 @@ } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -4284,8 +4517,8 @@ } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -4294,11 +4527,8 @@ } } }, - "202": { - "description": "Created registry reload job." - }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -4307,8 +4537,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -4346,8 +4576,8 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -4356,8 +4586,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -4366,18 +4596,18 @@ } } }, - "500": { - "description": "Internal server error.", + "200": { + "description": "Returns the policies", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "$ref": "#/components/schemas/PolicyResponse" } } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -4386,18 +4616,18 @@ } } }, - "200": { - "description": "OK.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PolicyResponse" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -4406,8 +4636,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -4416,8 +4646,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -4453,13 +4683,11 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", + "200": { + "description": "Deletion successful", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } + } } }, @@ -4483,8 +4711,8 @@ } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -4493,8 +4721,8 @@ } } }, - "429": { - "description": "Too many requests.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -4503,8 +4731,8 @@ } } }, - "404": { - "description": "Not found.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -4513,8 +4741,8 @@ } } }, - "400": { - "description": "Bad request.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -4523,11 +4751,13 @@ } } }, - "200": { - "description": "Deletion successful", + "401": { + "description": "Authorization failed.", "content": { "application/json": { - + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } } @@ -4561,16 +4791,6 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -4591,16 +4811,6 @@ } } }, - "403": { - "description": "Forbidden.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "200": { "description": "OK.", "content": { @@ -4645,6 +4855,26 @@ } } } + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4704,8 +4934,8 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -4714,8 +4944,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -4724,8 +4954,8 @@ } } }, - "500": { - "description": "Internal server error.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -4734,23 +4964,18 @@ } } }, - "200": { - "description": "Returns a distinct filter values for given fieldName.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { - "maxItems": 2147483647, - "minItems": 0, - "type": "array", - "items": { - "type": "string" - } + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "403": { - "description": "Forbidden.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -4759,18 +4984,23 @@ } } }, - "429": { - "description": "Too many requests.", + "200": { + "description": "Returns a distinct filter values for given fieldName.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "maxItems": 2147483647, + "minItems": 0, + "type": "array", + "items": { + "type": "string" + } } } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -4779,8 +5009,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -4808,16 +5038,6 @@ "description": "The endpoint can return limited data based on the user role", "operationId": "dashboard", "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -4848,8 +5068,8 @@ } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -4858,8 +5078,8 @@ } } }, - "429": { - "description": "Too many requests.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -4868,8 +5088,8 @@ } } }, - "404": { - "description": "Not found.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -4878,8 +5098,18 @@ } } }, - "400": { - "description": "Bad request.", + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -4918,16 +5148,19 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", + "200": { + "description": "OK.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "$ref": "#/components/schemas/ImportReportResponse" } } } }, + "204": { + "description": "No Content." + }, "415": { "description": "Unsupported media type", "content": { @@ -4948,18 +5181,18 @@ } } }, - "200": { - "description": "OK.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ImportReportResponse" + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -4968,8 +5201,8 @@ } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -4978,8 +5211,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -4988,11 +5221,8 @@ } } }, - "204": { - "description": "No Content." - }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -5038,16 +5268,6 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -5068,8 +5288,8 @@ } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -5078,8 +5298,8 @@ } } }, - "429": { - "description": "Too many requests.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -5088,8 +5308,8 @@ } } }, - "404": { - "description": "Not found.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -5274,171 +5494,24 @@ "importNote": { "type": "string", "example": "Asset created successfully in transient state" - }, - "tombstone": { - "type": "string", - "example": " {\n \"catenaXId\": \"urn:uuid:7e4541ea-bb0f-464c-8cb3-021abccbfaf5\",\n \"endpointURL\": \"https://irs-provider-dataplane3.dev.demo.catena-x.net/api/public/data/urn:uuid:c7b3ea3d-97ea-41e4-960d-12fb166e1da1\",\n \"processingError\": {\n \"processStep\": \"SubmodelRequest\",\n \"errorDetail\": \"org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 : \"{\"errors\":[]}\"\",\n \"lastAttempt\": \"2024-02-07T12:06:34.400493282Z\",\n \"retryCounter\": 0\n },\n \"policy\": null\n }\n" - }, - "contractAgreementId": { - "type": "string", - "example": "TODO" - } - } - } - } - } - } - } - }, - "400": { - "description": "Bad request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - }, - "security": [ - { - "oAuth2": [ - "profile email" - ] - } - ] - } - }, - "/assets/as-planned/distinctFilterValues": { - "get": { - "tags": [ - "Assets", - "AssetsAsPlanned" - ], - "summary": "getDistinctFilterValues", - "description": "The endpoint returns a distinct filter values for given fieldName.", - "operationId": "distinctFilterValues_1", - "parameters": [ - { - "name": "fieldName", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "startWith", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "owner", - "in": "query", - "required": false, - "schema": { - "type": "string", - "enum": [ - "SUPPLIER", - "CUSTOMER", - "OWN", - "UNKNOWN" - ] - } - }, - { - "name": "inAssetIds", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "415": { - "description": "Unsupported media type", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Internal server error.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "200": { - "description": "Returns a distinct filter values for given fieldName.", - "content": { - "application/json": { - "schema": { - "maxItems": 2147483647, - "minItems": 0, - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "403": { - "description": "Forbidden.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "429": { - "description": "Too many requests.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + }, + "tombstone": { + "type": "string", + "example": " {\n \"catenaXId\": \"urn:uuid:7e4541ea-bb0f-464c-8cb3-021abccbfaf5\",\n \"endpointURL\": \"https://irs-provider-dataplane3.dev.demo.catena-x.net/api/public/data/urn:uuid:c7b3ea3d-97ea-41e4-960d-12fb166e1da1\",\n \"processingError\": {\n \"processStep\": \"SubmodelRequest\",\n \"errorDetail\": \"org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 : \"{\"errors\":[]}\"\",\n \"lastAttempt\": \"2024-02-07T12:06:34.400493282Z\",\n \"retryCounter\": 0\n },\n \"policy\": null\n }\n" + }, + "contractAgreementId": { + "type": "string", + "example": "TODO" + } + } + } + } } } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -5447,8 +5520,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -5486,16 +5559,6 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -5516,26 +5579,6 @@ } } }, - "403": { - "description": "Forbidden.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "429": { - "description": "Too many requests.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "200": { "description": "Returns the asset by childId", "content": { @@ -5723,6 +5766,16 @@ } } }, + "429": { + "description": "Too many requests.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "404": { "description": "Not found.", "content": { @@ -5742,6 +5795,26 @@ } } } + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -5780,66 +5853,6 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "415": { - "description": "Unsupported media type", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Internal server error.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "403": { - "description": "Forbidden.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "429": { - "description": "Too many requests.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "404": { - "description": "Not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "200": { "description": "Returns the paged result found for Asset", "content": { @@ -5993,133 +6006,41 @@ } }, "receivedQualityInvestigationIdsInStatusActive": { - "type": "array", - "example": 2, - "items": { - "type": "integer", - "format": "int64", - "example": 2 - } - }, - "importState": { - "type": "string", - "example": "TRANSIENT", - "enum": [ - "TRANSIENT", - "PERSISTENT", - "ERROR", - "IN_SYNCHRONIZATION", - "PUBLISHED_TO_CORE_SERVICES", - "UNSET" - ] - }, - "importNote": { - "type": "string", - "example": "Asset created successfully in transient state" - }, - "tombstone": { - "type": "string", - "example": " {\n \"catenaXId\": \"urn:uuid:7e4541ea-bb0f-464c-8cb3-021abccbfaf5\",\n \"endpointURL\": \"https://irs-provider-dataplane3.dev.demo.catena-x.net/api/public/data/urn:uuid:c7b3ea3d-97ea-41e4-960d-12fb166e1da1\",\n \"processingError\": {\n \"processStep\": \"SubmodelRequest\",\n \"errorDetail\": \"org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 : \"{\"errors\":[]}\"\",\n \"lastAttempt\": \"2024-02-07T12:06:34.400493282Z\",\n \"retryCounter\": 0\n },\n \"policy\": null\n }\n" - }, - "contractAgreementId": { - "type": "string", - "example": "TODO" - } - } - } - } - } - } - } - }, - "400": { - "description": "Bad request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - }, - "security": [ - { - "oAuth2": [ - "profile email" - ] - } - ] - } - }, - "/assets/as-built/distinctFilterValues": { - "get": { - "tags": [ - "AssetsAsBuilt", - "Assets" - ], - "summary": "getDistinctFilterValues", - "description": "The endpoint returns a distinct filter values for given fieldName.", - "operationId": "distinctFilterValues_2", - "parameters": [ - { - "name": "fieldName", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "startWith", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "owner", - "in": "query", - "required": false, - "schema": { - "type": "string", - "enum": [ - "SUPPLIER", - "CUSTOMER", - "OWN", - "UNKNOWN" - ] - } - }, - { - "name": "inAssetIds", - "in": "query", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "type": "array", + "example": 2, + "items": { + "type": "integer", + "format": "int64", + "example": 2 + } + }, + "importState": { + "type": "string", + "example": "TRANSIENT", + "enum": [ + "TRANSIENT", + "PERSISTENT", + "ERROR", + "IN_SYNCHRONIZATION", + "PUBLISHED_TO_CORE_SERVICES", + "UNSET" + ] + }, + "importNote": { + "type": "string", + "example": "Asset created successfully in transient state" + }, + "tombstone": { + "type": "string", + "example": " {\n \"catenaXId\": \"urn:uuid:7e4541ea-bb0f-464c-8cb3-021abccbfaf5\",\n \"endpointURL\": \"https://irs-provider-dataplane3.dev.demo.catena-x.net/api/public/data/urn:uuid:c7b3ea3d-97ea-41e4-960d-12fb166e1da1\",\n \"processingError\": {\n \"processStep\": \"SubmodelRequest\",\n \"errorDetail\": \"org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 : \"{\"errors\":[]}\"\",\n \"lastAttempt\": \"2024-02-07T12:06:34.400493282Z\",\n \"retryCounter\": 0\n },\n \"policy\": null\n }\n" + }, + "contractAgreementId": { + "type": "string", + "example": "TODO" + } + } + } + } } } } @@ -6144,23 +6065,18 @@ } } }, - "200": { - "description": "Returns a distinct filter values for given fieldName.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { - "maxItems": 2147483647, - "minItems": 0, - "type": "array", - "items": { - "type": "string" - } + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -6169,8 +6085,8 @@ } } }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -6179,8 +6095,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -6189,8 +6105,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -6218,8 +6134,8 @@ "description": "The endpoint returns a map for assets consumed by the map.", "operationId": "assetsCountryMap", "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -6228,8 +6144,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -6238,18 +6154,23 @@ } } }, - "500": { - "description": "Internal server error.", + "200": { + "description": "Returns the assets found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "maxItems": 2147483647, + "minItems": 0, + "type": "array", + "items": { + "type": "string" + } } } } }, - "403": { - "description": "Forbidden.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -6258,8 +6179,8 @@ } } }, - "429": { - "description": "Too many requests.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -6268,23 +6189,18 @@ } } }, - "200": { - "description": "Returns the assets found", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { - "maxItems": 2147483647, - "minItems": 0, - "type": "array", - "items": { - "type": "string" - } + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -6293,8 +6209,8 @@ } } }, - "400": { - "description": "Bad request.", + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -6332,16 +6248,6 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -6362,16 +6268,6 @@ } } }, - "403": { - "description": "Forbidden.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "200": { "description": "Returns the asset by childId", "content": { @@ -6588,6 +6484,26 @@ } } } + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -6608,16 +6524,6 @@ "description": "Deletes all submodels from the system.", "operationId": "deleteSubmodels", "responses": { - "401": { - "description": "Authorization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "415": { "description": "Unsupported media type", "content": { @@ -6638,16 +6544,6 @@ } } }, - "403": { - "description": "Forbidden.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, "200": { "description": "Ok." }, @@ -6683,6 +6579,26 @@ }, "204": { "description": "No Content." + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Authorization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -6713,8 +6629,8 @@ } ], "responses": { - "401": { - "description": "Authorization failed.", + "415": { + "description": "Unsupported media type", "content": { "application/json": { "schema": { @@ -6723,8 +6639,8 @@ } } }, - "415": { - "description": "Unsupported media type", + "500": { + "description": "Internal server error.", "content": { "application/json": { "schema": { @@ -6733,8 +6649,8 @@ } } }, - "500": { - "description": "Internal server error.", + "429": { + "description": "Too many requests.", "content": { "application/json": { "schema": { @@ -6746,8 +6662,8 @@ "204": { "description": "Deleted." }, - "403": { - "description": "Forbidden.", + "404": { + "description": "Not found.", "content": { "application/json": { "schema": { @@ -6756,11 +6672,8 @@ } } }, - "200": { - "description": "Okay" - }, - "429": { - "description": "Too many requests.", + "400": { + "description": "Bad request.", "content": { "application/json": { "schema": { @@ -6769,8 +6682,8 @@ } } }, - "404": { - "description": "Not found.", + "403": { + "description": "Forbidden.", "content": { "application/json": { "schema": { @@ -6779,8 +6692,11 @@ } } }, - "400": { - "description": "Bad request.", + "200": { + "description": "Okay" + }, + "401": { + "description": "Authorization failed.", "content": { "application/json": { "schema": { @@ -6935,7 +6851,7 @@ "operator": { "$ref": "#/components/schemas/Operator" }, - "odrl:rightOperand": { + "rightOperand": { "type": "string", "example": "string" } @@ -7488,6 +7404,14 @@ "maxLength": 255, "type": "string", "example": "{\\\"@id\\\":\\\"eb0c8486-914a-4d36-84c0-b4971cbc52e4\\\",\\\"@type\\\":\\\"odrl:Set\\\",\\\"odrl:permission\\\":{\\\"odrl:target\\\":\\\"registry-asset\\\",\\\"odrl:action\\\":{\\\"odrl:type\\\":\\\"USE\\\"},\\\"odrl:constraint\\\":{\\\"odrl:or\\\":{\\\"odrl:leftOperand\\\":\\\"PURPOSE\\\",\\\"odrl:operator\\\":{\\\"@id\\\":\\\"odrl:eq\\\"},\\\"odrl:rightOperand\\\":\\\"ID 3.0 Trace\\\"}}},\\\"odrl:prohibition\\\":[],\\\"odrl:obligation\\\":[],\\\"odrl:target\\\":\\\"registry-asset\\\"}" + }, + "contractType": { + "type": "string", + "enum": [ + "ASSET_AS_PLANNED", + "ASSET_AS_BUILT", + "NOTIFICATION" + ] } } }, @@ -7600,6 +7524,45 @@ } } }, + "SearchableAssetsRequest": { + "required": [ + "fieldName" + ], + "type": "object", + "properties": { + "fieldName": { + "type": "string" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "startWith": { + "type": "string" + }, + "owner": { + "type": "string", + "enum": [ + "SUPPLIER", + "CUSTOMER", + "OWN", + "UNKNOWN" + ] + }, + "inAssetIds": { + "maxItems": 100, + "minItems": 1, + "type": "array", + "example": [ + "urn:uuid:ceb6b964-5779-49c1-b5e9-0ee70528fcbd" + ], + "items": { + "type": "string", + "example": "[\"urn:uuid:ceb6b964-5779-49c1-b5e9-0ee70528fcbd\"]" + } + } + } + }, "GetDetailInformationRequest": { "type": "object", "properties": { diff --git a/frontend/src/app/modules/shared/components/multi-select-autocomplete/autocomplete-strategy.ts b/frontend/src/app/modules/shared/components/multi-select-autocomplete/autocomplete-strategy.ts index 15183bcac9..3f7cb0a652 100644 --- a/frontend/src/app/modules/shared/components/multi-select-autocomplete/autocomplete-strategy.ts +++ b/frontend/src/app/modules/shared/components/multi-select-autocomplete/autocomplete-strategy.ts @@ -45,7 +45,7 @@ export class PartsStrategy extends AutocompleteStrategy { return of([]); } - return this.partsService.getDistinctFilterValues( + return this.partsService.getSearchableValues( asBuilt, filterColumns, searchElement, @@ -67,7 +67,7 @@ export class NotificationStrategy extends AutocompleteStrategy { retrieveSuggestionValues(tableType: TableType, filterColumns: string, searchElement: string): any { const notificationChannel = channelOfNotification(tableType); - return this.notificationService.getDistinctFilterValues( + return this.notificationService.getSearchableValues( notificationChannel, filterColumns, searchElement, diff --git a/frontend/src/app/modules/shared/service/notification.service.spec.ts b/frontend/src/app/modules/shared/service/notification.service.spec.ts index 73afe30ada..eca17c43e3 100644 --- a/frontend/src/app/modules/shared/service/notification.service.spec.ts +++ b/frontend/src/app/modules/shared/service/notification.service.spec.ts @@ -115,18 +115,24 @@ describe('NotificationService', () => { req.flush({}); }); - it('should get distinct filter values', () => { + it('should get searchable values', () => { const channel: NotificationChannel = NotificationChannel.SENDER; - const fieldNames = 'SomeField'; + const fieldName = 'SomeField'; const startsWith = 'Test'; spyOn(authService, 'getBearerToken').and.returnValue('testtoken'); - service.getDistinctFilterValues(channel, fieldNames, startsWith).subscribe(); + service.getSearchableValues(channel, fieldName, startsWith).subscribe(); const req = httpTestingController.expectOne( - `${ service.notificationUrl() }/distinctFilterValues?fieldName=SomeField&startWith=Test&size=200&channel=SENDER`, + `${ service.notificationUrl() }/searchable-values`, ); - expect(req.request.method).toBe('GET'); + expect(req.request.method).toBe('POST'); + expect(req.request.body).toEqual(JSON.stringify({ + 'fieldName': fieldName, + 'startWith': startsWith, + 'size': 200, + 'channel': channel, + })); req.flush({}); }); }); diff --git a/frontend/src/app/modules/shared/service/notification.service.ts b/frontend/src/app/modules/shared/service/notification.service.ts index 2f58191468..2c2410afbb 100644 --- a/frontend/src/app/modules/shared/service/notification.service.ts +++ b/frontend/src/app/modules/shared/service/notification.service.ts @@ -17,7 +17,6 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { HttpParams } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { ApiService } from '@core/api/api.service'; import { environment } from '@env'; @@ -83,7 +82,15 @@ export class NotificationService { ): Observable { const targetDate = dateString?.length > 0 ? new Date(dateString).toISOString() : null; const upperCaseType = type ? type.toUpperCase() : null; - const body = { affectedPartIds, description, severity, receiverBpn: bpn, type: upperCaseType, title: title === "" ? null: title, targetDate }; + const body = { + affectedPartIds, + description, + severity, + receiverBpn: bpn, + type: upperCaseType, + title: title === '' ? null : title, + targetDate, + }; return this.apiService.post(`${ this.url }/notifications`, body).pipe(map(({ id }) => id)); } @@ -141,23 +148,30 @@ export class NotificationService { if (targetDate?.length > 0) { targetDate = new Date(targetDate).toISOString(); } - const body = { title: title === "" ? null: title, receiverBpn: receiverBpn, severity, targetDate, description, affectedPartIds: affectedPartIds }; + const body = { + title: title === '' ? null : title, + receiverBpn: receiverBpn, + severity, + targetDate, + description, + affectedPartIds: affectedPartIds, + }; return this.apiService.put(`${ requestUrl }/${ notificationId }/edit`, body); } - public getDistinctFilterValues(channel: NotificationChannel, fieldNames: string, startsWith: string) { + public getSearchableValues(channel: NotificationChannel, fieldNames: string, startsWith: string) { const mappedFieldName = PartsAssembler.mapFieldNameToApi(fieldNames); const requestUrl = this.notificationUrl(); - let params = new HttpParams() - .set('fieldName', mappedFieldName) - .set('startWith', startsWith) - .set('size', 200) - .set('channel', channel); - return this.apiService - .getBy(`${ requestUrl }/distinctFilterValues`, params); + const body = { + 'fieldName': mappedFieldName, + 'startWith': startsWith, + 'size': 200, + 'channel': channel, + }; + return this.apiService.post(`${ requestUrl }/searchable-values`, body); } public notificationUrl(): string { diff --git a/frontend/src/app/modules/shared/service/parts.service.ts b/frontend/src/app/modules/shared/service/parts.service.ts index 4b508e92de..fcecef0bbb 100644 --- a/frontend/src/app/modules/shared/service/parts.service.ts +++ b/frontend/src/app/modules/shared/service/parts.service.ts @@ -159,22 +159,22 @@ export class PartsService { } - public getDistinctFilterValues(isAsBuilt: boolean, fieldNames: string, startsWith: string, inAssetIds?: string[]) { + public getSearchableValues(isAsBuilt: boolean, fieldNames: string, startsWith: string, inAssetIds?: string[]) { const mappedFieldName = PartsAssembler.mapFieldNameToApi(fieldNames); - let params = new HttpParams() - .set('fieldName', mappedFieldName) - .set('startWith', startsWith) - .set('size', 200) - .set('inAssetIds', inAssetIds ? inAssetIds.join(',') : ''); + + const body = { + "fieldName": mappedFieldName, + "startWith": startsWith, + "size": 200, + "inAssetIds": inAssetIds ? inAssetIds : [] + } if (isAsBuilt) { return this.apiService - .getBy(`${ this.url }/assets/as-built/distinctFilterValues`, params); + .post(`${ this.url }/assets/as-built/searchable-values`, body); } else { return this.apiService - .getBy(`${ this.url }/assets/as-planned/distinctFilterValues`, params); - - + .post(`${ this.url }/assets/as-planned/searchable-values`, body); } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java index 2e064dc1f0..b952503acb 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java @@ -22,6 +22,7 @@ package org.eclipse.tractusx.traceability.assets.application.asbuilt.rest; import assets.importpoc.ErrorResponse; +import assets.request.SearchableAssetsRequest; import assets.response.asbuilt.AssetAsBuiltResponse; import assets.response.base.request.UpdateAssetRequest; import io.swagger.v3.oas.annotations.Operation; @@ -33,30 +34,21 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; -import org.apache.commons.lang3.ArrayUtils; import org.eclipse.tractusx.traceability.assets.application.asbuilt.mapper.AssetAsBuiltFieldMapper; import org.eclipse.tractusx.traceability.assets.application.asbuilt.mapper.AssetAsBuiltResponseMapper; import org.eclipse.tractusx.traceability.assets.application.asbuilt.mapper.QualityTypeMapper; +import org.eclipse.tractusx.traceability.assets.application.base.mapper.OwnerTypeMapper; import org.eclipse.tractusx.traceability.assets.application.base.request.GetDetailInformationRequest; import org.eclipse.tractusx.traceability.assets.application.base.request.SyncAssetsRequest; import org.eclipse.tractusx.traceability.assets.application.base.service.AssetBaseService; -import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.common.model.BaseRequestFieldMapper; import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.request.OwnPageable; import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PatchMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -196,16 +188,16 @@ public PageResult assets(OwnPageable pageable, SearchCrite } - @Operation(operationId = "distinctFilterValues", - summary = "getDistinctFilterValues", + @Operation(operationId = "searchable-values", + summary = "Get searchable values for a fieldName", tags = {"Assets"}, - description = "The endpoint returns a distinct filter values for given fieldName.", + description = "The endpoint returns searchable values for given fieldName.", security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns a distinct filter values for given fieldName.", content = @Content( + @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns searchable values for given fieldName.", content = @Content( mediaType = "application/json", array = @ArraySchema( schema = @Schema( - description = "FilterValues", + description = "SearchableValues", implementation = String.class, additionalProperties = Schema.AdditionalPropertiesValue.FALSE ), @@ -255,18 +247,10 @@ public PageResult assets(OwnPageable pageable, SearchCrite content = @Content( mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))}) - @GetMapping("distinctFilterValues") - public List distinctFilterValues( - @RequestParam("fieldName") String fieldName, - @RequestParam(value = "size", required = false) Integer size, - @RequestParam(value = "startWith", required = false) String startWith, - @RequestParam(value = "owner", required = false) Owner owner, - @RequestParam(value = "inAssetIds", required = false) String[] inAssetIds) { - List inAssetIdsList = List.of(); - if (ArrayUtils.isNotEmpty(inAssetIds)) { - inAssetIdsList = Arrays.asList(inAssetIds); - } - return assetBaseService.getDistinctFilterValues(fieldMapper.mapRequestFieldName(fieldName), startWith, size, owner, inAssetIdsList); + @PostMapping("searchable-values") + public List searchableValues(@Valid @RequestBody SearchableAssetsRequest request) { + return assetBaseService.getSearchableValues(fieldMapper.mapRequestFieldName(request.fieldName()), + request.startWith(), request.size(), OwnerTypeMapper.from(request.owner()), request.inAssetIds()); } @Operation(operationId = "assetsCountryMap", diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java index aed02fc597..165d8c9365 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java @@ -20,6 +20,7 @@ package org.eclipse.tractusx.traceability.assets.application.asplanned.rest; import assets.importpoc.ErrorResponse; +import assets.request.SearchableAssetsRequest; import assets.response.asplanned.AssetAsPlannedResponse; import assets.response.base.request.UpdateAssetRequest; import io.swagger.v3.oas.annotations.Operation; @@ -31,30 +32,21 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; -import org.apache.commons.lang3.ArrayUtils; import org.eclipse.tractusx.traceability.assets.application.asbuilt.mapper.QualityTypeMapper; import org.eclipse.tractusx.traceability.assets.application.asplanned.mapper.AssetAsPlannedFieldMapper; import org.eclipse.tractusx.traceability.assets.application.asplanned.mapper.AssetAsPlannedResponseMapper; +import org.eclipse.tractusx.traceability.assets.application.base.mapper.OwnerTypeMapper; import org.eclipse.tractusx.traceability.assets.application.base.request.GetDetailInformationRequest; import org.eclipse.tractusx.traceability.assets.application.base.request.SyncAssetsRequest; import org.eclipse.tractusx.traceability.assets.application.base.service.AssetBaseService; -import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.common.model.BaseRequestFieldMapper; import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.request.OwnPageable; import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PatchMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; -import java.util.Arrays; import java.util.List; @RestController @@ -192,16 +184,16 @@ public PageResult assets(OwnPageable pageable, SearchCri return AssetAsPlannedResponseMapper.from(assetService.getAssets(OwnPageable.toPageable(pageable, fieldMapper), filter.toSearchCriteria(fieldMapper))); } - @Operation(operationId = "distinctFilterValues", - summary = "getDistinctFilterValues", + @Operation(operationId = "searchable-values", + summary = "Get searchable values for a fieldName", tags = {"Assets"}, - description = "The endpoint returns a distinct filter values for given fieldName.", + description = "The endpoint returns searchable values for given fieldName.", security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns a distinct filter values for given fieldName.", content = @Content( + @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns searchable values for given fieldName.", content = @Content( mediaType = "application/json", array = @ArraySchema( schema = @Schema( - description = "FilterValues", + description = "SearchableValues", implementation = String.class, additionalProperties = Schema.AdditionalPropertiesValue.FALSE ), @@ -251,18 +243,10 @@ public PageResult assets(OwnPageable pageable, SearchCri content = @Content( mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))}) - @GetMapping("distinctFilterValues") - public List distinctFilterValues( - @RequestParam("fieldName") String fieldName, - @RequestParam(value = "size", required = false) Integer size, - @RequestParam(value = "startWith", required = false) String startWith, - @RequestParam(value = "owner", required = false) Owner owner, - @RequestParam(value = "inAssetIds", required = false) String[] inAssetIds) { - List inAssetIdsList = List.of(); - if (ArrayUtils.isNotEmpty(inAssetIds)) { - inAssetIdsList = Arrays.asList(inAssetIds); - } - return assetService.getDistinctFilterValues(fieldMapper.mapRequestFieldName(fieldName), startWith, size, owner, inAssetIdsList); + @PostMapping("searchable-values") + public List searchableValues(@Valid @RequestBody SearchableAssetsRequest request) { + return assetService.getSearchableValues(fieldMapper.mapRequestFieldName(request.fieldName()), + request.startWith(), request.size(), OwnerTypeMapper.from(request.owner()), request.inAssetIds()); } @Operation(operationId = "assetById", diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/mapper/OwnerTypeMapper.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/mapper/OwnerTypeMapper.java new file mode 100644 index 0000000000..c5e1748242 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/mapper/OwnerTypeMapper.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.assets.application.base.mapper; + +import assets.response.base.OwnerType; +import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; + +import static java.util.Objects.nonNull; + +public abstract class OwnerTypeMapper { + public static Owner from(final OwnerType type) { + if (nonNull(type)) { + return Owner.valueOf(type.name()); + } else return null; + } +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/service/AssetBaseService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/service/AssetBaseService.java index b2d27f2c9d..8f4d80e3a5 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/service/AssetBaseService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/service/AssetBaseService.java @@ -47,7 +47,7 @@ public interface AssetBaseService { AssetBase updateQualityType(String assetId, QualityType qualityType); - List getDistinctFilterValues(String fieldName, String startWith, Integer size, Owner owner, List inAssetIds); + List getSearchableValues(String fieldName, String startWith, Integer size, Owner owner, List inAssetIds); List getAssetIdsInImportState(ImportState... importStates); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java index 52c5467090..4b186474df 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java @@ -22,11 +22,7 @@ import org.eclipse.tractusx.traceability.assets.application.base.service.AssetBaseService; import org.eclipse.tractusx.traceability.assets.domain.base.AssetRepository; import org.eclipse.tractusx.traceability.assets.domain.base.JobRepository; -import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; -import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; -import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; -import org.eclipse.tractusx.traceability.assets.domain.base.model.QualityType; -import org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel; +import org.eclipse.tractusx.traceability.assets.domain.base.model.*; import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.model.ManufacturingInfo; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.request.BomLifecycle; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.Direction; @@ -117,7 +113,7 @@ public Map getAssetsCountryMap() { } @Override - public List getDistinctFilterValues(String fieldName, String startWith, Integer size, Owner owner, List inAssetIds) { + public List getSearchableValues(String fieldName, String startWith, Integer size, Owner owner, List inAssetIds) { final Integer resultSize = Objects.isNull(size) ? Integer.MAX_VALUE : size; if (isSupportedEnumType(fieldName)) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/rest/NotificationController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/rest/NotificationController.java index 33103ffc88..dc2790e4b6 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/rest/NotificationController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/rest/NotificationController.java @@ -30,13 +30,8 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; -import jakarta.ws.rs.QueryParam; import lombok.extern.slf4j.Slf4j; -import notification.request.CloseNotificationRequest; -import notification.request.EditNotificationRequest; -import notification.request.NotificationStatusRequest; -import notification.request.StartNotificationRequest; -import notification.request.UpdateNotificationStatusTransitionRequest; +import notification.request.*; import notification.response.NotificationIdResponse; import notification.response.NotificationResponse; import org.eclipse.tractusx.traceability.common.model.BaseRequestFieldMapper; @@ -46,21 +41,14 @@ import org.eclipse.tractusx.traceability.notification.application.notification.mapper.NotificationFieldMapper; import org.eclipse.tractusx.traceability.notification.application.notification.mapper.NotificationResponseMapper; import org.eclipse.tractusx.traceability.notification.application.notification.service.NotificationService; -import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationSide; +import org.eclipse.tractusx.traceability.notification.base.mapper.NotificationSideTypeMapper; import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationStatus; import org.eclipse.tractusx.traceability.notification.domain.notification.model.EditNotification; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -589,16 +577,16 @@ public void editNotification( notificationService.editNotification(EditNotification.from(cleanEditNotificationRequest, notificationId)); } - @Operation(operationId = "distinctFilterValues", - summary = "getDistinctFilterValues", + @Operation(operationId = "searchable-values", + summary = "searchable-values", tags = {"Notifications"}, - description = "The endpoint returns a distinct filter values for given fieldName of notification.", + description = "The endpoint returns searchable values for given fieldName.", security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns a distinct filter values for given fieldName.", content = @Content( + @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns searchable values for given fieldName.", content = @Content( mediaType = "application/json", array = @ArraySchema( schema = @Schema( - description = "FilterValues", + description = "SearchableValues", implementation = String.class, additionalProperties = Schema.AdditionalPropertiesValue.FALSE ), @@ -648,8 +636,9 @@ public void editNotification( content = @Content( mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))}) - @GetMapping("distinctFilterValues") - public List distinctFilterValues(@QueryParam("fieldName") String fieldName, @QueryParam("size") Integer size, @QueryParam("startWith") String startWith, @QueryParam("channel") NotificationSide channel) { - return notificationService.getDistinctFilterValues(fieldMapper.mapRequestFieldName(fieldName), startWith, size, channel); + @PostMapping("searchable-values") + public List searchableValues(@Valid @RequestBody SearchableNotificationsRequest request) { + return notificationService.getSearchableValues(fieldMapper.mapRequestFieldName(request.fieldName()), + request.startWith(), request.size(), NotificationSideTypeMapper.from(request.channel())); } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/service/NotificationService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/service/NotificationService.java index 530153292a..e095647082 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/service/NotificationService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/service/NotificationService.java @@ -50,5 +50,5 @@ public interface NotificationService { PageResult getNotifications(Pageable pageable, SearchCriteria searchCriteria); - List getDistinctFilterValues(String fieldName, String startWith, Integer size, NotificationSide side); + List getSearchableValues(String fieldName, String startWith, Integer size, NotificationSide side); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/base/mapper/NotificationSideTypeMapper.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/base/mapper/NotificationSideTypeMapper.java new file mode 100644 index 0000000000..49b7d3aa4b --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/base/mapper/NotificationSideTypeMapper.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.notification.base.mapper; + +import notification.NotificationSideType; +import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationSide; + +import static java.util.Objects.nonNull; + +public abstract class NotificationSideTypeMapper { + public static NotificationSide from(final NotificationSideType type) { + if (nonNull(type)) { + return NotificationSide.valueOf(type.name()); + } else return null; + } +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/AbstractNotificationService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/AbstractNotificationService.java index de46d594dc..ab6488de7b 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/AbstractNotificationService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/AbstractNotificationService.java @@ -22,8 +22,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; -import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; -import org.eclipse.tractusx.traceability.bpn.domain.model.BpnEdcMapping; import org.eclipse.tractusx.traceability.bpn.infrastructure.repository.BpnRepository; import org.eclipse.tractusx.traceability.common.model.BPN; import org.eclipse.tractusx.traceability.common.model.PageResult; @@ -31,20 +29,13 @@ import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.eclipse.tractusx.traceability.notification.application.notification.service.NotificationService; import org.eclipse.tractusx.traceability.notification.domain.base.exception.SendNotificationException; -import org.eclipse.tractusx.traceability.notification.domain.base.model.Notification; -import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationId; -import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationMessage; -import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationSeverity; -import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationSide; -import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationStatus; -import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationType; +import org.eclipse.tractusx.traceability.notification.domain.base.model.*; import org.eclipse.tractusx.traceability.notification.domain.notification.exception.NotificationSenderAndReceiverBPNEqualException; import org.eclipse.tractusx.traceability.notification.domain.notification.model.EditNotification; import org.eclipse.tractusx.traceability.notification.domain.notification.model.StartNotification; import org.eclipse.tractusx.traceability.notification.domain.notification.repository.NotificationRepository; import org.springframework.data.domain.Pageable; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -170,7 +161,7 @@ public void cancel(Long notificationId) { } @Override - public List getDistinctFilterValues(String fieldName, String startWith, Integer size, NotificationSide side) { + public List getSearchableValues(String fieldName, String startWith, Integer size, NotificationSide side) { final Integer resultSize = Objects.isNull(size) ? Integer.MAX_VALUE : size; if (isSupportedEnumType(fieldName)) { diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseServiceTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseServiceTest.java index c8771248f8..69224f342f 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseServiceTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseServiceTest.java @@ -32,7 +32,7 @@ void givenEnumFieldName(String fieldName, String startWith, List expecte // given params // when - List result = service.getDistinctFilterValues(fieldName, startWith, 10, null, List.of()); + List result = service.getSearchableValues(fieldName, startWith, 10, null, List.of()); // then assertThat(result).containsAll(expectedValues); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerFilterValuesIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerSearchValuesIT.java similarity index 73% rename from tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerFilterValuesIT.java rename to tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerSearchValuesIT.java index 5224a62c12..038285e15e 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerFilterValuesIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerSearchValuesIT.java @@ -30,36 +30,36 @@ import org.junit.jupiter.params.provider.MethodSource; import org.springframework.beans.factory.annotation.Autowired; +import java.util.Map; import java.util.stream.Stream; import static io.restassured.RestAssured.given; import static org.eclipse.tractusx.traceability.common.security.JwtRole.ADMIN; import static org.hamcrest.Matchers.is; -class AssetAsBuiltControllerFilterValuesIT extends IntegrationTestSpecification { +class AssetAsBuiltControllerSearchValuesIT extends IntegrationTestSpecification { @Autowired AssetsSupport assetsSupport; @ParameterizedTest @MethodSource("fieldNameTestProvider") - void givenNotEnumTypeFieldNameAndSize_whenCallDistinctFilterValues_thenProperResponse( + void givenNotEnumTypeFieldNameAndSize_whenCallSearchableValues_thenProperResponse( String fieldName, Long resultLimit, Integer expectedSize ) throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String fieldNameParam = "fieldName=" + fieldName; - final String sizeParam = "size=" + resultLimit.toString(); // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit))) .log().all() .when() - .get("/api/assets/as-built/distinctFilterValues?" + fieldNameParam + "&" + sizeParam) + .post("/api/assets/as-built/searchable-values") .then() .log().all() .statusCode(200) @@ -69,7 +69,7 @@ void givenNotEnumTypeFieldNameAndSize_whenCallDistinctFilterValues_thenProperRes @ParameterizedTest @MethodSource("fieldNameTestProviderWithStartWithParam") - void givenNotEnumTypeFieldNameAndSizeAndStartWith_whenCallDistinctFilterValues_thenProperResponse( + void givenNotEnumTypeFieldNameAndSizeAndStartWith_whenCallSearchableValues_thenProperResponse( String fieldName, String startWith, Long resultLimit, @@ -82,12 +82,10 @@ void givenNotEnumTypeFieldNameAndSizeAndStartWith_whenCallDistinctFilterValues_t given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "startWith", startWith))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit.toString()) - .param("startWith", startWith) - .get("/api/assets/as-built/distinctFilterValues") + .post("/api/assets/as-built/searchable-values") .then() .log().all() .statusCode(200) @@ -96,23 +94,20 @@ void givenNotEnumTypeFieldNameAndSizeAndStartWith_whenCallDistinctFilterValues_t } @Test - void givenNotEnumTypeFieldNameAndSizeAndOwnerOwn_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenNotEnumTypeFieldNameAndSizeAndOwnerOwn_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsStored(); String fieldName = "id"; String resultLimit = "100"; String owner = "OWN"; - // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "owner", owner))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("owner", owner) - .get("/api/assets/as-built/distinctFilterValues") + .post("/api/assets/as-built/searchable-values") .then() .log().all() .statusCode(200) @@ -121,7 +116,7 @@ void givenNotEnumTypeFieldNameAndSizeAndOwnerOwn_whenCallDistinctFilterValues_th } @Test - void givenBusinessPartnerLowercase_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenBusinessPartnerLowercase_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsStored(); String fieldName = "businessPartner"; @@ -132,12 +127,10 @@ void givenBusinessPartnerLowercase_whenCallDistinctFilterValues_thenProperRespon given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "startWith", startWith))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("startWith", startWith) - .get("/api/assets/as-built/distinctFilterValues") + .post("/api/assets/as-built/searchable-values") .then() .log().all() .statusCode(200) @@ -152,7 +145,7 @@ void givenBusinessPartnerLowercase_whenCallDistinctFilterValues_thenProperRespon } @Test - void givenContractAgreementId_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenContractAgreementId_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsStored(); String fieldName = "contractAgreementId"; @@ -163,12 +156,10 @@ void givenContractAgreementId_whenCallDistinctFilterValues_thenProperResponse() given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "startWith", startWith))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("startWith", startWith) - .get("/api/assets/as-built/distinctFilterValues") + .post("/api/assets/as-built/searchable-values") .then() .log().all() .statusCode(200) @@ -182,7 +173,7 @@ void givenContractAgreementId_whenCallDistinctFilterValues_thenProperResponse() } @Test - void givenBusinessPartnerMixedCase_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenBusinessPartnerMixedCase_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsStored(); String fieldName = "businessPartner"; @@ -193,12 +184,10 @@ void givenBusinessPartnerMixedCase_whenCallDistinctFilterValues_thenProperRespon given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "startWith", startWith))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("startWith", startWith) - .get("/api/assets/as-built/distinctFilterValues") + .post("/api/assets/as-built/searchable-values") .then() .log().all() .statusCode(200) @@ -213,7 +202,7 @@ void givenBusinessPartnerMixedCase_whenCallDistinctFilterValues_thenProperRespon } @Test - void givenNotExistentOwnerEnumValue_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenNotExistentOwnerEnumValue_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsStored(); String fieldName = "id"; @@ -224,12 +213,10 @@ void givenNotExistentOwnerEnumValue_whenCallDistinctFilterValues_thenProperRespo given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "owner", owner))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("owner", owner) - .get("/api/assets/as-built/distinctFilterValues") + .post("/api/assets/as-built/searchable-values") .then() .log().all() .statusCode(400) @@ -238,7 +225,7 @@ void givenNotExistentOwnerEnumValue_whenCallDistinctFilterValues_thenProperRespo } @Test - void givenIdFieldNameAndNoResultLimit_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenIdFieldNameAndNoResultLimit_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsStored(); String fieldName = "id"; @@ -247,10 +234,10 @@ void givenIdFieldNameAndNoResultLimit_whenCallDistinctFilterValues_thenProperRes given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName))) .log().all() .when() - .param("fieldName", fieldName) - .get("/api/assets/as-built/distinctFilterValues") + .post("/api/assets/as-built/searchable-values") .then() .log().all() .statusCode(200) @@ -259,7 +246,7 @@ void givenIdFieldNameAndNoResultLimit_whenCallDistinctFilterValues_thenProperRes } @Test - void givenNotEnumTypeFieldNameAndSizeAndOwnerSupplier_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenNotEnumTypeFieldNameAndSizeAndOwnerSupplier_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsStored(); String fieldName = "id"; @@ -270,12 +257,10 @@ void givenNotEnumTypeFieldNameAndSizeAndOwnerSupplier_whenCallDistinctFilterValu given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "owner", owner))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("owner", owner) - .get("/api/assets/as-built/distinctFilterValues") + .post("/api/assets/as-built/searchable-values") .then() .log().all() .statusCode(200) @@ -284,7 +269,7 @@ void givenNotEnumTypeFieldNameAndSizeAndOwnerSupplier_whenCallDistinctFilterValu } @Test - void givenEnumTypeFieldNameImportState_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenEnumTypeFieldNameImportState_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsStored(); String fieldName = "importState"; @@ -295,12 +280,10 @@ void givenEnumTypeFieldNameImportState_whenCallDistinctFilterValues_thenProperRe given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "owner", owner))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("owner", owner) - .get("/api/assets/as-built/distinctFilterValues") + .post("/api/assets/as-built/searchable-values") .then() .log().all() .statusCode(200) @@ -309,25 +292,22 @@ void givenEnumTypeFieldNameImportState_whenCallDistinctFilterValues_thenProperRe } @Test - void givenInAssetListIsProvided_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenInAssetListIsProvided_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsStored(); String fieldName = "id"; String resultLimit = "100"; String owner = "SUPPLIER"; - String inAssetIds = "urn:uuid:0ce83951-bc18-4e8f-892d-48bad4eb67ef,urn:uuid:16bb1a7e-8ed8-48ca-a839-5f38b704fcae"; + String[] inAssetIds = {"urn:uuid:0ce83951-bc18-4e8f-892d-48bad4eb67ef", "urn:uuid:16bb1a7e-8ed8-48ca-a839-5f38b704fcae"}; // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "owner", owner, "inAssetIds", inAssetIds))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("owner", owner) - .param("inAssetIds", inAssetIds) - .get("/api/assets/as-built/distinctFilterValues") + .post("/api/assets/as-built/searchable-values") .then() .log().all() .statusCode(200) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerFilterValuesIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerSearchValuesIT.java similarity index 72% rename from tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerFilterValuesIT.java rename to tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerSearchValuesIT.java index f4608235dc..81130bf7c4 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerFilterValuesIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerSearchValuesIT.java @@ -31,13 +31,14 @@ import org.junit.jupiter.params.provider.MethodSource; import org.springframework.beans.factory.annotation.Autowired; +import java.util.Map; import java.util.stream.Stream; import static io.restassured.RestAssured.given; import static org.eclipse.tractusx.traceability.common.security.JwtRole.ADMIN; import static org.hamcrest.Matchers.is; -class AssetAsPlannedControllerFilterValuesIT extends IntegrationTestSpecification { +class AssetAsPlannedControllerSearchValuesIT extends IntegrationTestSpecification { @Autowired AssetsSupport assetsSupport; @@ -47,23 +48,22 @@ class AssetAsPlannedControllerFilterValuesIT extends IntegrationTestSpecificatio @ParameterizedTest @MethodSource("fieldNameTestProvider") - void givenNotEnumTypeFieldNameAndSize_whenCallDistinctFilterValues_thenProperResponse( + void givenNotEnumTypeFieldNameAndSize_whenCallSearchableValues_thenProperResponse( String fieldName, Long resultLimit, Integer expectedSize ) throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); - final String fieldNameParam = "fieldName=" + fieldName; - final String sizeParam = "size=" + resultLimit.toString(); // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit))) .log().all() .when() - .get("/api/assets/as-planned/distinctFilterValues?" + fieldNameParam + "&" + sizeParam) + .post("/api/assets/as-planned/searchable-values") .then() .log().all() .statusCode(200) @@ -72,7 +72,7 @@ void givenNotEnumTypeFieldNameAndSize_whenCallDistinctFilterValues_thenProperRes } @Test - void givenNotEnumTypeFieldNameAndSizeAndOwnerOwn_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenNotEnumTypeFieldNameAndSizeAndOwnerOwn_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); String fieldName = "id"; @@ -83,12 +83,10 @@ void givenNotEnumTypeFieldNameAndSizeAndOwnerOwn_whenCallDistinctFilterValues_th given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "owner", owner))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("owner", owner) - .get("/api/assets/as-planned/distinctFilterValues") + .post("/api/assets/as-planned/searchable-values") .then() .log().all() .statusCode(200) @@ -97,7 +95,7 @@ void givenNotEnumTypeFieldNameAndSizeAndOwnerOwn_whenCallDistinctFilterValues_th } @Test - void givenNotEnumTypeFieldNameAndOwnerOwn_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenNotEnumTypeFieldNameAndOwnerOwn_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); String fieldName = "id"; @@ -107,11 +105,10 @@ void givenNotEnumTypeFieldNameAndOwnerOwn_whenCallDistinctFilterValues_thenPrope given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "owner", owner))) .log().all() .when() - .param("fieldName", fieldName) - .param("owner", owner) - .get("/api/assets/as-planned/distinctFilterValues") + .post("/api/assets/as-planned/searchable-values") .then() .log().all() .statusCode(200) @@ -120,7 +117,7 @@ void givenNotEnumTypeFieldNameAndOwnerOwn_whenCallDistinctFilterValues_thenPrope } @Test - void givenIdShortLowerCase_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenIdShortLowerCase_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); String fieldName = "idShort"; @@ -130,11 +127,10 @@ void givenIdShortLowerCase_whenCallDistinctFilterValues_thenProperResponse() thr given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "startWith", startWith))) .log().all() .when() - .param("fieldName", fieldName) - .param("startWith", startWith) - .get("/api/assets/as-planned/distinctFilterValues") + .post("/api/assets/as-planned/searchable-values") .then() .log().all() .statusCode(200) @@ -145,7 +141,7 @@ void givenIdShortLowerCase_whenCallDistinctFilterValues_thenProperResponse() thr } @Test - void givenIdShortMixedCase_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenIdShortMixedCase_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); String fieldName = "idShort"; @@ -155,11 +151,10 @@ void givenIdShortMixedCase_whenCallDistinctFilterValues_thenProperResponse() thr given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "startWith", startWith))) .log().all() .when() - .param("fieldName", fieldName) - .param("startWith", startWith) - .get("/api/assets/as-planned/distinctFilterValues") + .post("/api/assets/as-planned/searchable-values") .then() .log().all() .statusCode(200) @@ -170,7 +165,7 @@ void givenIdShortMixedCase_whenCallDistinctFilterValues_thenProperResponse() thr } @Test - void givenWrongOwnerEnum_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenWrongOwnerEnum_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); String fieldName = "id"; @@ -181,12 +176,10 @@ void givenWrongOwnerEnum_whenCallDistinctFilterValues_thenProperResponse() throw given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "owner", owner))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("owner", owner) - .get("/api/assets/as-planned/distinctFilterValues") + .post("/api/assets/as-planned/searchable-values") .then() .log().all() .statusCode(400) @@ -195,7 +188,7 @@ void givenWrongOwnerEnum_whenCallDistinctFilterValues_thenProperResponse() throw } @Test - void givenNotEnumTypeFieldNameAndSizeAndOwnerSupplier_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenNotEnumTypeFieldNameAndSizeAndOwnerSupplier_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); String fieldName = "id"; @@ -206,12 +199,10 @@ void givenNotEnumTypeFieldNameAndSizeAndOwnerSupplier_whenCallDistinctFilterValu given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "owner", owner))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("owner", owner) - .get("/api/assets/as-planned/distinctFilterValues") + .post("/api/assets/as-planned/searchable-values") .then() .log().all() .statusCode(200) @@ -220,7 +211,7 @@ void givenNotEnumTypeFieldNameAndSizeAndOwnerSupplier_whenCallDistinctFilterValu } @Test - void givenEnumTypeFieldNameImportState_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenEnumTypeFieldNameImportState_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); String fieldName = "importState"; @@ -231,12 +222,10 @@ void givenEnumTypeFieldNameImportState_whenCallDistinctFilterValues_thenProperRe given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "owner", owner))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("owner", owner) - .get("/api/assets/as-planned/distinctFilterValues") + .post("/api/assets/as-planned/searchable-values") .then() .log().all() .statusCode(200) @@ -245,25 +234,23 @@ void givenEnumTypeFieldNameImportState_whenCallDistinctFilterValues_thenProperRe } @Test - void givenInAssetListIsProvided_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenInAssetListIsProvided_whenCallSearchableValues_thenProperResponse() throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); String fieldName = "id"; String resultLimit = "100"; String owner = "OWN"; - String inAssetIds = "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01"; + String[] inAssetIds = {"urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01"}; // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit, "owner", owner, + "inAssetIds", inAssetIds))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit) - .param("owner", owner) - .param("inAssetIds", inAssetIds) - .get("/api/assets/as-planned/distinctFilterValues") + .post("/api/assets/as-planned/searchable-values") .then() .log().all() .statusCode(200) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/alert/AlertControllerFilterValuesIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/alert/AlertControllerSearchValuesIT.java similarity index 76% rename from tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/alert/AlertControllerFilterValuesIT.java rename to tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/alert/AlertControllerSearchValuesIT.java index c120c270f8..159c12f219 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/alert/AlertControllerFilterValuesIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/alert/AlertControllerSearchValuesIT.java @@ -32,12 +32,13 @@ import org.springframework.beans.factory.annotation.Autowired; import java.util.List; +import java.util.Map; import java.util.stream.Stream; import static io.restassured.RestAssured.given; import static org.eclipse.tractusx.traceability.common.security.JwtRole.ADMIN; -class AlertControllerFilterValuesIT extends IntegrationTestSpecification { +class AlertControllerSearchValuesIT extends IntegrationTestSpecification { @Autowired AlertsSupport alertsSupport; @@ -46,7 +47,7 @@ class AlertControllerFilterValuesIT extends IntegrationTestSpecification { AlertNotificationsSupport alertNotificationsSupport; @Test - void givenDescriptionField_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenDescriptionField_whenCallSearchableValues_thenProperResponse() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); final String fieldName = "description"; @@ -56,11 +57,10 @@ void givenDescriptionField_whenCallDistinctFilterValues_thenProperResponse() thr given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -68,9 +68,8 @@ void givenDescriptionField_whenCallDistinctFilterValues_thenProperResponse() thr .body(".", Matchers.containsInRelativeOrder(List.of("1", "11", "2", "22", "3", "33", "4", "44", "5", "55", "6", "7", "8").toArray())); } - @Test - void givenDescriptionFieldStartWith_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenDescriptionFieldStartWith_whenCallSearchableValues_thenProperResponse() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); final String fieldName = "description"; @@ -81,12 +80,10 @@ void givenDescriptionFieldStartWith_whenCallDistinctFilterValues_thenProperRespo given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "startWith", startWith))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("startWith", startWith) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -95,7 +92,7 @@ void givenDescriptionFieldStartWith_whenCallDistinctFilterValues_thenProperRespo } @Test - void givenDescriptionFieldStartWithAndReceiver_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenDescriptionFieldStartWithAndReceiver_whenCallSearchableValues_thenProperResponse() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); final String fieldName = "description"; @@ -107,13 +104,10 @@ void givenDescriptionFieldStartWithAndReceiver_whenCallDistinctFilterValues_then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "startWith", startWith, "channel", channel))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("startWith", startWith) - .param("channel", channel) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -122,7 +116,7 @@ void givenDescriptionFieldStartWithAndReceiver_whenCallDistinctFilterValues_then } @Test - void givenDescriptionFieldStartWithAndSender_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenDescriptionFieldStartWithAndSender_whenCallSearchableValues_thenProperResponse() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); final String fieldName = "description"; @@ -134,13 +128,10 @@ void givenDescriptionFieldStartWithAndSender_whenCallDistinctFilterValues_thenPr given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "startWith", startWith, "channel", channel))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("startWith", startWith) - .param("channel", channel) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -149,7 +140,7 @@ void givenDescriptionFieldStartWithAndSender_whenCallDistinctFilterValues_thenPr } @Test - void givenBpnField_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenBpnField_whenCallSearchableValues_thenProperResponse() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); final String fieldName = "bpn"; @@ -159,11 +150,10 @@ void givenBpnField_whenCallDistinctFilterValues_thenProperResponse() throws Jose given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -172,7 +162,7 @@ void givenBpnField_whenCallDistinctFilterValues_thenProperResponse() throws Jose } @Test - void givenBpnFieldStartWithCaseInsensitive1_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenBpnFieldStartWithCaseInsensitive1_whenCallSearchableValues_thenProperResponse() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); final String fieldName = "bpn"; @@ -183,12 +173,10 @@ void givenBpnFieldStartWithCaseInsensitive1_whenCallDistinctFilterValues_thenPro given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "startWith", startWith))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("startWith", startWith) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -197,7 +185,7 @@ void givenBpnFieldStartWithCaseInsensitive1_whenCallDistinctFilterValues_thenPro } @Test - void givenBpnFieldStartWithCaseInsensitive2_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenBpnFieldStartWithCaseInsensitive2_whenCallSearchableValues_thenProperResponse() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); final String fieldName = "bpn"; @@ -208,12 +196,10 @@ void givenBpnFieldStartWithCaseInsensitive2_whenCallDistinctFilterValues_thenPro given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "startWith", startWith))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("startWith", startWith) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -222,7 +208,7 @@ void givenBpnFieldStartWithCaseInsensitive2_whenCallDistinctFilterValues_thenPro } @Test - void givenCreatedDateField_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenCreatedDateField_whenCallSearchableValues_thenProperResponse() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); final String fieldName = "createdDate"; @@ -232,11 +218,10 @@ void givenCreatedDateField_whenCallDistinctFilterValues_thenProperResponse() thr given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -254,7 +239,7 @@ void givenCreatedDateField_whenCallDistinctFilterValues_thenProperResponse() thr } @Test - void givenCreatedDateFieldAndNoSize_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenCreatedDateFieldAndNoSize_whenCallSearchableValues_thenProperResponse() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); final String fieldName = "createdDate"; @@ -263,10 +248,10 @@ void givenCreatedDateFieldAndNoSize_whenCallDistinctFilterValues_thenProperRespo given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName))) .log().all() .when() - .param("fieldName", fieldName) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -284,7 +269,7 @@ void givenCreatedDateFieldAndNoSize_whenCallDistinctFilterValues_thenProperRespo } @Test - void givenCreatedByField_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenCreatedByField_whenCallSearchableValues_thenProperResponse() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); final String fieldName = "createdBy"; @@ -294,11 +279,10 @@ void givenCreatedByField_whenCallDistinctFilterValues_thenProperResponse() throw given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -307,7 +291,7 @@ void givenCreatedByField_whenCallDistinctFilterValues_thenProperResponse() throw } @Test - void givenCreatedByFieldAndSender_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenCreatedByFieldAndSender_whenCallSearchableValues_thenProperResponse() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); final String fieldName = "createdBy"; @@ -318,12 +302,10 @@ void givenCreatedByFieldAndSender_whenCallDistinctFilterValues_thenProperRespons given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "channel", channel))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("channel", channel) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -332,7 +314,7 @@ void givenCreatedByFieldAndSender_whenCallDistinctFilterValues_thenProperRespons } @Test - void givenCreatedByFieldAndReceiver_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenCreatedByFieldAndReceiver_whenCallSearchableValues_thenProperResponse() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); final String fieldName = "createdBy"; @@ -343,12 +325,10 @@ void givenCreatedByFieldAndReceiver_whenCallDistinctFilterValues_thenProperRespo given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "channel", channel))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("channel", channel) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -358,7 +338,7 @@ void givenCreatedByFieldAndReceiver_whenCallDistinctFilterValues_thenProperRespo @ParameterizedTest @MethodSource("enumFieldNamesTestProvider") - void givenEnumTypeFields_whenCallDistinctFilterValues_thenProperResponse( + void givenEnumTypeFields_whenCallSearchableValues_thenProperResponse( String fieldName, Integer resultLimit, List expectedResult @@ -366,11 +346,10 @@ void givenEnumTypeFields_whenCallDistinctFilterValues_thenProperResponse( given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit.toString()))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit.toString()) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/investigation/InvestigationControllerFilterValuesIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/investigation/InvestigationControllerSearchValuesIT.java similarity index 76% rename from tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/investigation/InvestigationControllerFilterValuesIT.java rename to tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/investigation/InvestigationControllerSearchValuesIT.java index ba2e5ea8c1..23e9fcb062 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/investigation/InvestigationControllerFilterValuesIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/investigation/InvestigationControllerSearchValuesIT.java @@ -32,12 +32,13 @@ import org.springframework.beans.factory.annotation.Autowired; import java.util.List; +import java.util.Map; import java.util.stream.Stream; import static io.restassured.RestAssured.given; import static org.eclipse.tractusx.traceability.common.security.JwtRole.ADMIN; -class InvestigationControllerFilterValuesIT extends IntegrationTestSpecification { +class InvestigationControllerSearchValuesIT extends IntegrationTestSpecification { @Autowired InvestigationsSupport investigationsSupport; @@ -46,7 +47,7 @@ class InvestigationControllerFilterValuesIT extends IntegrationTestSpecification InvestigationNotificationsSupport investigationNotificationsSupport; @Test - void givenDescriptionField_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenDescriptionField_whenCallSearchableValues_thenProperResponse() throws JoseException { // given investigationNotificationsSupport.defaultInvestigationsStored(); final String fieldName = "description"; @@ -56,11 +57,10 @@ void givenDescriptionField_whenCallDistinctFilterValues_thenProperResponse() thr given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -68,9 +68,8 @@ void givenDescriptionField_whenCallDistinctFilterValues_thenProperResponse() thr .body(".", Matchers.containsInRelativeOrder(List.of("1", "11", "2", "22", "3", "33", "4", "44", "5", "55", "6", "7", "8").toArray())); } - @Test - void givenDescriptionFieldStartWith_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenDescriptionFieldStartWith_whenCallSearchableValues_thenProperResponse() throws JoseException { // given investigationNotificationsSupport.defaultInvestigationsStored(); final String fieldName = "description"; @@ -81,12 +80,10 @@ void givenDescriptionFieldStartWith_whenCallDistinctFilterValues_thenProperRespo given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "startWith", startWith))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("startWith", startWith) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -95,7 +92,7 @@ void givenDescriptionFieldStartWith_whenCallDistinctFilterValues_thenProperRespo } @Test - void givenDescriptionFieldStartWithAndReceiver_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenDescriptionFieldStartWithAndReceiver_whenCallSearchableValues_thenProperResponse() throws JoseException { // given investigationNotificationsSupport.defaultInvestigationsStored(); final String fieldName = "description"; @@ -107,13 +104,10 @@ void givenDescriptionFieldStartWithAndReceiver_whenCallDistinctFilterValues_then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "startWith", startWith, "channel", channel))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("startWith", startWith) - .param("channel", channel) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -122,7 +116,7 @@ void givenDescriptionFieldStartWithAndReceiver_whenCallDistinctFilterValues_then } @Test - void givenDescriptionFieldStartWithAndSender_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenDescriptionFieldStartWithAndSender_whenCallSearchableValues_thenProperResponse() throws JoseException { // given investigationNotificationsSupport.defaultInvestigationsStored(); final String fieldName = "description"; @@ -134,13 +128,10 @@ void givenDescriptionFieldStartWithAndSender_whenCallDistinctFilterValues_thenPr given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "startWith", startWith, "channel", channel))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("startWith", startWith) - .param("channel", channel) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -149,7 +140,7 @@ void givenDescriptionFieldStartWithAndSender_whenCallDistinctFilterValues_thenPr } @Test - void givenBpnField_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenBpnField_whenCallSearchableValues_thenProperResponse() throws JoseException { // given investigationNotificationsSupport.defaultInvestigationsStored(); final String fieldName = "bpn"; @@ -159,11 +150,10 @@ void givenBpnField_whenCallDistinctFilterValues_thenProperResponse() throws Jose given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -172,7 +162,7 @@ void givenBpnField_whenCallDistinctFilterValues_thenProperResponse() throws Jose } @Test - void givenBpnFieldStartWithCaseInsensitive1_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenBpnFieldStartWithCaseInsensitive1_whenCallSearchableValues_thenProperResponse() throws JoseException { // given investigationNotificationsSupport.defaultInvestigationsStored(); final String fieldName = "bpn"; @@ -183,12 +173,10 @@ void givenBpnFieldStartWithCaseInsensitive1_whenCallDistinctFilterValues_thenPro given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "startWith", startWith))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("startWith", startWith) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -197,7 +185,7 @@ void givenBpnFieldStartWithCaseInsensitive1_whenCallDistinctFilterValues_thenPro } @Test - void givenBpnFieldStartWithCaseInsensitive2_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenBpnFieldStartWithCaseInsensitive2_whenCallSearchableValues_thenProperResponse() throws JoseException { // given investigationNotificationsSupport.defaultInvestigationsStored(); final String fieldName = "bpn"; @@ -208,12 +196,10 @@ void givenBpnFieldStartWithCaseInsensitive2_whenCallDistinctFilterValues_thenPro given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "startWith", startWith))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("startWith", startWith) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -222,7 +208,7 @@ void givenBpnFieldStartWithCaseInsensitive2_whenCallDistinctFilterValues_thenPro } @Test - void givenCreatedDateField_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenCreatedDateField_whenCallSearchableValues_thenProperResponse() throws JoseException { // given investigationNotificationsSupport.defaultInvestigationsStored(); final String fieldName = "createdDate"; @@ -232,11 +218,10 @@ void givenCreatedDateField_whenCallDistinctFilterValues_thenProperResponse() thr given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -253,7 +238,7 @@ void givenCreatedDateField_whenCallDistinctFilterValues_thenProperResponse() thr } @Test - void givenCreatedDateFieldAndNoSize_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenCreatedDateFieldAndNoSize_whenCallSearchableValues_thenProperResponse() throws JoseException { // given investigationNotificationsSupport.defaultInvestigationsStored(); final String fieldName = "createdDate"; @@ -262,10 +247,10 @@ void givenCreatedDateFieldAndNoSize_whenCallDistinctFilterValues_thenProperRespo given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName))) .log().all() .when() - .param("fieldName", fieldName) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -282,7 +267,7 @@ void givenCreatedDateFieldAndNoSize_whenCallDistinctFilterValues_thenProperRespo } @Test - void givenCreatedByField_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenCreatedByField_whenCallSearchableValues_thenProperResponse() throws JoseException { // given investigationNotificationsSupport.defaultInvestigationsStored(); final String fieldName = "createdBy"; @@ -292,11 +277,10 @@ void givenCreatedByField_whenCallDistinctFilterValues_thenProperResponse() throw given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -305,7 +289,7 @@ void givenCreatedByField_whenCallDistinctFilterValues_thenProperResponse() throw } @Test - void givenCreatedByFieldAndSender_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenCreatedByFieldAndSender_whenCallSearchableValues_thenProperResponse() throws JoseException { // given investigationNotificationsSupport.defaultInvestigationsStored(); final String fieldName = "createdBy"; @@ -316,12 +300,10 @@ void givenCreatedByFieldAndSender_whenCallDistinctFilterValues_thenProperRespons given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "channel", channel))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("channel", channel) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -330,7 +312,7 @@ void givenCreatedByFieldAndSender_whenCallDistinctFilterValues_thenProperRespons } @Test - void givenCreatedByFieldAndReceiver_whenCallDistinctFilterValues_thenProperResponse() throws JoseException { + void givenCreatedByFieldAndReceiver_whenCallSearchableValues_thenProperResponse() throws JoseException { // given investigationNotificationsSupport.defaultInvestigationsStored(); final String fieldName = "createdBy"; @@ -341,12 +323,10 @@ void givenCreatedByFieldAndReceiver_whenCallDistinctFilterValues_thenProperRespo given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", size, "channel", channel))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", size) - .param("channel", channel) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) @@ -356,7 +336,7 @@ void givenCreatedByFieldAndReceiver_whenCallDistinctFilterValues_thenProperRespo @ParameterizedTest @MethodSource("enumFieldNamesTestProvider") - void givenEnumTypeFields_whenCallDistinctFilterValues_thenProperResponse( + void givenEnumTypeFields_whenCallSearchableValues_thenProperResponse( String fieldName, Integer resultLimit, List expectedResult @@ -364,11 +344,10 @@ void givenEnumTypeFields_whenCallDistinctFilterValues_thenProperResponse( given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) + .body(asJson(Map.of("fieldName", fieldName, "size", resultLimit.toString()))) .log().all() .when() - .param("fieldName", fieldName) - .param("size", resultLimit.toString()) - .get("/api/notifications/distinctFilterValues") + .post("/api/notifications/searchable-values") .then() .log().all() .statusCode(200) diff --git a/tx-models/src/main/java/assets/request/SearchableAssetsRequest.java b/tx-models/src/main/java/assets/request/SearchableAssetsRequest.java new file mode 100644 index 0000000000..31e3d8952b --- /dev/null +++ b/tx-models/src/main/java/assets/request/SearchableAssetsRequest.java @@ -0,0 +1,42 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package assets.request; + +import assets.response.base.OwnerType; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; + +import java.util.List; + +public record SearchableAssetsRequest( + @NotNull + String fieldName, + @Size(min = 1) + String startWith, + Integer size, + OwnerType owner, + List inAssetIds) { + + public SearchableAssetsRequest { + if (size == null) { + size = 200; + } + } +} diff --git a/tx-models/src/main/java/assets/response/base/OwnerType.java b/tx-models/src/main/java/assets/response/base/OwnerType.java new file mode 100644 index 0000000000..a252b1bfd7 --- /dev/null +++ b/tx-models/src/main/java/assets/response/base/OwnerType.java @@ -0,0 +1,24 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package assets.response.base; + +public enum OwnerType { + SUPPLIER, CUSTOMER, OWN, UNKNOWN +} diff --git a/tx-models/src/main/java/notification/NotificationSideType.java b/tx-models/src/main/java/notification/NotificationSideType.java new file mode 100644 index 0000000000..d6c1e24bd6 --- /dev/null +++ b/tx-models/src/main/java/notification/NotificationSideType.java @@ -0,0 +1,25 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package notification; + +public enum NotificationSideType { + SENDER, + RECEIVER +} diff --git a/tx-models/src/main/java/notification/request/SearchableNotificationsRequest.java b/tx-models/src/main/java/notification/request/SearchableNotificationsRequest.java new file mode 100644 index 0000000000..1b09b8f719 --- /dev/null +++ b/tx-models/src/main/java/notification/request/SearchableNotificationsRequest.java @@ -0,0 +1,39 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package notification.request; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import notification.NotificationSideType; + +public record SearchableNotificationsRequest( + @NotNull + String fieldName, + @Size(min = 1) + String startWith, + Integer size, + NotificationSideType channel) { + + public SearchableNotificationsRequest { + if (size == null) { + size = 200; + } + } +} diff --git a/tx-models/src/test/java/assets/request/SearchableAssetsRequestTest.java b/tx-models/src/test/java/assets/request/SearchableAssetsRequestTest.java new file mode 100644 index 0000000000..5df577383d --- /dev/null +++ b/tx-models/src/test/java/assets/request/SearchableAssetsRequestTest.java @@ -0,0 +1,16 @@ +package assets.request; + +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +class SearchableAssetsRequestTest { + @Test + void givenNoSizeGiven_whenConstructingRecord_thenHasDefaultSizeValue() { + // given + SearchableAssetsRequest request = new SearchableAssetsRequest("", null, null, null, null); + + // then + assertThat(request.size()).isEqualTo(200); + } +} diff --git a/tx-models/src/test/java/notification/request/SearchableNotificationsRequestTest.java b/tx-models/src/test/java/notification/request/SearchableNotificationsRequestTest.java new file mode 100644 index 0000000000..a062fea900 --- /dev/null +++ b/tx-models/src/test/java/notification/request/SearchableNotificationsRequestTest.java @@ -0,0 +1,16 @@ +package notification.request; + +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +class SearchableNotificationsRequestTest { + @Test + void givenNoSizeGiven_whenConstructingRecord_thenHasDefaultSizeValue() { + // given + SearchableNotificationsRequest request = new SearchableNotificationsRequest("", null, null, null); + + // then + assertThat(request.size()).isEqualTo(200); + } +}