diff --git a/CHANGELOG.md b/CHANGELOG.md index db26f2885f..ce6a5c7c97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,15 +8,15 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). _**For better traceability add the corresponding GitHub issue number in each changelog entry, please.**_ ## [UNRELEASED - DD.MM.YYYY] +### Added +- #780 store api documenation in docs/api to conform with TRG 1.08 +- #622 Notification Update API + ## Changed - #823 migrate to irs-helm 6.18.0 - #636 migrate to digital-twin-registry version 0.4.9 from 0.3.22 - #602 use digitalTwinType instead of semanticId to determine asBuilt or asPlanned assets - -### Added -- #780 store api documenation in docs/api to conform with TRG 1.08 - ## [10.8.2 - 05.04.2024] ### Removed - #547 Removed classification check on alert / investigation update callback methods diff --git a/docs/api/traceability-foss-backend.json b/docs/api/traceability-foss-backend.json index a4434b40e8..f2a5b239b7 100644 --- a/docs/api/traceability-foss-backend.json +++ b/docs/api/traceability-foss-backend.json @@ -22,15 +22,49 @@ } ], "paths" : { - "/bpn-config" : { - "get" : { + "/notifications/{notificationId}/edit" : { + "put" : { "tags" : [ - "BpnEdcMapping" + "Notifications" ], - "summary" : "Get BPN EDC URL mappings", - "description" : "The endpoint returns a result of BPN EDC URL mappings.", - "operationId" : "getBpnEdcs", + "summary" : "Update notification by id", + "description" : "The endpoint updates notification by their id.", + "operationId" : "updateNotification", + "parameters" : [ + { + "name" : "notificationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/EditNotificationRequest" + } + } + }, + "required" : true + }, "responses" : { + "204" : { + "description" : "No content." + }, + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -41,8 +75,28 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -61,6 +115,35 @@ } } }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/bpn-config" : { + "get" : { + "tags" : [ + "BpnEdcMapping" + ], + "summary" : "Get BPN EDC URL mappings", + "description" : "The endpoint returns a result of BPN EDC URL mappings.", + "operationId" : "getBpnEdcs", + "responses" : { "200" : { "description" : "Returns the paged result found", "content" : { @@ -76,8 +159,28 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -96,8 +199,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -106,8 +209,18 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -148,12 +261,17 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "200" : { + "description" : "Returns the paged result found for BpnEdcMapping", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/BpnEdcMappingResponse" + } } } } @@ -168,8 +286,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -178,8 +296,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -198,8 +316,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -208,8 +326,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -218,17 +336,12 @@ } } }, - "200" : { - "description" : "Returns the paged result found for BpnEdcMapping", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/BpnEdcMappingResponse" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -265,12 +378,17 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "200" : { + "description" : "Returns the paged result found for BpnEdcMapping", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/BpnEdcMappingResponse" + } } } } @@ -285,8 +403,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -295,8 +413,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -315,8 +433,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -325,8 +443,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -335,17 +453,12 @@ } } }, - "200" : { - "description" : "Returns the paged result found for BpnEdcMapping", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/BpnEdcMappingResponse" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -379,8 +492,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -389,18 +502,18 @@ } } }, - "200" : { - "description" : "Returns submodel payload", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "type" : "string" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -409,18 +522,18 @@ } } }, - "500" : { - "description" : "Internal server error.", + "200" : { + "description" : "Returns submodel payload", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "type" : "string" } } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -429,8 +542,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -439,8 +552,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -449,8 +562,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -496,8 +609,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -506,11 +619,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -519,8 +629,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -529,8 +639,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "200" : { + "description" : "Ok." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -539,8 +652,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -549,8 +662,11 @@ } } }, - "404" : { - "description" : "Not found.", + "204" : { + "description" : "No Content." + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -559,11 +675,8 @@ } } }, - "204" : { - "description" : "No Content." - }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -601,8 +714,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -611,8 +724,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -621,8 +734,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -631,8 +744,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -641,8 +754,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -651,8 +764,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -671,8 +784,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -698,7 +811,7 @@ ], "summary" : "Update notification by id", "description" : "The endpoint updates notification by their id.", - "operationId" : "updateNotification", + "operationId" : "updateNotification_1", "parameters" : [ { "name" : "notificationId", @@ -714,15 +827,18 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/UpdateNotificationRequest" + "$ref" : "#/components/schemas/UpdateNotificationStatusTransitionRequest" } } }, "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "204" : { + "description" : "No content." + }, + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -731,8 +847,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -741,8 +857,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -751,8 +867,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -761,8 +877,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -771,8 +887,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -781,11 +897,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -810,7 +923,7 @@ "Notifications" ], "summary" : "Close notification by id", - "description" : "The endpoint closes alert by id.", + "description" : "The endpoint closes Notification by id.", "operationId" : "closeNotification", "parameters" : [ { @@ -834,8 +947,11 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "204" : { + "description" : "No content." + }, + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -844,11 +960,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -857,8 +970,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -867,8 +980,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "200" : { + "description" : "Ok." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -877,8 +993,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -887,8 +1003,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -897,11 +1013,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -940,8 +1053,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -950,11 +1063,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -963,8 +1073,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -973,8 +1083,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "200" : { + "description" : "Ok." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -983,8 +1096,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -996,8 +1109,8 @@ "204" : { "description" : "No content." }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1006,8 +1119,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1046,8 +1159,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1056,11 +1169,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1069,8 +1179,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1079,8 +1189,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "200" : { + "description" : "Ok." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1089,8 +1202,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1102,8 +1215,8 @@ "204" : { "description" : "No content." }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1112,8 +1225,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1151,6 +1264,16 @@ "required" : true }, "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -1161,6 +1284,36 @@ } } }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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 paged result found for Notifications", "content" : { @@ -1305,16 +1458,6 @@ } } }, - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "500" : { "description" : "Internal server error.", "content" : { @@ -1325,26 +1468,6 @@ } } }, - "429" : { - "description" : "Too many requests.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "400" : { - "description" : "Bad request.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "404" : { "description" : "Not found.", "content" : { @@ -1354,16 +1477,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -1394,8 +1507,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1404,8 +1517,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1414,8 +1527,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1424,8 +1537,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1434,8 +1547,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1444,8 +1557,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1464,8 +1577,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1503,14 +1616,14 @@ "required" : true }, "responses" : { - "415" : { - "description" : "Unsupported media type.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Unsupported media type." + "message" : "Forbidden." } } } @@ -1532,79 +1645,79 @@ } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Too many requests." + "message" : "Not found." } } } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Bad request." + "message" : "Too many requests." } } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Not found." + "message" : "Unsupported media type." } } } } }, - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Authorization failed." + "message" : "Bad request." } } } } }, - "500" : { - "description" : "Internal server error.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Internal server error." + "message" : "Authorization failed." } } } } }, - "403" : { - "description" : "Forbidden.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Forbidden." + "message" : "Internal server error." } } } @@ -1651,8 +1764,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1661,8 +1774,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1671,8 +1784,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1681,14 +1794,8 @@ } } }, - "200" : { - "description" : "OK.", - "content" : { - "application/json" : {} - } - }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1697,8 +1804,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1707,11 +1814,14 @@ } } }, - "204" : { - "description" : "No Content." + "200" : { + "description" : "OK.", + "content" : { + "application/json" : {} + } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1720,8 +1830,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1729,6 +1839,9 @@ } } } + }, + "204" : { + "description" : "No Content." } }, "security" : [ @@ -1767,8 +1880,8 @@ } }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1777,8 +1890,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1787,8 +1900,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1797,8 +1910,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1807,8 +1920,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1817,21 +1930,18 @@ } } }, - "204" : { - "description" : "No Content." - }, - "404" : { - "description" : "Not found.", + "200" : { + "description" : "OK.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/ImportResponse" } } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1840,15 +1950,18 @@ } } }, - "200" : { - "description" : "OK.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ImportResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } + }, + "204" : { + "description" : "No Content." } }, "security" : [ @@ -1879,8 +1992,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1889,8 +2002,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1899,8 +2012,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1908,9 +2021,9 @@ } } } - }, - "429" : { - "description" : "Too many requests.", + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1919,8 +2032,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1929,8 +2042,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1942,8 +2055,8 @@ "201" : { "description" : "Created." }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1981,8 +2094,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1991,8 +2104,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2001,8 +2114,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -2011,8 +2124,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2021,8 +2134,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2031,8 +2144,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2041,8 +2154,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -2272,8 +2385,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2282,8 +2395,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2292,8 +2405,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -2302,8 +2415,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2312,8 +2425,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2322,8 +2435,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2335,8 +2448,8 @@ "201" : { "description" : "Created." }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -2374,6 +2487,16 @@ "required" : true }, "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -2384,6 +2507,46 @@ } } }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "200" : { "description" : "Returns the paged result found for Asset", "content" : { @@ -2576,46 +2739,6 @@ } } }, - "401" : { - "description" : "Authorization failed.", - "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" - } - } - } - }, - "400" : { - "description" : "Bad request.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "404" : { "description" : "Not found.", "content" : { @@ -2625,16 +2748,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -2665,6 +2778,36 @@ } ], "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "200" : { "description" : "Returns the assets found", "content" : { @@ -2852,28 +2995,8 @@ } } }, - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2892,8 +3015,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2911,16 +3034,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -2959,6 +3072,16 @@ "required" : true }, "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -2969,8 +3092,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -2979,8 +3102,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3186,8 +3309,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3205,16 +3328,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -3245,16 +3358,6 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "401" : { "description" : "Authorization failed.", "content" : { @@ -3265,28 +3368,8 @@ } } }, - "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" - } - } - } - }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3295,8 +3378,8 @@ } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3492,8 +3575,38 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3539,16 +3652,6 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "200" : { "description" : "Returns the updated asset", "content" : { @@ -3746,8 +3849,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3756,8 +3859,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3776,8 +3879,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3786,8 +3889,18 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3815,8 +3928,8 @@ "description" : "The endpoint Triggers reload of shell descriptors.", "operationId" : "reload", "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3825,8 +3938,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3835,8 +3948,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3845,8 +3958,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "202" : { + "description" : "Created registry reload job." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3855,11 +3971,8 @@ } } }, - "202" : { - "description" : "Created registry reload job." - }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3868,8 +3981,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3878,8 +3991,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3907,12 +4020,12 @@ "description" : "The endpoint returns all policies .", "operationId" : "policy", "responses" : { - "403" : { - "description" : "Forbidden.", + "200" : { + "description" : "Returns the policies", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/PolicyResponse" } } } @@ -3927,8 +4040,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3937,8 +4050,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3957,8 +4070,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3967,8 +4080,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3977,12 +4090,12 @@ } } }, - "200" : { - "description" : "Returns the policies", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/PolicyResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -4017,8 +4130,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4027,23 +4140,18 @@ } } }, - "200" : { - "description" : "OK.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "type" : "array", - "description" : "Notifications", - "items" : { - "$ref" : "#/components/schemas/NotificationResponse" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4052,18 +4160,23 @@ } } }, - "500" : { - "description" : "Internal server error.", + "200" : { + "description" : "OK.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "type" : "array", + "description" : "Notifications", + "items" : { + "$ref" : "#/components/schemas/NotificationResponse" + } } } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4072,8 +4185,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4082,8 +4195,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4092,8 +4205,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4160,8 +4273,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4170,23 +4283,18 @@ } } }, - "200" : { - "description" : "Returns a distinct filter values for given fieldName.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array", - "items" : { - "type" : "string" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4195,8 +4303,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4215,8 +4323,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4235,12 +4343,17 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "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" + } } } } @@ -4264,6 +4377,16 @@ "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" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -4274,8 +4397,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4284,8 +4407,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4314,8 +4437,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4333,16 +4456,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -4374,8 +4487,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4384,18 +4497,18 @@ } } }, - "200" : { - "description" : "OK.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ImportReportResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4404,18 +4517,18 @@ } } }, - "500" : { - "description" : "Internal server error.", + "200" : { + "description" : "OK.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/ImportReportResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4424,8 +4537,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4434,11 +4547,8 @@ } } }, - "204" : { - "description" : "No Content." - }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4447,8 +4557,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4456,6 +4566,9 @@ } } } + }, + "204" : { + "description" : "No Content." } }, "security" : [ @@ -4686,8 +4799,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4696,8 +4809,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4706,8 +4819,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4716,8 +4829,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4726,8 +4839,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4736,8 +4849,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4746,8 +4859,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4817,8 +4930,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4827,23 +4940,18 @@ } } }, - "200" : { - "description" : "Returns a distinct filter values for given fieldName.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array", - "items" : { - "type" : "string" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4852,8 +4960,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4872,8 +4980,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4892,12 +5000,17 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "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" + } } } } @@ -4931,6 +5044,16 @@ } ], "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -4941,6 +5064,16 @@ } } }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "200" : { "description" : "Returns the asset by childId", "content" : { @@ -5128,18 +5261,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5158,8 +5281,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5177,16 +5300,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -5225,8 +5338,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5235,8 +5348,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5245,8 +5358,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5255,8 +5368,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5265,8 +5378,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5275,8 +5388,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5477,8 +5590,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5548,8 +5661,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5558,23 +5671,18 @@ } } }, - "200" : { - "description" : "Returns a distinct filter values for given fieldName.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array", - "items" : { - "type" : "string" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5583,8 +5691,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5603,8 +5711,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5623,12 +5731,17 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "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" + } } } } @@ -5652,17 +5765,12 @@ "description" : "The endpoint returns a map for assets consumed by the map.", "operationId" : "assetsCountryMap", "responses" : { - "200" : { - "description" : "Returns the assets found", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array", - "items" : { - "type" : "string" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -5677,8 +5785,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5687,18 +5795,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" + } } } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5707,8 +5820,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5717,8 +5830,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5727,8 +5840,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5766,6 +5879,16 @@ } ], "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -5776,8 +5899,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5786,8 +5909,18 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5983,18 +6116,8 @@ } } }, - "429" : { - "description" : "Too many requests.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -6012,16 +6135,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -6042,8 +6155,8 @@ "description" : "Deletes all submodels from the system.", "operationId" : "deleteSubmodels", "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -6052,11 +6165,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -6065,8 +6175,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -6075,8 +6185,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "200" : { + "description" : "Ok." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -6085,8 +6198,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -6095,8 +6208,11 @@ } } }, - "404" : { - "description" : "Not found.", + "204" : { + "description" : "No Content." + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -6105,11 +6221,8 @@ } } }, - "204" : { - "description" : "No Content." - }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -6147,11 +6260,8 @@ } ], "responses" : { - "204" : { - "description" : "Deleted." - }, - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -6160,8 +6270,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -6170,8 +6280,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -6180,11 +6290,11 @@ } } }, - "200" : { - "description" : "Okay" + "204" : { + "description" : "Deleted." }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -6193,8 +6303,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -6203,8 +6313,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -6213,8 +6323,11 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "Okay" + }, + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -6236,23 +6349,57 @@ }, "components" : { "schemas" : { - "BpnMappingRequest" : { + "EditNotificationRequest" : { "required" : [ - "bpn", - "url" + "severity" ], "type" : "object", "properties" : { - "bpn" : { + "title" : { "maxLength" : 255, - "minLength" : 0, + "minLength" : 1, "type" : "string", - "example" : "BPNL00000003CSGV" + "example" : "title" }, - "url" : { - "maxLength" : 255, - "minLength" : 0, - "type" : "string" + "receiverBpn" : { + "type" : "string", + "example" : "BPN00001123123AS" + }, + "severity" : { + "type" : "string", + "enum" : [ + "MINOR", + "MAJOR", + "CRITICAL", + "LIFE-THREATENING" + ] + }, + "targetDate" : { + "type" : "string", + "format" : "date-time", + "example" : "2099-03-11T22:44:06.333826952Z" + }, + "description" : { + "maxLength" : 1000, + "minLength" : 15, + "type" : "string", + "example" : "The description" + }, + "affectedPartIds" : { + "maxLength" : 50, + "minLength" : 1, + "maxItems" : 50, + "minItems" : 1, + "type" : "array", + "example" : [ + "urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978" + ], + "items" : { + "maxLength" : 50, + "minLength" : 1, + "type" : "string", + "example" : "[\"urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978\"]" + } } } }, @@ -6268,6 +6415,26 @@ } } }, + "BpnMappingRequest" : { + "required" : [ + "bpn", + "url" + ], + "type" : "object", + "properties" : { + "bpn" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string", + "example" : "BPNL00000003CSGV" + }, + "url" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + } + } + }, "BpnEdcMappingResponse" : { "type" : "object", "properties" : { @@ -6294,7 +6461,7 @@ "type" : "string", "example" : "title" }, - "partIds" : { + "affectedPartIds" : { "maxLength" : 100, "minLength" : 1, "maxItems" : 50, @@ -6341,9 +6508,6 @@ "ALERT", "INVESTIGATION" ] - }, - "asBuilt" : { - "type" : "boolean" } } }, @@ -6357,7 +6521,7 @@ } } }, - "UpdateNotificationRequest" : { + "UpdateNotificationStatusTransitionRequest" : { "required" : [ "status" ], diff --git a/frontend/src/app/modules/shared/service/notification.service.ts b/frontend/src/app/modules/shared/service/notification.service.ts index bc3f312a57..1893010e01 100644 --- a/frontend/src/app/modules/shared/service/notification.service.ts +++ b/frontend/src/app/modules/shared/service/notification.service.ts @@ -78,8 +78,8 @@ export class NotificationService { .pipe(map(notification => NotificationAssembler.assembleNotification(notification))); } - public createNotification(partIds: string[], description: string, severity: Severity, bpn: string, isAsBuilt: boolean, type: string, title: string): Observable { - const body = { partIds, description, severity, receiverBpn: bpn, isAsBuilt, type, title }; + public createNotification(affectedPartIds: string[], description: string, severity: Severity, bpn: string, isAsBuilt: boolean, type: string, title: string): Observable { + const body = { affectedPartIds, description, severity, receiverBpn: bpn, isAsBuilt, type, title }; return this.apiService.post(`${ this.url }/notifications`, body).pipe(map(({ id }) => id)); } diff --git a/tx-backend/openapi/traceability-foss-backend.json b/tx-backend/openapi/traceability-foss-backend.json index a4434b40e8..f2a5b239b7 100644 --- a/tx-backend/openapi/traceability-foss-backend.json +++ b/tx-backend/openapi/traceability-foss-backend.json @@ -22,15 +22,49 @@ } ], "paths" : { - "/bpn-config" : { - "get" : { + "/notifications/{notificationId}/edit" : { + "put" : { "tags" : [ - "BpnEdcMapping" + "Notifications" ], - "summary" : "Get BPN EDC URL mappings", - "description" : "The endpoint returns a result of BPN EDC URL mappings.", - "operationId" : "getBpnEdcs", + "summary" : "Update notification by id", + "description" : "The endpoint updates notification by their id.", + "operationId" : "updateNotification", + "parameters" : [ + { + "name" : "notificationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/EditNotificationRequest" + } + } + }, + "required" : true + }, "responses" : { + "204" : { + "description" : "No content." + }, + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -41,8 +75,28 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -61,6 +115,35 @@ } } }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/bpn-config" : { + "get" : { + "tags" : [ + "BpnEdcMapping" + ], + "summary" : "Get BPN EDC URL mappings", + "description" : "The endpoint returns a result of BPN EDC URL mappings.", + "operationId" : "getBpnEdcs", + "responses" : { "200" : { "description" : "Returns the paged result found", "content" : { @@ -76,8 +159,28 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -96,8 +199,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -106,8 +209,18 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -148,12 +261,17 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "200" : { + "description" : "Returns the paged result found for BpnEdcMapping", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/BpnEdcMappingResponse" + } } } } @@ -168,8 +286,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -178,8 +296,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -198,8 +316,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -208,8 +326,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -218,17 +336,12 @@ } } }, - "200" : { - "description" : "Returns the paged result found for BpnEdcMapping", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/BpnEdcMappingResponse" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -265,12 +378,17 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "200" : { + "description" : "Returns the paged result found for BpnEdcMapping", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/BpnEdcMappingResponse" + } } } } @@ -285,8 +403,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -295,8 +413,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -315,8 +433,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -325,8 +443,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -335,17 +453,12 @@ } } }, - "200" : { - "description" : "Returns the paged result found for BpnEdcMapping", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/BpnEdcMappingResponse" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -379,8 +492,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -389,18 +502,18 @@ } } }, - "200" : { - "description" : "Returns submodel payload", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "type" : "string" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -409,18 +522,18 @@ } } }, - "500" : { - "description" : "Internal server error.", + "200" : { + "description" : "Returns submodel payload", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "type" : "string" } } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -429,8 +542,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -439,8 +552,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -449,8 +562,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -496,8 +609,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -506,11 +619,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -519,8 +629,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -529,8 +639,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "200" : { + "description" : "Ok." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -539,8 +652,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -549,8 +662,11 @@ } } }, - "404" : { - "description" : "Not found.", + "204" : { + "description" : "No Content." + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -559,11 +675,8 @@ } } }, - "204" : { - "description" : "No Content." - }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -601,8 +714,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -611,8 +724,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -621,8 +734,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -631,8 +744,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -641,8 +754,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -651,8 +764,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -671,8 +784,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -698,7 +811,7 @@ ], "summary" : "Update notification by id", "description" : "The endpoint updates notification by their id.", - "operationId" : "updateNotification", + "operationId" : "updateNotification_1", "parameters" : [ { "name" : "notificationId", @@ -714,15 +827,18 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/UpdateNotificationRequest" + "$ref" : "#/components/schemas/UpdateNotificationStatusTransitionRequest" } } }, "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "204" : { + "description" : "No content." + }, + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -731,8 +847,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -741,8 +857,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -751,8 +867,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -761,8 +877,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -771,8 +887,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -781,11 +897,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -810,7 +923,7 @@ "Notifications" ], "summary" : "Close notification by id", - "description" : "The endpoint closes alert by id.", + "description" : "The endpoint closes Notification by id.", "operationId" : "closeNotification", "parameters" : [ { @@ -834,8 +947,11 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "204" : { + "description" : "No content." + }, + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -844,11 +960,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -857,8 +970,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -867,8 +980,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "200" : { + "description" : "Ok." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -877,8 +993,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -887,8 +1003,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -897,11 +1013,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -940,8 +1053,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -950,11 +1063,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -963,8 +1073,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -973,8 +1083,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "200" : { + "description" : "Ok." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -983,8 +1096,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -996,8 +1109,8 @@ "204" : { "description" : "No content." }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1006,8 +1119,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1046,8 +1159,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1056,11 +1169,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1069,8 +1179,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1079,8 +1189,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "200" : { + "description" : "Ok." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1089,8 +1202,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1102,8 +1215,8 @@ "204" : { "description" : "No content." }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1112,8 +1225,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1151,6 +1264,16 @@ "required" : true }, "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -1161,6 +1284,36 @@ } } }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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 paged result found for Notifications", "content" : { @@ -1305,16 +1458,6 @@ } } }, - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "500" : { "description" : "Internal server error.", "content" : { @@ -1325,26 +1468,6 @@ } } }, - "429" : { - "description" : "Too many requests.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "400" : { - "description" : "Bad request.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "404" : { "description" : "Not found.", "content" : { @@ -1354,16 +1477,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -1394,8 +1507,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1404,8 +1517,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1414,8 +1527,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1424,8 +1537,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1434,8 +1547,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1444,8 +1557,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1464,8 +1577,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1503,14 +1616,14 @@ "required" : true }, "responses" : { - "415" : { - "description" : "Unsupported media type.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Unsupported media type." + "message" : "Forbidden." } } } @@ -1532,79 +1645,79 @@ } } }, - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Too many requests." + "message" : "Not found." } } } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Bad request." + "message" : "Too many requests." } } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Not found." + "message" : "Unsupported media type." } } } } }, - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Authorization failed." + "message" : "Bad request." } } } } }, - "500" : { - "description" : "Internal server error.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Internal server error." + "message" : "Authorization failed." } } } } }, - "403" : { - "description" : "Forbidden.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { "type" : "string", "example" : { - "message" : "Forbidden." + "message" : "Internal server error." } } } @@ -1651,8 +1764,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1661,8 +1774,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1671,8 +1784,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1681,14 +1794,8 @@ } } }, - "200" : { - "description" : "OK.", - "content" : { - "application/json" : {} - } - }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1697,8 +1804,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1707,11 +1814,14 @@ } } }, - "204" : { - "description" : "No Content." + "200" : { + "description" : "OK.", + "content" : { + "application/json" : {} + } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1720,8 +1830,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1729,6 +1839,9 @@ } } } + }, + "204" : { + "description" : "No Content." } }, "security" : [ @@ -1767,8 +1880,8 @@ } }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1777,8 +1890,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1787,8 +1900,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1797,8 +1910,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1807,8 +1920,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1817,21 +1930,18 @@ } } }, - "204" : { - "description" : "No Content." - }, - "404" : { - "description" : "Not found.", + "200" : { + "description" : "OK.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/ImportResponse" } } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1840,15 +1950,18 @@ } } }, - "200" : { - "description" : "OK.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ImportResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } + }, + "204" : { + "description" : "No Content." } }, "security" : [ @@ -1879,8 +1992,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1889,8 +2002,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1899,8 +2012,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1908,9 +2021,9 @@ } } } - }, - "429" : { - "description" : "Too many requests.", + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1919,8 +2032,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1929,8 +2042,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1942,8 +2055,8 @@ "201" : { "description" : "Created." }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1981,8 +2094,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1991,8 +2104,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2001,8 +2114,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -2011,8 +2124,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2021,8 +2134,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2031,8 +2144,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2041,8 +2154,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -2272,8 +2385,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2282,8 +2395,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2292,8 +2405,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -2302,8 +2415,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2312,8 +2425,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2322,8 +2435,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2335,8 +2448,8 @@ "201" : { "description" : "Created." }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -2374,6 +2487,16 @@ "required" : true }, "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -2384,6 +2507,46 @@ } } }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "200" : { "description" : "Returns the paged result found for Asset", "content" : { @@ -2576,46 +2739,6 @@ } } }, - "401" : { - "description" : "Authorization failed.", - "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" - } - } - } - }, - "400" : { - "description" : "Bad request.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "404" : { "description" : "Not found.", "content" : { @@ -2625,16 +2748,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -2665,6 +2778,36 @@ } ], "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "200" : { "description" : "Returns the assets found", "content" : { @@ -2852,28 +2995,8 @@ } } }, - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2892,8 +3015,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2911,16 +3034,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -2959,6 +3072,16 @@ "required" : true }, "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -2969,8 +3092,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -2979,8 +3102,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3186,8 +3309,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3205,16 +3328,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -3245,16 +3358,6 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "401" : { "description" : "Authorization failed.", "content" : { @@ -3265,28 +3368,8 @@ } } }, - "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" - } - } - } - }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3295,8 +3378,8 @@ } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3492,8 +3575,38 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3539,16 +3652,6 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "200" : { "description" : "Returns the updated asset", "content" : { @@ -3746,8 +3849,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3756,8 +3859,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3776,8 +3879,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3786,8 +3889,18 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3815,8 +3928,8 @@ "description" : "The endpoint Triggers reload of shell descriptors.", "operationId" : "reload", "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3825,8 +3938,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3835,8 +3948,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3845,8 +3958,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "202" : { + "description" : "Created registry reload job." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3855,11 +3971,8 @@ } } }, - "202" : { - "description" : "Created registry reload job." - }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3868,8 +3981,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3878,8 +3991,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3907,12 +4020,12 @@ "description" : "The endpoint returns all policies .", "operationId" : "policy", "responses" : { - "403" : { - "description" : "Forbidden.", + "200" : { + "description" : "Returns the policies", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/PolicyResponse" } } } @@ -3927,8 +4040,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3937,8 +4050,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3957,8 +4070,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3967,8 +4080,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3977,12 +4090,12 @@ } } }, - "200" : { - "description" : "Returns the policies", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/PolicyResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -4017,8 +4130,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4027,23 +4140,18 @@ } } }, - "200" : { - "description" : "OK.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "type" : "array", - "description" : "Notifications", - "items" : { - "$ref" : "#/components/schemas/NotificationResponse" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4052,18 +4160,23 @@ } } }, - "500" : { - "description" : "Internal server error.", + "200" : { + "description" : "OK.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "type" : "array", + "description" : "Notifications", + "items" : { + "$ref" : "#/components/schemas/NotificationResponse" + } } } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4072,8 +4185,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4082,8 +4195,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4092,8 +4205,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4160,8 +4273,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4170,23 +4283,18 @@ } } }, - "200" : { - "description" : "Returns a distinct filter values for given fieldName.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array", - "items" : { - "type" : "string" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4195,8 +4303,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4215,8 +4323,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4235,12 +4343,17 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "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" + } } } } @@ -4264,6 +4377,16 @@ "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" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -4274,8 +4397,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4284,8 +4407,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4314,8 +4437,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4333,16 +4456,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -4374,8 +4487,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4384,18 +4497,18 @@ } } }, - "200" : { - "description" : "OK.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ImportReportResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4404,18 +4517,18 @@ } } }, - "500" : { - "description" : "Internal server error.", + "200" : { + "description" : "OK.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/ImportReportResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4424,8 +4537,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4434,11 +4547,8 @@ } } }, - "204" : { - "description" : "No Content." - }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4447,8 +4557,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4456,6 +4566,9 @@ } } } + }, + "204" : { + "description" : "No Content." } }, "security" : [ @@ -4686,8 +4799,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4696,8 +4809,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4706,8 +4819,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4716,8 +4829,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4726,8 +4839,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4736,8 +4849,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4746,8 +4859,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4817,8 +4930,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4827,23 +4940,18 @@ } } }, - "200" : { - "description" : "Returns a distinct filter values for given fieldName.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array", - "items" : { - "type" : "string" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4852,8 +4960,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4872,8 +4980,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4892,12 +5000,17 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "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" + } } } } @@ -4931,6 +5044,16 @@ } ], "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -4941,6 +5064,16 @@ } } }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "200" : { "description" : "Returns the asset by childId", "content" : { @@ -5128,18 +5261,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5158,8 +5281,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5177,16 +5300,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -5225,8 +5338,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5235,8 +5348,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5245,8 +5358,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5255,8 +5368,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5265,8 +5378,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5275,8 +5388,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5477,8 +5590,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5548,8 +5661,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5558,23 +5671,18 @@ } } }, - "200" : { - "description" : "Returns a distinct filter values for given fieldName.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array", - "items" : { - "type" : "string" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5583,8 +5691,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5603,8 +5711,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5623,12 +5731,17 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "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" + } } } } @@ -5652,17 +5765,12 @@ "description" : "The endpoint returns a map for assets consumed by the map.", "operationId" : "assetsCountryMap", "responses" : { - "200" : { - "description" : "Returns the assets found", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array", - "items" : { - "type" : "string" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -5677,8 +5785,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5687,18 +5795,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" + } } } } }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5707,8 +5820,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5717,8 +5830,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5727,8 +5840,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5766,6 +5879,16 @@ } ], "responses" : { + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "403" : { "description" : "Forbidden.", "content" : { @@ -5776,8 +5899,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5786,8 +5909,18 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5983,18 +6116,8 @@ } } }, - "429" : { - "description" : "Too many requests.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -6012,16 +6135,6 @@ } } } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -6042,8 +6155,8 @@ "description" : "Deletes all submodels from the system.", "operationId" : "deleteSubmodels", "responses" : { - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -6052,11 +6165,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -6065,8 +6175,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -6075,8 +6185,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "200" : { + "description" : "Ok." + }, + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -6085,8 +6198,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -6095,8 +6208,11 @@ } } }, - "404" : { - "description" : "Not found.", + "204" : { + "description" : "No Content." + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -6105,11 +6221,8 @@ } } }, - "204" : { - "description" : "No Content." - }, - "415" : { - "description" : "Unsupported media type", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -6147,11 +6260,8 @@ } ], "responses" : { - "204" : { - "description" : "Deleted." - }, - "403" : { - "description" : "Forbidden.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -6160,8 +6270,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -6170,8 +6280,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -6180,11 +6290,11 @@ } } }, - "200" : { - "description" : "Okay" + "204" : { + "description" : "Deleted." }, - "429" : { - "description" : "Too many requests.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -6193,8 +6303,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -6203,8 +6313,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -6213,8 +6323,11 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "Okay" + }, + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -6236,23 +6349,57 @@ }, "components" : { "schemas" : { - "BpnMappingRequest" : { + "EditNotificationRequest" : { "required" : [ - "bpn", - "url" + "severity" ], "type" : "object", "properties" : { - "bpn" : { + "title" : { "maxLength" : 255, - "minLength" : 0, + "minLength" : 1, "type" : "string", - "example" : "BPNL00000003CSGV" + "example" : "title" }, - "url" : { - "maxLength" : 255, - "minLength" : 0, - "type" : "string" + "receiverBpn" : { + "type" : "string", + "example" : "BPN00001123123AS" + }, + "severity" : { + "type" : "string", + "enum" : [ + "MINOR", + "MAJOR", + "CRITICAL", + "LIFE-THREATENING" + ] + }, + "targetDate" : { + "type" : "string", + "format" : "date-time", + "example" : "2099-03-11T22:44:06.333826952Z" + }, + "description" : { + "maxLength" : 1000, + "minLength" : 15, + "type" : "string", + "example" : "The description" + }, + "affectedPartIds" : { + "maxLength" : 50, + "minLength" : 1, + "maxItems" : 50, + "minItems" : 1, + "type" : "array", + "example" : [ + "urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978" + ], + "items" : { + "maxLength" : 50, + "minLength" : 1, + "type" : "string", + "example" : "[\"urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978\"]" + } } } }, @@ -6268,6 +6415,26 @@ } } }, + "BpnMappingRequest" : { + "required" : [ + "bpn", + "url" + ], + "type" : "object", + "properties" : { + "bpn" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string", + "example" : "BPNL00000003CSGV" + }, + "url" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + } + } + }, "BpnEdcMappingResponse" : { "type" : "object", "properties" : { @@ -6294,7 +6461,7 @@ "type" : "string", "example" : "title" }, - "partIds" : { + "affectedPartIds" : { "maxLength" : 100, "minLength" : 1, "maxItems" : 50, @@ -6341,9 +6508,6 @@ "ALERT", "INVESTIGATION" ] - }, - "asBuilt" : { - "type" : "boolean" } } }, @@ -6357,7 +6521,7 @@ } } }, - "UpdateNotificationRequest" : { + "UpdateNotificationStatusTransitionRequest" : { "required" : [ "status" ], diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMapper.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMapper.java index c02f000e1a..ca5038b949 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMapper.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMapper.java @@ -61,7 +61,7 @@ public Notification toNotification(BPN bpn, String description, NotificationMess .notificationType(notificationType) .description(description) .createdAt(Instant.now()) - .assetIds(assetIds) + .affectedPartIds(assetIds) .notifications(List.of(notification)) .build(); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SecurityUtils.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SecurityUtils.java index 81a166d246..5de4badc6a 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SecurityUtils.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SecurityUtils.java @@ -22,8 +22,9 @@ import lombok.experimental.UtilityClass; import notification.request.CloseNotificationRequest; +import notification.request.EditNotificationRequest; import notification.request.StartNotificationRequest; -import notification.request.UpdateNotificationRequest; +import notification.request.UpdateNotificationStatusTransitionRequest; import org.eclipse.tractusx.traceability.notification.infrastructure.edc.model.EDCNotification; import org.eclipse.tractusx.traceability.notification.infrastructure.edc.model.EDCNotificationContent; import org.eclipse.tractusx.traceability.notification.infrastructure.edc.model.EDCNotificationHeader; @@ -58,28 +59,40 @@ public static List sanitize(List unSanitizedList) { public static StartNotificationRequest sanitize(StartNotificationRequest request) { String cleanDescription = sanitize(request.getDescription()); String cleanReceiverBpn = sanitize(request.getReceiverBpn()); - List cleanPartIds = sanitize(request.getPartIds()); + List cleanPartIds = sanitize(request.getAffectedPartIds()); return StartNotificationRequest.builder() .title(request.getTitle()) .description(cleanDescription) .targetDate(request.getTargetDate()) .severity(request.getSeverity()) - .isAsBuilt(request.isAsBuilt()) .receiverBpn(cleanReceiverBpn) .type(request.getType()) - .partIds(cleanPartIds) + .affectedPartIds(cleanPartIds) .build(); } + public static EditNotificationRequest sanitize(EditNotificationRequest request) { + String cleanDescription = sanitize(request.getDescription()); + String cleanReceiverBpn = sanitize(request.getReceiverBpn()); + List cleanPartIds = sanitize(request.getAffectedPartIds()); + return EditNotificationRequest.builder() + .title(request.getTitle()) + .description(cleanDescription) + .targetDate(request.getTargetDate()) + .severity(request.getSeverity()) + .receiverBpn(cleanReceiverBpn) + .affectedPartIds(cleanPartIds) + .build(); + } public static CloseNotificationRequest sanitize(CloseNotificationRequest closeInvestigationRequest) { String cleanReason = sanitize(closeInvestigationRequest.getReason()); return CloseNotificationRequest.builder().reason(cleanReason).build(); } - public static UpdateNotificationRequest sanitize(UpdateNotificationRequest updateInvestigationRequest) { + public static UpdateNotificationStatusTransitionRequest sanitize(UpdateNotificationStatusTransitionRequest updateInvestigationRequest) { String cleanReason = sanitize(updateInvestigationRequest.getReason()); - return UpdateNotificationRequest.builder().status(updateInvestigationRequest.getStatus()).reason(cleanReason).build(); + return UpdateNotificationStatusTransitionRequest.builder().status(updateInvestigationRequest.getStatus()).reason(cleanReason).build(); } public static EDCNotification sanitize(EDCNotification edcNotification) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/mapper/NotificationResponseMapper.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/mapper/NotificationResponseMapper.java index f7adc8e55b..c69b8a13b9 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/mapper/NotificationResponseMapper.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/mapper/NotificationResponseMapper.java @@ -50,7 +50,7 @@ public static NotificationResponse from(Notification notification) { .createdBy(getSenderBPN(notification.getNotifications())) .createdByName(getSenderName(notification.getNotifications())) .createdDate(notification.getCreatedAt().toString()) - .assetIds(Collections.unmodifiableList(notification.getAssetIds())) + .assetIds(Collections.unmodifiableList(notification.getAffectedPartIds())) .channel(NotificationMessageMapper.from(notification.getNotificationSide())) .type(NotificationMessageMapper.from(notification.getNotificationType())) .title(notification.getTitle()) @@ -61,6 +61,7 @@ public static NotificationResponse from(Notification notification) { )) .sendTo(getReceiverBPN(notification.getNotifications())) .sendToName(getReceiverName(notification.getNotifications())) + // TODO severity should not be inside the notification it should be in the message .severity(NotificationMessageMapper.from(notification.getNotifications().stream().findFirst().map(NotificationMessage::getSeverity).orElse(NotificationSeverity.MINOR))) .targetDate(notification.getNotifications().stream().findFirst().map(NotificationMessage::getTargetDate).map(Instant::toString).orElse(null)) .messages(fromNotifications(notification.getNotifications())) 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 1bcc129bc2..33103ffc88 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 @@ -32,15 +32,23 @@ 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.response.NotificationIdResponse; +import notification.response.NotificationResponse; 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.PageableFilterRequest; -import org.eclipse.tractusx.traceability.notification.application.notification.mapper.NotificationResponseMapper; 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.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; @@ -48,16 +56,11 @@ 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 notification.request.CloseNotificationRequest; -import notification.request.NotificationStatusRequest; -import notification.request.StartNotificationRequest; -import notification.request.UpdateNotificationRequest; -import notification.response.NotificationIdResponse; -import notification.response.NotificationResponse; import java.util.List; @@ -136,7 +139,7 @@ public NotificationController( @PostMapping @PreAuthorize("hasAnyRole('ROLE_SUPERVISOR', 'ROLE_USER')") @ResponseStatus(HttpStatus.CREATED) - public NotificationIdResponse alertAssets(@RequestBody @Valid StartNotificationRequest request) { + public NotificationIdResponse createNotification(@RequestBody @Valid StartNotificationRequest request) { StartNotificationRequest cleanStartNotificationRequest = sanitize(request); log.info(RECEIVED_API_CALL_LOG + " with params: {}", cleanStartNotificationRequest); return new NotificationIdResponse(notificationService.start(from(cleanStartNotificationRequest)).value()); @@ -149,7 +152,7 @@ public NotificationIdResponse alertAssets(@RequestBody @Valid StartNotificationR security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns the paged result found for Notifications", content = @Content( mediaType = "application/json", - array = @ArraySchema(arraySchema = @Schema(description = "AlertData", implementation = NotificationResponse.class, additionalProperties = Schema.AdditionalPropertiesValue.FALSE), maxItems = Integer.MAX_VALUE), + array = @ArraySchema(arraySchema = @Schema(description = "NotificationData", implementation = NotificationResponse.class, additionalProperties = Schema.AdditionalPropertiesValue.FALSE), maxItems = Integer.MAX_VALUE), schema = @Schema(implementation = NotificationResponse.class) )), @ApiResponse( @@ -197,7 +200,7 @@ public NotificationIdResponse alertAssets(@RequestBody @Valid StartNotificationR mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))}) @PostMapping("/filter") - public PageResult getAlerts(@Valid @RequestBody PageableFilterRequest pageableFilterRequest) { + public PageResult getNotifications(@Valid @RequestBody PageableFilterRequest pageableFilterRequest) { log.info(RECEIVED_API_CALL_LOG + "/filter"); return NotificationResponseMapper.fromAsPageResult( @@ -257,7 +260,7 @@ public PageResult getAlerts(@Valid @RequestBody PageableFi mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))}) @GetMapping("/{notificationId}") - public NotificationResponse getAlert(@PathVariable("notificationId") Long notificationId) { + public NotificationResponse getNotificationById(@PathVariable("notificationId") Long notificationId) { log.info(RECEIVED_API_CALL_LOG + "/{}", notificationId); return NotificationResponseMapper.from(notificationService.find(notificationId)); } @@ -321,7 +324,7 @@ public NotificationResponse getAlert(@PathVariable("notificationId") Long notifi @PostMapping("/{notificationId}/approve") @PreAuthorize("hasAnyRole('ROLE_SUPERVISOR')") @ResponseStatus(HttpStatus.NO_CONTENT) - public void approveAlert(@PathVariable("notificationId") Long notificationId) { + public void approveNotificationById(@PathVariable("notificationId") Long notificationId) { log.info(RECEIVED_API_CALL_LOG + "/{}/approve", notificationId); notificationService.approve(notificationId); } @@ -385,7 +388,7 @@ public void approveAlert(@PathVariable("notificationId") Long notificationId) { @PostMapping("/{notificationId}/cancel") @PreAuthorize("hasAnyRole('ROLE_SUPERVISOR', 'ROLE_USER')") @ResponseStatus(HttpStatus.NO_CONTENT) - public void cancelAlert(@PathVariable("notificationId") Long notificationId) { + public void cancelNotificationById(@PathVariable("notificationId") Long notificationId) { log.info(RECEIVED_API_CALL_LOG + "/{}/cancel", notificationId); notificationService.cancel(notificationId); } @@ -393,7 +396,7 @@ public void cancelAlert(@PathVariable("notificationId") Long notificationId) { @Operation(operationId = "closeNotification", summary = "Close notification by id", tags = {"Notifications"}, - description = "The endpoint closes alert by id.", + description = "The endpoint closes Notification by id.", security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) @ApiResponses(value = { @ApiResponse( @@ -449,12 +452,12 @@ public void cancelAlert(@PathVariable("notificationId") Long notificationId) { @PreAuthorize("hasAnyRole('ROLE_SUPERVISOR')") @PostMapping("/{notificationId}/close") @ResponseStatus(HttpStatus.NO_CONTENT) - public void closeAlert( + public void closeNotificationById( @PathVariable("notificationId") @ApiParam Long notificationId, - @Valid @RequestBody CloseNotificationRequest closeAlertRequest) { - CloseNotificationRequest cleanCloseAlertRequest = sanitize(closeAlertRequest); - log.info(RECEIVED_API_CALL_LOG + "/{}/close with params {}", notificationId, cleanCloseAlertRequest); - notificationService.update(notificationId, NotificationStatus.from(NotificationStatusRequest.CLOSED), cleanCloseAlertRequest.getReason()); + @Valid @RequestBody CloseNotificationRequest closeNotificationRequest) { + CloseNotificationRequest cleanCloseNotificationRequest = sanitize(closeNotificationRequest); + log.info(RECEIVED_API_CALL_LOG + "/{}/close with params {}", notificationId, cleanCloseNotificationRequest); + notificationService.updateStatusTransition(notificationId, NotificationStatus.from(NotificationStatusRequest.CLOSED), cleanCloseNotificationRequest.getReason()); } @Operation(operationId = "updateNotification", @@ -513,13 +516,77 @@ public void closeAlert( @PreAuthorize("hasAnyRole('ROLE_SUPERVISOR', 'ROLE_USER')") @PostMapping("/{notificationId}/update") @ResponseStatus(HttpStatus.NO_CONTENT) - public void updateAlert( + public void updateNotificationStatusById( + @PathVariable("notificationId") Long notificationId, + @Valid @RequestBody UpdateNotificationStatusTransitionRequest updateNotificationStatusTransitionRequest) { + UpdateNotificationStatusTransitionRequest cleanUpdateNotificationStatusTransitionRequest = sanitize(updateNotificationStatusTransitionRequest); + validate(cleanUpdateNotificationStatusTransitionRequest); + log.info(RECEIVED_API_CALL_LOG + "/{}/update with params {}", notificationId, cleanUpdateNotificationStatusTransitionRequest); + notificationService.updateStatusTransition(notificationId, NotificationStatus.from(cleanUpdateNotificationStatusTransitionRequest.getStatus()), cleanUpdateNotificationStatusTransitionRequest.getReason()); + } + + @Operation(operationId = "updateNotification", + summary = "Update notification by id", + tags = {"Notifications"}, + description = "The endpoint updates notification by their id.", + security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) + @ApiResponses(value = { + @ApiResponse( + responseCode = "204", + description = "No content.", + content = @Content()), + @ApiResponse( + responseCode = "400", + description = "Bad request.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "401", + description = "Authorization failed.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + + @ApiResponse( + responseCode = "403", + description = "Forbidden.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "404", + description = "Not found.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "415", + description = "Unsupported media type", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "429", + description = "Too many requests.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)))}) + @PreAuthorize("hasAnyRole('ROLE_SUPERVISOR', 'ROLE_USER')") + @PutMapping("/{notificationId}/edit") + @ResponseStatus(HttpStatus.NO_CONTENT) + public void editNotification( @PathVariable("notificationId") Long notificationId, - @Valid @RequestBody UpdateNotificationRequest updateAlertRequest) { - UpdateNotificationRequest cleanUpdateAlertRequest = sanitize(updateAlertRequest); - validate(cleanUpdateAlertRequest); - log.info(RECEIVED_API_CALL_LOG + "/{}/update with params {}", notificationId, cleanUpdateAlertRequest); - notificationService.update(notificationId, NotificationStatus.from(cleanUpdateAlertRequest.getStatus()), cleanUpdateAlertRequest.getReason()); + @Valid @RequestBody EditNotificationRequest editNotificationRequest) { + EditNotificationRequest cleanEditNotificationRequest = sanitize(editNotificationRequest); + log.info(RECEIVED_API_CALL_LOG + "/{}/edit with params {}", notificationId, cleanEditNotificationRequest); + notificationService.editNotification(EditNotification.from(cleanEditNotificationRequest, notificationId)); } @Operation(operationId = "distinctFilterValues", 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 0bb73038b9..530153292a 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 @@ -21,6 +21,7 @@ import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.model.SearchCriteria; import org.eclipse.tractusx.traceability.notification.domain.base.model.Notification; +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.base.model.NotificationId; import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationSide; @@ -43,7 +44,9 @@ public interface NotificationService { void cancel(Long notificationId); - void update(Long notificationId, NotificationStatus notificationStatus, String reason); + void editNotification(EditNotification editNotification); + + void updateStatusTransition(Long notificationId, NotificationStatus notificationStatus, String reason); PageResult getNotifications(Pageable pageable, SearchCriteria searchCriteria); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/validation/UpdateNotificationValidator.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/validation/UpdateNotificationValidator.java index c2e2849084..ba074cb7d9 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/validation/UpdateNotificationValidator.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/validation/UpdateNotificationValidator.java @@ -23,7 +23,7 @@ import lombok.experimental.UtilityClass; import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationStatus; -import notification.request.UpdateNotificationRequest; +import notification.request.UpdateNotificationStatusTransitionRequest; import java.util.Set; @@ -39,7 +39,7 @@ public class UpdateNotificationValidator { private static final int MINIMUM_REASON_CHARACTERS_SIZE = 15; private static final int MAXIMUM_REASON_CHARACTERS_SIZE = 1000; - public static void validate(UpdateNotificationRequest updateInvestigationRequest) { + public static void validate(UpdateNotificationStatusTransitionRequest updateInvestigationRequest) { NotificationStatus status = NotificationStatus.fromStringValue(updateInvestigationRequest.getStatus().name()); if (!ALLOWED_STATUSES.contains(status)) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/model/Notification.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/model/Notification.java index 0eacd4892f..1706229dd2 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/model/Notification.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/model/Notification.java @@ -22,17 +22,22 @@ import lombok.Data; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.common.model.BPN; import org.eclipse.tractusx.traceability.notification.domain.notification.exception.InvestigationIllegalUpdate; import org.eclipse.tractusx.traceability.notification.domain.notification.exception.InvestigationStatusTransitionNotAllowed; +import org.eclipse.tractusx.traceability.notification.domain.notification.model.EditNotification; import java.time.Instant; +import java.util.AbstractMap; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; +import java.util.Map; import java.util.Optional; +import static java.util.stream.Collectors.groupingBy; import static org.apache.commons.collections4.ListUtils.emptyIfNull; @Data @@ -48,7 +53,7 @@ public class Notification { private NotificationSide notificationSide; private NotificationType notificationType; @Builder.Default - private List assetIds = new ArrayList<>(); + private List affectedPartIds = new ArrayList<>(); private String closeReason; private String acceptReason; private String declineReason; @@ -66,12 +71,59 @@ public static Notification startNotification(String title, Instant createDate, B .notificationType(notificationType) .description(description) .createdAt(createDate) - .assetIds(Collections.emptyList()) + .affectedPartIds(Collections.emptyList()) .build(); } - public List getAssetIds() { - return Collections.unmodifiableList(assetIds); + public void clearNotifications(){ + notifications = new ArrayList<>(); + } + public void createInitialNotifications(List affectedParts, BPN applicationBPN, EditNotification editNotification) { + + + if (editNotification.getReceiverBpn() != null) { + Map.Entry> receiverAssetsMap = new AbstractMap.SimpleEntry<>(editNotification.getReceiverBpn(), affectedParts); + + NotificationMessage notificationMessage = NotificationMessage.create( + applicationBPN, + editNotification.getReceiverBpn(), + editNotification.getDescription(), + editNotification.getTargetDate(), + editNotification.getSeverity(), + this.notificationType, + receiverAssetsMap, + applicationBPN.value(), + editNotification.getReceiverBpn()); + + this.addNotificationMessage(notificationMessage); + + + } else { + Map> assetsAsBuiltBPNMap = affectedParts.stream().collect(groupingBy(AssetBase::getManufacturerId)); + assetsAsBuiltBPNMap + .entrySet() + .stream() + .map(receiverAssetsMapEntry -> { + String receiver = receiverAssetsMapEntry.getKey(); + return NotificationMessage.create( + applicationBPN, + receiver, + editNotification.getDescription(), + editNotification.getTargetDate(), + editNotification.getSeverity(), + this.notificationType, + receiverAssetsMapEntry, + applicationBPN.value(), + editNotification.getReceiverBpn()); + }) + .forEach(this::addNotificationMessage); + } + + + } + + public List getAffectedPartIds() { + return Collections.unmodifiableList(affectedPartIds); } public String getBpn() { @@ -136,12 +188,12 @@ public void addNotificationMessage(NotificationMessage notification) { updatedNotifications.add(notification); notifications = Collections.unmodifiableList(updatedNotifications); - List newAssetIds = new ArrayList<>(assetIds); // create a mutable copy of assetIds + List newAssetIds = new ArrayList<>(affectedPartIds); // create a mutable copy of assetIds emptyIfNull(notification.getAffectedParts()).stream() .map(NotificationAffectedPart::assetId) .forEach(newAssetIds::add); - assetIds = Collections.unmodifiableList(newAssetIds); // + affectedPartIds = Collections.unmodifiableList(newAssetIds); // } public void addNotificationMessages(List notificationMessages) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/model/NotificationMessage.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/model/NotificationMessage.java index 084e545443..a086df2de2 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/model/NotificationMessage.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/model/NotificationMessage.java @@ -89,6 +89,8 @@ public static NotificationMessage create(BPN applicationBpn, String receiverBpn, .build(); } + + // Important - receiver and sender will be saved in switched order public NotificationMessage copyAndSwitchSenderAndReceiver(BPN applicationBpn) { final String notificationId = UUID.randomUUID().toString(); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/model/NotificationSeverity.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/model/NotificationSeverity.java index 0ac24ad6c1..418e7136e4 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/model/NotificationSeverity.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/model/NotificationSeverity.java @@ -23,7 +23,7 @@ import lombok.Getter; import notification.request.NotificationSeverityRequest; -@Getter + @ApiModel(description = "Describes the criticality of a notification") public enum NotificationSeverity { MINOR("MINOR"), @@ -33,6 +33,10 @@ public enum NotificationSeverity { private final String realName; + public String getRealName() { + return realName; + } + NotificationSeverity(String realName) { this.realName = realName; } 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 c09dad7b83..578b7f0a09 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 @@ -20,12 +20,13 @@ 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.common.model.BPN; import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.model.SearchCriteria; 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.model.NotificationType; -import org.eclipse.tractusx.traceability.notification.domain.notification.model.StartNotification; 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; @@ -33,6 +34,9 @@ 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.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; @@ -48,10 +52,13 @@ public abstract class AbstractNotificationService implements NotificationService private final TraceabilityProperties traceabilityProperties; private final NotificationPublisherService notificationPublisherService; + private final AssetAsBuiltRepository assetAsBuiltRepository; + private static final List SUPPORTED_ENUM_FIELDS = List.of("status", "side", "messages_severity", "type"); protected abstract NotificationRepository getNotificationRepository(); + protected abstract RuntimeException getNotFoundException(String message); @Override @@ -68,7 +75,7 @@ public NotificationId start(StartNotification startNotification) { } @Override - public void update(Long notificationId, NotificationStatus notificationStatus, String reason) { + public void updateStatusTransition(Long notificationId, NotificationStatus notificationStatus, String reason) { Notification notification = loadOrNotFoundException(new NotificationId(notificationId)); List messages = notification.getNotifications(); @@ -98,6 +105,33 @@ public void update(Long notificationId, NotificationStatus notificationStatus, S getNotificationRepository().updateNotification(updatedNotification); } + @Override + public void editNotification(EditNotification editNotification) { + Notification notification = loadOrNotFoundException(new NotificationId(editNotification.getId())); + List affectedParts = assetAsBuiltRepository.getAssetsById(editNotification.getAffectedPartIds()); + List oldMessageIds = + notification.getNotifications().stream().map(NotificationMessage::getId).toList(); + + getNotificationRepository().deleteByIdIn(oldMessageIds); + notification.clearNotifications(); + notification.createInitialNotifications(affectedParts, traceabilityProperties.getBpn(), editNotification); + if (editNotification.getReceiverBpn() != null) { + notification.setBpn(BPN.of(editNotification.getReceiverBpn())); + } + if (editNotification.getTitle() != null) { + notification.setTitle(editNotification.getTitle()); + } + if (editNotification.getDescription() != null) { + notification.setDescription(editNotification.getDescription()); + } + if (editNotification.getAffectedPartIds() != null) { + notification.setAffectedPartIds(editNotification.getAffectedPartIds()); + } + + + getNotificationRepository().updateNotificationAndMessage(notification, editNotification.getSeverity()); + } + @Override public Notification find(Long id) { NotificationId investigationId = new NotificationId(id); @@ -174,10 +208,8 @@ private List getAssetEnumFieldValues(String fieldName) { return switch (fieldName) { case "status" -> Arrays.stream(NotificationStatus.values()).map(Enum::name).toList(); case "side" -> Arrays.stream(NotificationSide.values()).map(Enum::name).toList(); - case "messages_severity" -> - Arrays.stream(NotificationSeverity.values()).map(Enum::name).toList(); - case "type" -> - Arrays.stream(NotificationType.values()).map(Enum::name).toList(); + case "messages_severity" -> Arrays.stream(NotificationSeverity.values()).map(Enum::name).toList(); + case "type" -> Arrays.stream(NotificationType.values()).map(Enum::name).toList(); default -> null; }; } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/NotificationPublisherService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/NotificationPublisherService.java index 9bded8c91b..9017e1da10 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/NotificationPublisherService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/NotificationPublisherService.java @@ -33,7 +33,6 @@ 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.exception.NotificationIllegalUpdate; -import org.eclipse.tractusx.traceability.notification.domain.notification.exception.NotificationNotSupportedException; import org.eclipse.tractusx.traceability.notification.domain.notification.model.StartNotification; import org.springframework.stereotype.Service; @@ -60,30 +59,30 @@ public class NotificationPublisherService { public Notification startNotification(StartNotification startNotification) { BPN applicationBPN = traceabilityProperties.getBpn(); Notification notification = Notification.startNotification(startNotification.getTitle(), clock.instant(), applicationBPN, startNotification.getDescription(), startNotification.getType()); - if (startNotification.isAsBuilt()) { - Map> assetsAsBuiltBPNMap = assetAsBuiltRepository.getAssetsById(startNotification.getPartIds()).stream().collect(groupingBy(AssetBase::getManufacturerId)); - assetsAsBuiltBPNMap - .entrySet() - .stream() - .map(it -> { - String creator = getManufacturerNameByBpn(traceabilityProperties.getBpn().value()); - String sendToName = getManufacturerNameByBpn(startNotification.getReceiverBpn()); - return NotificationMessage.create( - applicationBPN, - startNotification.getReceiverBpn(), - startNotification.getDescription(), - startNotification.getTargetDate(), - startNotification.getSeverity(), - startNotification.getType(), - it, - creator, - sendToName); - }) - .forEach(notification::addNotificationMessage); - return notification; - } else { - throw new NotificationNotSupportedException(); - } + createMessages(startNotification, applicationBPN, notification, assetAsBuiltRepository); + return notification; + } + + private void createMessages(StartNotification startNotification, BPN applicationBPN, Notification notification, AssetAsBuiltRepository assetAsBuiltRepository) { + Map> assetsAsBuiltBPNMap = assetAsBuiltRepository.getAssetsById(startNotification.getAffectedPartIds()).stream().collect(groupingBy(AssetBase::getManufacturerId)); + assetsAsBuiltBPNMap + .entrySet() + .stream() + .map(it -> { + String creator = getManufacturerNameByBpn(applicationBPN.value()); + String sendToName = getManufacturerNameByBpn(startNotification.getReceiverBpn()); + return NotificationMessage.create( + applicationBPN, + startNotification.getReceiverBpn(), + startNotification.getDescription(), + startNotification.getTargetDate(), + startNotification.getSeverity(), + startNotification.getType(), + it, + creator, + sendToName); + }) + .forEach(notification::addNotificationMessage); } private String getManufacturerNameByBpn(String bpn) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/model/EditNotification.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/model/EditNotification.java new file mode 100644 index 0000000000..0e7773008b --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/model/EditNotification.java @@ -0,0 +1,63 @@ +/******************************************************************************** + * 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.domain.notification.model; + +import lombok.Builder; +import lombok.Data; +import notification.request.EditNotificationRequest; +import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationSeverity; + +import java.time.Instant; +import java.util.List; + + + +@Data +@Builder +public class EditNotification { + + private Long id; + + private String title; + + private String description; + + private Instant targetDate; + + private List affectedPartIds; + + private String receiverBpn; + + private NotificationSeverity severity; + + public static EditNotification from(EditNotificationRequest editNotificationRequest, Long notificationId) { + return EditNotification.builder() + .id(notificationId) + .title(editNotificationRequest.getTitle()) + .affectedPartIds(editNotificationRequest.getAffectedPartIds()) + .description(editNotificationRequest.getDescription()) + .targetDate(editNotificationRequest.getTargetDate()) + .severity(NotificationSeverity.fromString(editNotificationRequest.getSeverity() != null ? editNotificationRequest.getSeverity().getRealName() : null)) + .receiverBpn(editNotificationRequest.getReceiverBpn()) + .build(); + } + + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/model/StartNotification.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/model/StartNotification.java index 41cce47e9d..1dd7a694d7 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/model/StartNotification.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/model/StartNotification.java @@ -36,7 +36,7 @@ public class StartNotification { private String title; - private List partIds; + private List affectedPartIds; private String description; @@ -46,21 +46,18 @@ public class StartNotification { private NotificationType type; - private boolean isAsBuilt; - private String receiverBpn; public static StartNotification from(StartNotificationRequest startNotificationRequest) { return StartNotification.builder() .title(startNotificationRequest.getTitle()) - .partIds(startNotificationRequest.getPartIds()) + .affectedPartIds(startNotificationRequest.getAffectedPartIds()) .description(startNotificationRequest.getDescription()) .targetDate(startNotificationRequest.getTargetDate()) .severity(NotificationSeverity.from(startNotificationRequest.getSeverity())) .type(NotificationType.from(startNotificationRequest.getType())) .receiverBpn(startNotificationRequest.getReceiverBpn()) - .isAsBuilt(startNotificationRequest.isAsBuilt()) .build(); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/repository/NotificationRepository.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/repository/NotificationRepository.java index 6a944e5d62..4dea485c1a 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/repository/NotificationRepository.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/repository/NotificationRepository.java @@ -26,6 +26,7 @@ import org.eclipse.tractusx.traceability.common.model.SearchCriteria; 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.NotificationSeverity; import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationSide; import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationType; import org.springframework.data.domain.Pageable; @@ -45,6 +46,8 @@ public interface NotificationRepository { void updateNotification(Notification investigation); + void updateNotificationAndMessage(Notification notification, NotificationSeverity notificationSeverity); + PageResult getNotifications(Pageable pageable, SearchCriteria searchCriteria); long countOpenNotificationsByOwnershipAndNotificationType(List owners, NotificationType notificationType); @@ -53,4 +56,6 @@ public interface NotificationRepository { void updateErrorMessage(Notification investigation); + void deleteByIdIn(List messageIds); + } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/service/NotificationServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/service/NotificationServiceImpl.java index 58380fdb80..ad53076351 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/service/NotificationServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/service/NotificationServiceImpl.java @@ -19,6 +19,7 @@ package org.eclipse.tractusx.traceability.notification.domain.notification.service; +import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.eclipse.tractusx.traceability.notification.domain.notification.exception.NotificationNotFoundException; import org.eclipse.tractusx.traceability.notification.domain.notification.repository.NotificationRepository; @@ -32,9 +33,14 @@ public class NotificationServiceImpl extends AbstractNotificationService { private final NotificationRepository notificationRepository; - public NotificationServiceImpl(TraceabilityProperties traceabilityProperties, NotificationRepository alertRepository, NotificationPublisherService notificationPublisherService) { - super(traceabilityProperties, notificationPublisherService); + + public NotificationServiceImpl(TraceabilityProperties traceabilityProperties, + NotificationRepository alertRepository, + NotificationPublisherService notificationPublisherService, + AssetAsBuiltRepository assetAsBuiltRepository) { + super(traceabilityProperties, notificationPublisherService, assetAsBuiltRepository); this.notificationRepository = alertRepository; + } @Override diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/infrastructure/notification/model/NotificationEntity.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/infrastructure/notification/model/NotificationEntity.java index 608ad96498..fd304dd815 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/infrastructure/notification/model/NotificationEntity.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/infrastructure/notification/model/NotificationEntity.java @@ -88,7 +88,7 @@ public static Notification toDomain(NotificationEntity notificationEntity) { .createdAt(notificationEntity.getCreatedDate()) .description(notificationEntity.getDescription()) .notificationType(NotificationType.valueOf(notificationEntity.getType().name())) - .assetIds(assetIds) + .affectedPartIds(assetIds) .notifications(messages) .build(); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/infrastructure/notification/repository/NotificationRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/infrastructure/notification/repository/NotificationRepositoryImpl.java index 48de2feb16..1155d32c31 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/infrastructure/notification/repository/NotificationRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/infrastructure/notification/repository/NotificationRepositoryImpl.java @@ -35,6 +35,7 @@ import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationAffectedPart; 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; @@ -96,13 +97,13 @@ public NotificationId saveNotification(Notification notification) { List assetEntities = getAssetEntitiesByNotification(notification); if (assetEntities.isEmpty()) { - throw new IllegalArgumentException("No assets found for %s asset ids".formatted(String.join(", ", notification.getAssetIds()))); + throw new IllegalArgumentException("No assets found for %s asset ids".formatted(String.join(", ", notification.getAffectedPartIds()))); } NotificationEntity notificationEntity = NotificationEntity.from(notification, assetEntities); jpaNotificationRepository.save(notificationEntity); - notification.getNotifications().forEach(notificationMessage -> handleNotificationCreate(notificationEntity, notificationMessage, assetEntities)); + notification.getNotifications().forEach(notificationMessage -> handleMessageCreate(notificationEntity, notificationMessage, assetEntities)); return new NotificationId(notificationEntity.getId()); } @@ -111,13 +112,29 @@ public NotificationId saveNotification(Notification notification) { public void updateNotification(Notification notification) { NotificationEntity notificationEntity = jpaNotificationRepository.findById(notification.getNotificationId().value()) .orElseThrow(() -> new IllegalArgumentException(String.format("Investigation with id %s not found!", notification.getNotificationId().value()))); + notificationEntity.setStatus(NotificationStatusBaseEntity.fromStringValue(notification.getNotificationStatus().name())); + notificationEntity.setUpdated(clock.instant()); + notificationEntity.setCloseReason(notification.getCloseReason()); + notificationEntity.setAcceptReason(notification.getAcceptReason()); + notificationEntity.setDeclineReason(notification.getDeclineReason()); + handleMessageUpdate(notificationEntity, notification, null); + jpaNotificationRepository.save(notificationEntity); + } + @Override + public void updateNotificationAndMessage(Notification notification, NotificationSeverity notificationSeverity) { + NotificationEntity notificationEntity = jpaNotificationRepository.findById(notification.getNotificationId().value()) + .orElseThrow(() -> new IllegalArgumentException(String.format("Investigation with id %s not found!", notification.getNotificationId().value()))); + notificationEntity.setTitle(notification.getTitle()); + notificationEntity.setDescription(notification.getDescription()); + notificationEntity.setBpn(notification.getBpn()); + notificationEntity.setAssets(getAssetEntitiesByAssetIds(notification.getAffectedPartIds())); notificationEntity.setStatus(NotificationStatusBaseEntity.fromStringValue(notification.getNotificationStatus().name())); notificationEntity.setUpdated(clock.instant()); notificationEntity.setCloseReason(notification.getCloseReason()); notificationEntity.setAcceptReason(notification.getAcceptReason()); notificationEntity.setDeclineReason(notification.getDeclineReason()); - handleNotificationUpdate(notificationEntity, notification); + handleMessageUpdate(notificationEntity, notification, notificationSeverity); jpaNotificationRepository.save(notificationEntity); } @@ -170,12 +187,21 @@ public void updateErrorMessage(Notification notification) { jpaNotificationRepository.save(notificationEntity); } + @Override + public void deleteByIdIn(List messageIds) { + jpaNotificationMessageRepository.deleteAllByIdInBatch(messageIds); + } + private List getAssetEntitiesByNotification(Notification notification) { - return assetsAsBuiltRepository.findByIdIn(notification.getAssetIds()); + return assetsAsBuiltRepository.findByIdIn(notification.getAffectedPartIds()); + } + + private List getAssetEntitiesByAssetIds(List assetIds) { + return assetsAsBuiltRepository.findByIdIn(assetIds); } - private void handleNotificationCreate(NotificationEntity notificationEntity, NotificationMessage notificationDomain, List assetEntities) { - NotificationMessageEntity notificationMessageEntity = toNotificationMessageEntity(notificationEntity, notificationDomain, assetEntities); + private void handleMessageCreate(NotificationEntity notificationEntity, NotificationMessage messageDomain, List assetEntities) { + NotificationMessageEntity notificationMessageEntity = toNotificationMessageEntity(notificationEntity, messageDomain, assetEntities); Optional optionalNotificationMessage = jpaNotificationMessageRepository.findById(notificationMessageEntity.getId()); @@ -191,13 +217,13 @@ private void handleNotificationCreate(NotificationEntity notificationEntity, Not }); } - private NotificationMessageEntity toNotificationMessageEntity(NotificationEntity notificationEntity, NotificationMessage notification, List investigationAssets) { - List notificationAssets = filterNotificationAssets(notification, investigationAssets); + private NotificationMessageEntity toNotificationMessageEntity(NotificationEntity notificationEntity, NotificationMessage notificationMessage, List investigationAssets) { + List notificationAssets = filterNotificationAssets(notificationMessage, investigationAssets); if (notificationAssets.isEmpty()) { - throw new IllegalStateException("Investigation with id %s has no notification assets".formatted(notificationEntity.getId())); + throw new IllegalStateException("Investigation with id %s has no notificationMessage assets".formatted(notificationEntity.getId())); } - return NotificationMessageEntity.from(notificationEntity, notification, notificationAssets); + return NotificationMessageEntity.from(notificationEntity, notificationMessage, notificationAssets); } private List filterNotificationAssets(NotificationMessage notificationMessage, List assets) { @@ -206,10 +232,14 @@ private List filterNotificationAssets(NotificationMessage no return assets.stream().filter(it -> notificationAffectedAssetIds.contains(it.getId())).toList(); } - private void handleNotificationUpdate(NotificationEntity notificationEntity, Notification notification) { + private void handleMessageUpdate(NotificationEntity notificationEntity, Notification notification, NotificationSeverity notificationSeverity) { for (NotificationMessage notificationMessage : notification.getNotifications()) { + if (notificationSeverity != null){ + notificationMessage.setSeverity(notificationSeverity); + } List assetEntitiesByNotification = getAssetEntitiesByNotification(notification); - handleNotificationCreate(notificationEntity, notificationMessage, assetEntitiesByNotification); + handleMessageCreate(notificationEntity, notificationMessage, assetEntitiesByNotification); } } + } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMessageMapperTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMessageMapperTest.java index f8f305852b..9e7203b965 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMessageMapperTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/mapper/NotificationMessageMapperTest.java @@ -71,7 +71,7 @@ void testToReceiverInvestigation() { assertEquals(NotificationStatus.RECEIVED, result.getNotificationStatus()); assertEquals(NotificationSide.RECEIVER, result.getNotificationSide()); assertEquals(description, result.getDescription()); - assertEquals(List.of("123"), result.getAssetIds()); + assertEquals(List.of("123"), result.getAffectedPartIds()); assertEquals(List.of(notification), result.getNotifications()); assertEquals(NotificationType.INVESTIGATION, result.getNotificationType()); } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/infrastructure/edc/model/EdcNotificationModelTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/infrastructure/edc/model/EdcNotificationModelTest.java index d21473efd7..1cf0326697 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/infrastructure/edc/model/EdcNotificationModelTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/infrastructure/edc/model/EdcNotificationModelTest.java @@ -26,7 +26,7 @@ import notification.request.NotificationSeverityRequest; import notification.request.NotificationTypeRequest; import notification.request.StartNotificationRequest; -import notification.request.UpdateNotificationRequest; +import notification.request.UpdateNotificationStatusTransitionRequest; import notification.request.UpdateNotificationStatusRequest; import java.time.Instant; @@ -92,7 +92,6 @@ public void testSanitizeStartNotificationRequest() { "The description\n", targetDate, severity, - true, "BPN00001123123AS\n", NotificationTypeRequest.ALERT ); @@ -102,9 +101,8 @@ public void testSanitizeStartNotificationRequest() { StartNotificationRequest cleanRequest = sanitize(request); //THEN - assertEquals("urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca979 ", cleanRequest.getPartIds().get(1)); + assertEquals("urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca979 ", cleanRequest.getAffectedPartIds().get(1)); assertEquals("The description ", cleanRequest.getDescription()); - assertTrue(cleanRequest.isAsBuilt()); assertEquals("BPN00001123123AS ", cleanRequest.getReceiverBpn()); } @@ -127,17 +125,17 @@ public void testSanitizeCloseInvestigationRequest() { @Test public void testSanitizeUpdateNotificationRequest() { //GIVEN - UpdateNotificationRequest updateNotificationRequest = UpdateNotificationRequest + UpdateNotificationStatusTransitionRequest updateNotificationStatusTransitionRequest = UpdateNotificationStatusTransitionRequest .builder() .reason("Reason\n") .status(UpdateNotificationStatusRequest.ACCEPTED) .build(); //WHEN - UpdateNotificationRequest cleanUpdateNotificationRequest = sanitize(updateNotificationRequest); + UpdateNotificationStatusTransitionRequest cleanUpdateNotificationStatusTransitionRequest = sanitize(updateNotificationStatusTransitionRequest); //THEN - assertEquals("Reason ", cleanUpdateNotificationRequest.getReason()); + assertEquals("Reason ", cleanUpdateNotificationStatusTransitionRequest.getReason()); } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/DashboardControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/DashboardControllerIT.java index 5d70d73bfb..53009e2f88 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/DashboardControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/DashboardControllerIT.java @@ -162,11 +162,10 @@ void givenPendingInvestigation_whenGetDashboard_thenReturnPendingInvestigation() notificationSupport.defaultReceivedInvestigationStored(); String assetId = "urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978"; var notificationRequest = StartNotificationRequest.builder() - .partIds(List.of(assetId)) + .affectedPartIds(List.of(assetId)) .description("at least 15 characters long investigation description") .severity(NotificationSeverityRequest.MINOR) .type(NotificationTypeRequest.INVESTIGATION) - .isAsBuilt(true) .build(); // when diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/NotificationApiSupport.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/NotificationApiSupport.java new file mode 100644 index 0000000000..ac82cec078 --- /dev/null +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/NotificationApiSupport.java @@ -0,0 +1,102 @@ +/******************************************************************************** + * 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.integration.common.support; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.restassured.common.mapper.TypeRef; +import io.restassured.http.ContentType; +import io.restassured.http.Header; +import io.restassured.response.Response; +import io.restassured.response.ResponseBody; +import lombok.RequiredArgsConstructor; +import notification.request.EditNotificationRequest; +import notification.request.StartNotificationRequest; +import notification.response.NotificationResponse; +import org.eclipse.tractusx.traceability.common.model.PageResult; +import org.eclipse.tractusx.traceability.common.request.OwnPageable; +import org.eclipse.tractusx.traceability.common.request.PageableFilterRequest; +import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; +import org.hamcrest.Matchers; +import org.springframework.stereotype.Component; + +import java.util.Collections; +import java.util.List; + +import static io.restassured.RestAssured.given; +import static org.eclipse.tractusx.traceability.common.security.JwtRole.SUPERVISOR; + +@Component +@RequiredArgsConstructor +public class NotificationApiSupport { + + private final AssetsSupport assetsSupport; + private final ObjectMapper objectMapper; + + public int createNotificationRequest_withDefaultAssetsStored(Header authHeader, StartNotificationRequest startNotificationRequest) throws JsonProcessingException { + + assetsSupport.defaultAssetsStored(); + + // when + Response response = given() + .contentType(ContentType.JSON) + .body(objectMapper.writeValueAsString(startNotificationRequest)) + .header(authHeader) + .when() + .post("/api/notifications") + .then() + .statusCode(201) + .body("id", Matchers.isA(Number.class)) + .extract() + .response(); + + return response.path("id"); + + } + + public void editNotificationRequest(Header authHeader, EditNotificationRequest editNotificationRequest, int notificationId) throws JsonProcessingException { + + // when + given() + .contentType(ContentType.JSON) + .body(objectMapper.writeValueAsString(editNotificationRequest)) + .header(authHeader) + .when() + .put("/api/notifications/" + notificationId + "/edit") + .then() + .statusCode(204); + } + + public PageResult getNotificationsRequest(Header authHeader){ + Response response = given() + .header(authHeader) + .body(new PageableFilterRequest(new OwnPageable(0, 10, Collections.emptyList()), new SearchCriteriaRequestParam(List.of("channel,EQUAL,SENDER,AND")))) + .contentType(ContentType.JSON) + .when() + .post("/api/notifications/filter") + .then() + .statusCode(200) + .extract().response(); + + return response.as(new TypeRef>() {}); + + } +} diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/NotificationMessageSupport.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/NotificationMessageSupport.java index 7121cf9b9d..d39458cf10 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/NotificationMessageSupport.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/NotificationMessageSupport.java @@ -34,7 +34,7 @@ public class NotificationMessageSupport { private final JpaNotificationMessageRepository jpaNotificationMessageRepository; - public void assertNotificationsSize(int size) { + public void assertMessageSize(int size) { List notifications = jpaNotificationMessageRepository.findAll(); assertThat(notifications).hasSize(size); } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/EditNotificationIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/EditNotificationIT.java new file mode 100644 index 0000000000..44d8570507 --- /dev/null +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/EditNotificationIT.java @@ -0,0 +1,160 @@ +package org.eclipse.tractusx.traceability.integration.notification; + +import io.restassured.http.ContentType; +import io.restassured.http.Header; +import lombok.RequiredArgsConstructor; +import lombok.val; +import notification.request.EditNotificationRequest; +import notification.request.NotificationSeverityRequest; +import notification.request.NotificationTypeRequest; +import notification.request.StartNotificationRequest; +import notification.response.NotificationResponse; +import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; +import org.eclipse.tractusx.traceability.common.model.PageResult; +import org.eclipse.tractusx.traceability.common.request.OwnPageable; +import org.eclipse.tractusx.traceability.common.request.PageableFilterRequest; +import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; +import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; +import org.eclipse.tractusx.traceability.integration.common.support.NotificationApiSupport; +import org.eclipse.tractusx.traceability.integration.common.support.NotificationMessageSupport; +import org.hamcrest.Matchers; +import org.jose4j.lang.JoseException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.testcontainers.shaded.com.fasterxml.jackson.core.JsonProcessingException; +import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper; + +import java.util.Collections; +import java.util.List; + +import static io.restassured.RestAssured.given; +import static org.assertj.core.api.Assertions.assertThat; +import static org.eclipse.tractusx.traceability.common.security.JwtRole.SUPERVISOR; + +@RequiredArgsConstructor +class EditNotificationIT extends IntegrationTestSpecification { + + @Autowired + NotificationMessageSupport notificationMessageSupport; + @Autowired + AssetAsBuiltRepository assetAsBuiltRepository; + + ObjectMapper objectMapper; + @Autowired + NotificationApiSupport notificationAPISupport; + + @BeforeEach + void setUp() { + objectMapper = new ObjectMapper(); + } + + @Test + void shouldUpdateInvestigation_RemovingOnePartOnly() throws JoseException, com.fasterxml.jackson.core.JsonProcessingException { + Header authHeader = oAuth2Support.jwtAuthorization(SUPERVISOR); + // given + List partIds = List.of( + "urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978", // BPN: BPNL00000003AYRE + "urn:uuid:d387fa8e-603c-42bd-98c3-4d87fef8d2bb", // BPN: BPNL00000003AYRE + "urn:uuid:0ce83951-bc18-4e8f-892d-48bad4eb67ef" // BPN: BPNL00000003AXS3 + ); + String description = "at least 15 characters long investigation description"; + String title = "the title"; + + val startNotificationRequest = StartNotificationRequest.builder() + .affectedPartIds(partIds) + .description(description) + .title(title) + .type(NotificationTypeRequest.INVESTIGATION) + .severity(NotificationSeverityRequest.MINOR) + .build(); + int id = notificationAPISupport.createNotificationRequest_withDefaultAssetsStored(authHeader, startNotificationRequest); + + // given + List editedPartIds = List.of( + "urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978", // BPN: BPNL00000003AYRE + "urn:uuid:d387fa8e-603c-42bd-98c3-4d87fef8d2bb" // BPN: BPNL00000003AYRE + ); + + val request = EditNotificationRequest.builder() + .affectedPartIds(editedPartIds) + .severity(startNotificationRequest.getSeverity()) + .description(startNotificationRequest.getDescription()) + .title(startNotificationRequest.getTitle()) + .build(); + + // when + notificationAPISupport.editNotificationRequest(authHeader, request, id); + + // then + notificationMessageSupport.assertMessageSize(1); + + given() + .header(authHeader) + .body(new PageableFilterRequest(new OwnPageable(0, 10, Collections.emptyList()), new SearchCriteriaRequestParam(List.of("channel,EQUAL,SENDER,AND")))) + .contentType(ContentType.JSON) + .when() + .post("/api/notifications/filter") + .then() + .statusCode(200) + .body("page", Matchers.is(0)) + .body("pageSize", Matchers.is(10)) + .body("content", Matchers.hasSize(1)) + .log().all(); + } + + @Test + void shouldUpdateInvestigationFields() throws JsonProcessingException, JoseException, com.fasterxml.jackson.core.JsonProcessingException { + Header authHeader = oAuth2Support.jwtAuthorization(SUPERVISOR); + // given + List partIds = List.of( + "urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978", // BPN: BPNL00000003AYRE + "urn:uuid:d387fa8e-603c-42bd-98c3-4d87fef8d2bb", // BPN: BPNL00000003AYRE + "urn:uuid:0ce83951-bc18-4e8f-892d-48bad4eb67ef" // BPN: BPNL00000003AXS3 + ); + String description = "at least 15 characters long investigation description"; + String title = "the initial title"; + val startNotificationRequest = StartNotificationRequest.builder() + .affectedPartIds(partIds) + .description(description) + .title(title) + .type(NotificationTypeRequest.INVESTIGATION) + .severity(NotificationSeverityRequest.MINOR) + .build(); + + + int id = notificationAPISupport.createNotificationRequest_withDefaultAssetsStored(authHeader, startNotificationRequest); + + // given + String editedDescription = "at least 15 characters long investigation description which was edited"; + + String editedTitle = "changed title"; + val editNotificationRequest = EditNotificationRequest.builder() + .affectedPartIds(partIds) + .description(editedDescription) + .title(editedTitle) + .affectedPartIds(startNotificationRequest.getAffectedPartIds()) + .severity(NotificationSeverityRequest.CRITICAL) + .build(); + + // when + notificationAPISupport.editNotificationRequest(authHeader, editNotificationRequest, id); + + // then + notificationMessageSupport.assertMessageSize(2); + + PageResult notificationResponsePageResult + = notificationAPISupport.getNotificationsRequest(authHeader); + + NotificationResponse notificationResponse = notificationResponsePageResult.content().get(0); + assertThat(notificationResponse.getId()).isEqualTo(id); + assertThat(notificationResponse.getDescription()).isEqualTo(editNotificationRequest.getDescription()); + assertThat(notificationResponse.getTitle()).isEqualTo(editNotificationRequest.getTitle()); + assertThat(notificationResponse.getAssetIds()).hasSize(editNotificationRequest.getAffectedPartIds().size()); + assertThat(notificationResponse.getSeverity().getRealName()).isEqualTo(editNotificationRequest.getSeverity().getRealName()); + assertThat(notificationResponsePageResult.content()).hasSize(1); + assertThat(notificationResponse.getMessages().get(0).getSeverity().getRealName()).isEqualTo(editNotificationRequest.getSeverity().getRealName()); + assertThat(notificationResponse.getMessages().get(0).getTargetDate()).isEqualTo(editNotificationRequest.getTargetDate()); + + } +} diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/alert/PublisherAlertsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/alert/PublisherAlertsControllerIT.java index 42e0854d78..beffe21448 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/alert/PublisherAlertsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/alert/PublisherAlertsControllerIT.java @@ -53,7 +53,7 @@ import notification.request.NotificationSeverityRequest; import notification.request.NotificationTypeRequest; import notification.request.StartNotificationRequest; -import notification.request.UpdateNotificationRequest; +import notification.request.UpdateNotificationStatusTransitionRequest; import notification.request.UpdateNotificationStatusRequest; import java.time.Instant; @@ -133,12 +133,11 @@ void shouldStartAlert() throws JsonProcessingException, JoseException { assetsSupport.defaultAssetsStored(); val request = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description(description) .severity(severity) .type(NotificationTypeRequest.ALERT) .receiverBpn(receiverBpn) - .isAsBuilt(true) .build(); // when @@ -185,7 +184,7 @@ void givenMissingSeverity_whenStartAlert_thenBadRequest() throws JsonProcessingE ); String description = "at least 15 characters long investigation description"; val request = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description(description) .build(); @@ -212,7 +211,7 @@ void givenDescriptionOverMaxLength_whenStartAlert_thenBadRequest() throws JsonPr String description = RandomStringUtils.random(1001); val request = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description(description) .severity(NotificationSeverityRequest.MINOR) .receiverBpn("BPN") @@ -235,7 +234,7 @@ void givenTooLongAlertReason_whenUpdateAlert_thenBadRequest() throws JsonProcess // given String description = RandomStringUtils.random(1001); - UpdateNotificationRequest request = UpdateNotificationRequest + UpdateNotificationStatusTransitionRequest request = UpdateNotificationStatusTransitionRequest .builder() .status(UpdateNotificationStatusRequest.ACCEPTED) .reason(description) @@ -259,7 +258,7 @@ void givenWrongStatus_whenUpdateAlert_thenBadRequest() throws JsonProcessingExce String description = RandomStringUtils.random(15); - UpdateNotificationRequest request = UpdateNotificationRequest + UpdateNotificationStatusTransitionRequest request = UpdateNotificationStatusTransitionRequest .builder() .status(UpdateNotificationStatusRequest.ACCEPTED) .reason(description) @@ -285,12 +284,11 @@ void shouldCancelAlert() throws JsonProcessingException, JoseException { String filterString = "channel,EQUAL,SENDER,AND"; assetsSupport.defaultAssetsStored(); val startAlertRequest = StartNotificationRequest.builder() - .partIds(List.of("urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978")) + .affectedPartIds(List.of("urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978")) .description("at least 15 characters long investigation description") .severity(NotificationSeverityRequest.MAJOR) .type(NotificationTypeRequest.ALERT) .receiverBpn("BPN") - .isAsBuilt(true) .build(); val alertId = given() @@ -351,12 +349,11 @@ void shouldApproveAlertStatus() throws JsonProcessingException, JoseException { assetsSupport.defaultAssetsStored(); val startAlertRequest = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description(description) .severity(NotificationSeverityRequest.MINOR) .type(NotificationTypeRequest.ALERT) .receiverBpn("BPN") - .isAsBuilt(true) .build(); // when @@ -408,12 +405,11 @@ void shouldCloseAlertStatus() throws JsonProcessingException, JoseException { assetsSupport.defaultAssetsStored(); val startAlertRequest = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description(description) .severity(NotificationSeverityRequest.MINOR) .type(NotificationTypeRequest.ALERT) .receiverBpn("BPN") - .isAsBuilt(true) .build(); // when @@ -521,12 +517,11 @@ void shouldBeCreatedBySender() throws JsonProcessingException, JoseException { String description = "at least 15 characters long investigation description"; assetsSupport.defaultAssetsStored(); val startAlertRequest = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description(description) .severity(NotificationSeverityRequest.MINOR) .type(NotificationTypeRequest.ALERT) .receiverBpn("BPN") - .isAsBuilt(true) .build(); // when @@ -573,11 +568,10 @@ void shouldReturn404WhenNoNotificationTypeSpecified() throws JsonProcessingExcep assetsSupport.defaultAssetsStored(); val startAlertRequest = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description(description) .severity(NotificationSeverityRequest.MINOR) .receiverBpn("BPN") - .isAsBuilt(true) .build(); // when diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/investigation/PublisherInvestigationsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/investigation/PublisherInvestigationsControllerIT.java index db1439e0d7..f9f8b43db7 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/investigation/PublisherInvestigationsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/investigation/PublisherInvestigationsControllerIT.java @@ -21,6 +21,12 @@ import io.restassured.http.ContentType; import lombok.val; +import notification.request.CloseNotificationRequest; +import notification.request.NotificationSeverityRequest; +import notification.request.NotificationTypeRequest; +import notification.request.StartNotificationRequest; +import notification.request.UpdateNotificationStatusRequest; +import notification.request.UpdateNotificationStatusTransitionRequest; import org.apache.commons.lang3.RandomStringUtils; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; @@ -30,6 +36,7 @@ import org.eclipse.tractusx.traceability.common.security.JwtRole; import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; import org.eclipse.tractusx.traceability.integration.common.support.AssetsSupport; +import org.eclipse.tractusx.traceability.integration.common.support.NotificationApiSupport; import org.eclipse.tractusx.traceability.integration.common.support.NotificationMessageSupport; import org.eclipse.tractusx.traceability.integration.common.support.NotificationSupport; import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationAffectedPart; @@ -48,12 +55,6 @@ import org.springframework.transaction.annotation.Transactional; import org.testcontainers.shaded.com.fasterxml.jackson.core.JsonProcessingException; import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper; -import notification.request.CloseNotificationRequest; -import notification.request.NotificationSeverityRequest; -import notification.request.NotificationTypeRequest; -import notification.request.StartNotificationRequest; -import notification.request.UpdateNotificationRequest; -import notification.request.UpdateNotificationStatusRequest; import java.time.Instant; import java.util.Collections; @@ -63,20 +64,21 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.tractusx.traceability.common.security.JwtRole.SUPERVISOR; + class PublisherInvestigationsControllerIT extends IntegrationTestSpecification { @Autowired NotificationReceiverService notificationReceiverService; - @Autowired AssetsSupport assetsSupport; @Autowired NotificationMessageSupport notificationMessageSupport; - @Autowired NotificationSupport notificationSupport; @Autowired AssetAsBuiltRepository assetAsBuiltRepository; + @Autowired + NotificationApiSupport notificationApiSupport; ObjectMapper objectMapper; @@ -114,11 +116,13 @@ void shouldReceiveNotification() { // then notificationSupport.assertInvestigationsSize(1); - notificationMessageSupport.assertNotificationsSize(1); + notificationMessageSupport.assertMessageSize(1); } @Test - void shouldStartInvestigation() throws JsonProcessingException, JoseException { + void shouldStartInvestigation() throws JoseException, com.fasterxml.jackson.core.JsonProcessingException { + + // given List partIds = List.of( "urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978", // BPN: BPNL00000003AYRE @@ -126,35 +130,21 @@ void shouldStartInvestigation() throws JsonProcessingException, JoseException { "urn:uuid:0ce83951-bc18-4e8f-892d-48bad4eb67ef" // BPN: BPNL00000003AXS3 ); String description = "at least 15 characters long investigation description"; + String title = "the title"; - assetsSupport.defaultAssetsStored(); - - val request = StartNotificationRequest.builder() - .partIds(partIds) + val startNotificationRequest = StartNotificationRequest.builder() + .affectedPartIds(partIds) .description(description) + .title(title) .type(NotificationTypeRequest.INVESTIGATION) .severity(NotificationSeverityRequest.MINOR) - .isAsBuilt(true) .build(); // when - given() - .contentType(ContentType.JSON) - .body(objectMapper.writeValueAsString(request)) - .header(oAuth2Support.jwtAuthorization(SUPERVISOR)) - .when() - .post("/api/notifications") - .then() - .statusCode(201) - .body("id", Matchers.isA(Number.class)); + notificationApiSupport.createNotificationRequest_withDefaultAssetsStored(oAuth2Support.jwtAuthorization(SUPERVISOR), startNotificationRequest); // then - partIds.forEach(partId -> { - AssetBase asset = assetAsBuiltRepository.getAssetById(partId); - assertThat(asset).isNotNull(); - }); - - notificationMessageSupport.assertNotificationsSize(2); + notificationMessageSupport.assertMessageSize(2); given() .header(oAuth2Support.jwtAuthorization(SUPERVISOR)) @@ -167,6 +157,7 @@ void shouldStartInvestigation() throws JsonProcessingException, JoseException { .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) .body("content", Matchers.hasSize(1)); + } @Test @@ -180,7 +171,7 @@ void givenMissingSeverity_whenStartInvestigation_thenBadRequest() throws JsonPro String description = "at least 15 characters long investigation description"; val request = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description(description) .build(); // when/then @@ -206,7 +197,7 @@ void givenDescriptionExceedsMaxLength_whenStartInvestigation_thenBadRequest() th String description = RandomStringUtils.random(1001); val request = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description(description) .severity(NotificationSeverityRequest.MINOR) .build(); @@ -223,18 +214,19 @@ void givenDescriptionExceedsMaxLength_whenStartInvestigation_thenBadRequest() th .body(Matchers.containsString("Description should have at least 15 characters and at most 1000 characters")); } + @Test void givenInvestigationReasonTooLong_whenUpdate_thenBadRequest() throws JsonProcessingException, JoseException { // given String description = RandomStringUtils.random(1001); - UpdateNotificationRequest request = - UpdateNotificationRequest + UpdateNotificationStatusTransitionRequest request = + UpdateNotificationStatusTransitionRequest .builder() .reason(description) .status(UpdateNotificationStatusRequest.ACCEPTED) .build(); - // when/then + // when/then given() .contentType(ContentType.JSON) .body(objectMapper.writeValueAsString(request)) @@ -251,8 +243,8 @@ void givenWrongStatus_whenUpdateInvestigation_thenBadRequest() throws JsonProces // given String description = RandomStringUtils.random(15); - UpdateNotificationRequest request = - UpdateNotificationRequest + UpdateNotificationStatusTransitionRequest request = + UpdateNotificationStatusTransitionRequest .builder() .reason(description) .status(UpdateNotificationStatusRequest.ACCEPTED) @@ -276,11 +268,10 @@ void shouldCancelInvestigation() throws JsonProcessingException, JoseException { // given assetsSupport.defaultAssetsStored(); val startInvestigationRequest = StartNotificationRequest.builder() - .partIds(List.of("urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978")) + .affectedPartIds(List.of("urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978")) .description("at least 15 characters long investigation description") .type(NotificationTypeRequest.INVESTIGATION) .severity(NotificationSeverityRequest.MAJOR) - .isAsBuilt(true) .build(); val investigationId = given() @@ -337,11 +328,10 @@ void shouldApproveInvestigationStatus() throws JsonProcessingException, JoseExce assetsSupport.defaultAssetsStored(); val startInvestigationRequest = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description(description) .severity(NotificationSeverityRequest.MINOR) .type(NotificationTypeRequest.INVESTIGATION) - .isAsBuilt(true) .build(); // when @@ -380,7 +370,7 @@ void shouldApproveInvestigationStatus() throws JsonProcessingException, JoseExce .body("content", Matchers.hasSize(1)) .body("content[0].sendTo", Matchers.is(Matchers.not(Matchers.blankOrNullString()))); - notificationMessageSupport.assertNotificationsSize(4); + notificationMessageSupport.assertMessageSize(4); } @Test @@ -394,11 +384,10 @@ void shouldCloseInvestigationStatus() throws JsonProcessingException, JoseExcept assetsSupport.defaultAssetsStored(); val startInvestigationRequest = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description(description) .type(NotificationTypeRequest.INVESTIGATION) .severity(NotificationSeverityRequest.MINOR) - .isAsBuilt(true) .build(); @@ -466,7 +455,7 @@ void shouldCloseInvestigationStatus() throws JsonProcessingException, JoseExcept .body("pageSize", Matchers.is(10)) .body("content", Matchers.hasSize(1)); - notificationMessageSupport.assertNotificationsSize(3); + notificationMessageSupport.assertMessageSize(3); notificationSupport.assertInvestigationsSize(1); notificationSupport.assertInvestigationStatus(NotificationStatus.CLOSED); } @@ -506,11 +495,10 @@ void shouldBeCreatedBySender() throws JsonProcessingException, JoseException { String description = "at least 15 characters long investigation description"; assetsSupport.defaultAssetsStored(); val startInvestigationRequest = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description(description) .severity(NotificationSeverityRequest.MINOR) .type(NotificationTypeRequest.INVESTIGATION) - .isAsBuilt(true) .build(); // when @@ -530,7 +518,7 @@ void shouldBeCreatedBySender() throws JsonProcessingException, JoseException { assertThat(asset).isNotNull(); }); - notificationMessageSupport.assertNotificationsSize(2); + notificationMessageSupport.assertMessageSize(2); given() .header(oAuth2Support.jwtAuthorization(SUPERVISOR)) .body(new PageableFilterRequest(new OwnPageable(0, 10, Collections.emptyList()), new SearchCriteriaRequestParam(List.of("channel,EQUAL,SENDER,AND")))) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/application/alert/response/AlertResponseTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/application/alert/response/AlertResponseTest.java index f1f74535bf..e135ae3f9d 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/application/alert/response/AlertResponseTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/application/alert/response/AlertResponseTest.java @@ -60,7 +60,7 @@ void givenNotification_whenFrom_thenConstructProperAlertResponse() { .map(NotificationMessage::getCreatedByName) .orElse(null)) .hasFieldOrPropertyWithValue("createdDate", notification.getCreatedAt().toString()) - .hasFieldOrPropertyWithValue("assetIds", notification.getAssetIds()) + .hasFieldOrPropertyWithValue("assetIds", notification.getAffectedPartIds()) .hasFieldOrPropertyWithValue("channel", NotificationSideResponse.SENDER) .hasFieldOrPropertyWithValue("reason", new NotificationReasonResponse( notification.getCloseReason(), diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/application/alert/rest/AlertControllerTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/application/alert/rest/NotificationControllerTest.java similarity index 83% rename from tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/application/alert/rest/AlertControllerTest.java rename to tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/application/alert/rest/NotificationControllerTest.java index a317dc43cb..e9bb49929a 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/application/alert/rest/AlertControllerTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/application/alert/rest/NotificationControllerTest.java @@ -36,7 +36,7 @@ import notification.request.NotificationSeverityRequest; import notification.request.NotificationTypeRequest; import notification.request.StartNotificationRequest; -import notification.request.UpdateNotificationRequest; +import notification.request.UpdateNotificationStatusTransitionRequest; import notification.request.UpdateNotificationStatusRequest; import notification.response.NotificationIdResponse; import notification.response.NotificationReasonResponse; @@ -55,10 +55,10 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -class AlertControllerTest { +class NotificationControllerTest { @Mock - private NotificationService alertService; + private NotificationService notificationService; @InjectMocks @@ -71,17 +71,17 @@ void givenRequestBody_whenAlertAssets_thenResponse() { final Instant targetDate = Instant.parse("2099-03-11T22:44:06.333826952Z"); final NotificationId notificationId = new NotificationId(666L); final StartNotificationRequest request = StartNotificationRequest.builder() - .partIds(partIds) + .affectedPartIds(partIds) .description("description") .targetDate(targetDate) .type(NotificationTypeRequest.ALERT) .severity(NotificationSeverityRequest.MINOR) .receiverBpn("BPN00001") .build(); - when(alertService.start(Mockito.eq(from(request)))).thenReturn(notificationId); + when(notificationService.start(Mockito.eq(from(request)))).thenReturn(notificationId); // when - final NotificationIdResponse result = controller.alertAssets(request); + final NotificationIdResponse result = controller.createNotification(request); // then assertThat(result).hasFieldOrPropertyWithValue("id", notificationId.value()); @@ -95,10 +95,10 @@ void givenRequest_whenGetAlert_thenProperResponse() { NotificationStatus.ACCEPTED, "bpn" ); - when(alertService.find(request)).thenReturn(notification); + when(notificationService.find(request)).thenReturn(notification); // when - final NotificationResponse result = controller.getAlert(request); + final NotificationResponse result = controller.getNotificationById(request); // then assertThat(result) @@ -114,7 +114,7 @@ void givenRequest_whenGetAlert_thenProperResponse() { .map(NotificationMessage::getCreatedByName) .orElse(null)) .hasFieldOrPropertyWithValue("createdDate", notification.getCreatedAt().toString()) - .hasFieldOrPropertyWithValue("assetIds", notification.getAssetIds()) + .hasFieldOrPropertyWithValue("assetIds", notification.getAffectedPartIds()) .hasFieldOrPropertyWithValue("channel", NotificationSideResponse.SENDER) .hasFieldOrPropertyWithValue("reason", new NotificationReasonResponse( notification.getCloseReason(), @@ -132,10 +132,10 @@ void givenRequest_whenApproveAlert_thenProcessCorrectly() { final Long request = 1L; // when - controller.approveAlert(request); + controller.approveNotificationById(request); // then - verify(alertService, times(1)).approve(request); + verify(notificationService, times(1)).approve(request); } @Test @@ -144,10 +144,10 @@ void givenRequest_whenCancelAlert_thenProcessCorrectly() { final Long request = 1L; // when - controller.cancelAlert(request); + controller.cancelNotificationById(request); // then - verify(alertService, times(1)).cancel(request); + verify(notificationService, times(1)).cancel(request); } @Test @@ -158,10 +158,10 @@ void givenRequest_whenCloseAlert_thenProcessCorrectly() { CloseNotificationRequest request = CloseNotificationRequest.builder().reason("just because").build(); // when - controller.closeAlert(param, request); + controller.closeNotificationById(param, request); // then - verify(alertService, times(1)).update(param, NotificationStatus.CLOSED, "just because"); + verify(notificationService, times(1)).updateStatusTransition(param, NotificationStatus.CLOSED, "just because"); } @Test @@ -170,18 +170,18 @@ void givenRequest_whenUpdateAlert_thenProcessCorrectly() { final Long param = 1L; - UpdateNotificationRequest request = - UpdateNotificationRequest.builder() + UpdateNotificationStatusTransitionRequest request = + UpdateNotificationStatusTransitionRequest.builder() .status(UpdateNotificationStatusRequest.ACCEPTED) .reason("just because I say so") .build(); // when - controller.updateAlert(param, request); + controller.updateNotificationStatusById(param, request); // then - verify(alertService, times(1)).update(param, NotificationStatus.ACCEPTED, "just because I say so"); + verify(notificationService, times(1)).updateStatusTransition(param, NotificationStatus.ACCEPTED, "just because I say so"); } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/domain/service/NotificationPublisherServiceTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/domain/service/NotificationPublisherServiceTest.java index 3d7fd8529a..aa3bb73eb3 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/domain/service/NotificationPublisherServiceTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/domain/service/NotificationPublisherServiceTest.java @@ -96,13 +96,12 @@ void testStartInvestigationSuccessful() { String receiverBpn = "someReceiverBpn"; StartNotification startNotification = StartNotification.builder() .title(title) - .partIds(assets) + .affectedPartIds(assets) .description(description) .targetDate(targetDate) .severity(NotificationSeverity.MINOR) .type(NotificationType.INVESTIGATION) .receiverBpn(receiverBpn) - .isAsBuilt(true) .build(); // When @@ -118,29 +117,6 @@ void testStartInvestigationSuccessful() { verify(assetRepository).getAssetsById(Arrays.asList("asset-1", "asset-2")); } - @Test - void testThrowNotificationNotSupportedException() { - // Given - String title = "Title"; - String description = "Test investigation"; - String receiverBpn = "someReceiverBpn"; - Instant targetDate = Instant.parse("2022-03-01T12:00:00Z"); - List assets = Arrays.asList("asset-1", "asset-2"); - StartNotification startNotification = StartNotification.builder() - .title(title) - .partIds(assets) - .description(description) - .targetDate(targetDate) - .severity(NotificationSeverity.MINOR) - .type(NotificationType.INVESTIGATION) - .receiverBpn(receiverBpn) - .isAsBuilt(false) - .build(); - - // Then - assertThrows(NotificationNotSupportedException.class, () -> notificationPublisherService.startNotification(startNotification)); - } - @Test void testStartAlertSuccessful() { // Given @@ -153,13 +129,12 @@ void testStartAlertSuccessful() { when(assetRepository.getAssetsById(assets)).thenReturn(List.of(AssetTestDataFactory.createAssetTestData())); StartNotification startNotification = StartNotification.builder() .title(title) - .partIds(assets) + .affectedPartIds(assets) .description(description) .targetDate(targetDate) .severity(NotificationSeverity.MINOR) .type(NotificationType.INVESTIGATION) .receiverBpn(receiverBpn) - .isAsBuilt(true) .build(); // When Notification result = notificationPublisherService.startNotification(startNotification); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/infrastructure/investigation/repository/InvestigationsRepositoryImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/infrastructure/investigation/repository/InvestigationsRepositoryImplTest.java index 8f75a39118..6226585fd0 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/infrastructure/investigation/repository/InvestigationsRepositoryImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/infrastructure/investigation/repository/InvestigationsRepositoryImplTest.java @@ -71,7 +71,7 @@ void updateErrorMessage() { // Given NotificationMessage message = NotificationMessage.builder().notificationStatus(NotificationStatus.ACKNOWLEDGED).affectedParts(List.of(new NotificationAffectedPart("123"))).build(); - Notification notification = Notification.builder().notificationStatus(NotificationStatus.ACKNOWLEDGED).assetIds(List.of("123")).notificationId(new NotificationId(123L)).bpn(BPN.of("ABC")).notifications(List.of(message)).build(); + Notification notification = Notification.builder().notificationStatus(NotificationStatus.ACKNOWLEDGED).affectedPartIds(List.of("123")).notificationId(new NotificationId(123L)).bpn(BPN.of("ABC")).notifications(List.of(message)).build(); AssetAsBuiltEntity assetAsBuiltEntity = AssetAsBuiltEntity.builder().id("123").build(); NotificationEntity entity = NotificationEntity.builder().assets(List.of(assetAsBuiltEntity)).build(); NotificationMessageEntity notificationEntity = NotificationMessageEntity.from(entity, message, List.of(assetAsBuiltEntity)); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/infrastructure/investigation/repository/NotificationRepositoryImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/infrastructure/investigation/repository/NotificationRepositoryImplTest.java index 83134ef3c8..174d8d9c2e 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/infrastructure/investigation/repository/NotificationRepositoryImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/infrastructure/investigation/repository/NotificationRepositoryImplTest.java @@ -71,7 +71,7 @@ void updateErrorMessage() { // Given NotificationMessage message = NotificationMessage.builder().notificationStatus(NotificationStatus.ACKNOWLEDGED).affectedParts(List.of(new NotificationAffectedPart("123"))).build(); - Notification notification = Notification.builder().notificationStatus(NotificationStatus.ACKNOWLEDGED).assetIds(List.of("123")).notificationId(new NotificationId(123L)).bpn(BPN.of("ABC")).notifications(List.of(message)).build(); + Notification notification = Notification.builder().notificationStatus(NotificationStatus.ACKNOWLEDGED).affectedPartIds(List.of("123")).notificationId(new NotificationId(123L)).bpn(BPN.of("ABC")).notifications(List.of(message)).build(); AssetAsBuiltEntity assetAsBuiltEntity = AssetAsBuiltEntity.builder().id("123").build(); NotificationEntity entity = NotificationEntity.builder().assets(List.of(assetAsBuiltEntity)).build(); NotificationMessageEntity notificationEntity = NotificationMessageEntity.from(entity, message, List.of(assetAsBuiltEntity)); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/investigation/rest/model/UpdateNotificationStatusTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/investigation/rest/model/EditNotificationStatusTest.java similarity index 98% rename from tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/investigation/rest/model/UpdateNotificationStatusTest.java rename to tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/investigation/rest/model/EditNotificationStatusTest.java index da5557b7d2..af80c1159e 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/investigation/rest/model/UpdateNotificationStatusTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/investigation/rest/model/EditNotificationStatusTest.java @@ -24,7 +24,7 @@ import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; -class UpdateNotificationStatusTest { +class EditNotificationStatusTest { @Test void testToInvestigationStatusACCEPTED() { diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/investigation/rest/validation/UpdateNotificationValidatorTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/investigation/rest/validation/EditNotificationValidatorTest.java similarity index 88% rename from tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/investigation/rest/validation/UpdateNotificationValidatorTest.java rename to tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/investigation/rest/validation/EditNotificationValidatorTest.java index e2922ad1c8..350ffa38f7 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/investigation/rest/validation/UpdateNotificationValidatorTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/notification/investigation/rest/validation/EditNotificationValidatorTest.java @@ -27,14 +27,14 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; -import notification.request.UpdateNotificationRequest; +import notification.request.UpdateNotificationStatusTransitionRequest; import notification.request.UpdateNotificationStatusRequest; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; @ExtendWith(MockitoExtension.class) -class UpdateNotificationValidatorTest { +class EditNotificationValidatorTest { @Test @DisplayName("No Validation Success for invalid Reason") @@ -44,7 +44,7 @@ void testUnsuccessfulValidationForInvalidReason() { String reason = "some-reason-for-update"; String errorMessage = "Update investigation reason can't be present for ACKNOWLEDGED status"; - UpdateNotificationRequest request = UpdateNotificationRequest.builder().build(); + UpdateNotificationStatusTransitionRequest request = UpdateNotificationStatusTransitionRequest.builder().build(); request.setReason(reason); request.setStatus(acknowledged); UpdateNotificationValidationException exception = assertThrows(UpdateNotificationValidationException.class, () -> UpdateNotificationValidator.validate(request)); @@ -56,7 +56,7 @@ void testUnsuccessfulValidationForInvalidReason() { @DisplayName("Execute Validation successfully") void testSuccessfulValidation() { UpdateNotificationStatusRequest accepted = UpdateNotificationStatusRequest.ACCEPTED; - UpdateNotificationRequest request = UpdateNotificationRequest.builder().build(); + UpdateNotificationStatusTransitionRequest request = UpdateNotificationStatusTransitionRequest.builder().build(); request.setReason("abcdefg12313212321123"); request.setStatus(accepted); UpdateNotificationValidator.validate(request); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/InvestigationTestDataFactory.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/InvestigationTestDataFactory.java index ac2e0e40e6..6e4e8b6c8e 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/InvestigationTestDataFactory.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/InvestigationTestDataFactory.java @@ -68,7 +68,7 @@ public static Notification createInvestigationTestData(NotificationStatus invest .description(description) .notificationType(NotificationType.INVESTIGATION) .createdAt(createdAt) - .assetIds(assetIds) + .affectedPartIds(assetIds) .notifications(notifications) .build(); } @@ -89,7 +89,7 @@ public static Notification createInvestigationTestDataWithNotificationList(Notif .notificationSide(investigationSide) .description(description) .createdAt(createdAt) - .assetIds(assetIds) + .affectedPartIds(assetIds) .notifications(notifications) .build(); } @@ -147,7 +147,7 @@ public static Notification createInvestigationTestData(NotificationStatus invest .description(description) .createdAt(createdAt) .notificationType(NotificationType.INVESTIGATION) - .assetIds(assetIds) + .affectedPartIds(assetIds) .notifications(notifications) .build(); } @@ -184,7 +184,7 @@ public static Notification createInvestigationTestData(NotificationSide investig .notificationSide(investigationSide) .description(description) .createdAt(createdAt) - .assetIds(assetIds) + .affectedPartIds(assetIds) .notifications(notifications) .build(); } diff --git a/tx-cucumber-tests/src/test/java/org/eclipse/tractusx/traceability/test/tooling/rest/RestProvider.java b/tx-cucumber-tests/src/test/java/org/eclipse/tractusx/traceability/test/tooling/rest/RestProvider.java index 60174ed25a..86b6eece90 100644 --- a/tx-cucumber-tests/src/test/java/org/eclipse/tractusx/traceability/test/tooling/rest/RestProvider.java +++ b/tx-cucumber-tests/src/test/java/org/eclipse/tractusx/traceability/test/tooling/rest/RestProvider.java @@ -38,7 +38,7 @@ import org.eclipse.tractusx.traceability.test.tooling.TraceXEnvironmentEnum; import notification.request.NotificationSeverityRequest; import notification.request.StartNotificationRequest; -import notification.request.UpdateNotificationRequest; +import notification.request.UpdateNotificationStatusTransitionRequest; import notification.request.UpdateNotificationStatusRequest; import notification.response.NotificationIdResponse; import notification.response.NotificationResponse; @@ -99,8 +99,7 @@ public NotificationIdResponse createNotification( String receiverBpn, NotificationTypeEnum notificationType) { final StartNotificationRequest requestBody = StartNotificationRequest.builder() - .partIds(partIds) - .isAsBuilt(true) + .affectedPartIds(partIds) .description(description) .targetDate(targetDate) .severity(NotificationSeverityRequest.fromValue(severity)) @@ -185,7 +184,7 @@ public void closeNotification(final Long notificationId) { public void updateNotification(final Long notificationId, UpdateNotificationStatusRequest status, String reason) { - UpdateNotificationRequest requestBody = UpdateNotificationRequest.builder() + UpdateNotificationStatusTransitionRequest requestBody = UpdateNotificationStatusTransitionRequest.builder() .status(status) .reason(reason) .build(); diff --git a/tx-models/src/main/java/notification/request/EditNotificationRequest.java b/tx-models/src/main/java/notification/request/EditNotificationRequest.java new file mode 100644 index 0000000000..091b102b1a --- /dev/null +++ b/tx-models/src/main/java/notification/request/EditNotificationRequest.java @@ -0,0 +1,64 @@ +/******************************************************************************** + * Copyright (c) 2023 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 io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Future; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.RequiredArgsConstructor; + +import java.time.Instant; +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +@RequiredArgsConstructor +public class EditNotificationRequest { + + @Size(min = 1, max = 255, message = "Specify at least 1 and at most 255 characters for the title") + @Schema(example = "title", minLength = 1, maxLength = 255) + private String title; + + @Schema(example = "BPN00001123123AS") + private String receiverBpn; + + @NotNull + private NotificationSeverityRequest severity; + + @Schema(example = "2099-03-11T22:44:06.333826952Z") + @Future(message = "Specify at least the current day or a date in future") + private Instant targetDate; + + @Schema(example = "The description", minLength = 15, maxLength = 1000) + @Size(min = 15, max = 1000, message = "Description should have at least 15 characters and at most 1000 characters") + private String description; + + @Size(min = 1, max = 50, message = "Specify at least 1 and at most 50 assetIds") + @Schema(example = "[\"urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978\"]", minLength = 1, maxLength = 50) + private List affectedPartIds; +} + + + diff --git a/tx-models/src/main/java/notification/request/StartNotificationRequest.java b/tx-models/src/main/java/notification/request/StartNotificationRequest.java index 3aa31ebb11..1220ea1d51 100644 --- a/tx-models/src/main/java/notification/request/StartNotificationRequest.java +++ b/tx-models/src/main/java/notification/request/StartNotificationRequest.java @@ -45,7 +45,7 @@ public class StartNotificationRequest { @Size(min = 1, max = 50, message = "Specify at least 1 and at most 50 assetIds") @Schema(example = "[\"urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978\"]", minLength = 1, maxLength = 100) - private List partIds; + private List affectedPartIds; @Schema(example = "The description", minLength = 15, maxLength = 1000) @Size(min = 15, max = 1000, message = "Description should have at least 15 characters and at most 1000 characters") @@ -58,9 +58,6 @@ public class StartNotificationRequest { @NotNull private NotificationSeverityRequest severity; - @Schema(example = "true") - private boolean isAsBuilt = true; - @Schema(example = "BPN00001123123AS") private String receiverBpn; diff --git a/tx-models/src/main/java/notification/request/UpdateNotificationRequest.java b/tx-models/src/main/java/notification/request/UpdateNotificationStatusTransitionRequest.java similarity index 96% rename from tx-models/src/main/java/notification/request/UpdateNotificationRequest.java rename to tx-models/src/main/java/notification/request/UpdateNotificationStatusTransitionRequest.java index 432bc41aa2..c25c1d5227 100644 --- a/tx-models/src/main/java/notification/request/UpdateNotificationRequest.java +++ b/tx-models/src/main/java/notification/request/UpdateNotificationStatusTransitionRequest.java @@ -33,7 +33,7 @@ @Builder @AllArgsConstructor @RequiredArgsConstructor -public class UpdateNotificationRequest { +public class UpdateNotificationStatusTransitionRequest { @NotNull(message = "status must be present") private UpdateNotificationStatusRequest status; @Schema(example = "The reason.")