diff --git a/persistence-service-v1/persistence-service-external-api-v2/src/main/java/com/iqser/red/service/persistence/service/v2/api/external/resource/ComponentResource.java b/persistence-service-v1/persistence-service-external-api-v2/src/main/java/com/iqser/red/service/persistence/service/v2/api/external/resource/ComponentResource.java index d17622d7a..e8eee558c 100644 --- a/persistence-service-v1/persistence-service-external-api-v2/src/main/java/com/iqser/red/service/persistence/service/v2/api/external/resource/ComponentResource.java +++ b/persistence-service-v1/persistence-service-external-api-v2/src/main/java/com/iqser/red/service/persistence/service/v2/api/external/resource/ComponentResource.java @@ -80,7 +80,7 @@ public interface ComponentResource { @ResponseStatus(value = HttpStatus.NO_CONTENT) @PostMapping(value = PATH + FILE_ID_PATH_VARIABLE + OVERRIDES_PATH, consumes = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "Adds overrides for components", description = "None") - @ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK"), @ApiResponse(responseCode = "404", description = "Not found"), @ApiResponse(responseCode = "403", description = "Forbidden")}) + @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Not found"), @ApiResponse(responseCode = "403", description = "Forbidden")}) void addOverride(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId, @Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier that contains the file.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId, @Parameter(name = FILE_ID_PARAM, description = "The identifier of the file that the components are requested for.", required = true) @PathVariable(FILE_ID_PARAM) String fileId, @@ -101,7 +101,7 @@ public interface ComponentResource { @ResponseStatus(value = HttpStatus.NO_CONTENT) @PostMapping(value = PATH + FILE_ID_PATH_VARIABLE + OVERRIDES_PATH + REVERT_PATH, consumes = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "Reverts overrides for components", description = "None") - @ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK"), @ApiResponse(responseCode = "404", description = "Not found"), @ApiResponse(responseCode = "403", description = "Forbidden")}) + @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Not found"), @ApiResponse(responseCode = "403", description = "Forbidden")}) void revertOverrides(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId, @Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier that contains the file.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId, @Parameter(name = FILE_ID_PARAM, description = "The identifier of the file that the components are requested for.", required = true) @PathVariable(FILE_ID_PARAM) String fileId, diff --git a/persistence-service-v1/persistence-service-external-api-v2/src/main/resources/api/openapi.yaml b/persistence-service-v1/persistence-service-external-api-v2/src/main/resources/api/openapi.yaml index 4ccd4fb90..2df045e3c 100644 --- a/persistence-service-v1/persistence-service-external-api-v2/src/main/resources/api/openapi.yaml +++ b/persistence-service-v1/persistence-service-external-api-v2/src/main/resources/api/openapi.yaml @@ -745,6 +745,97 @@ paths: $ref: '#/components/responses/403' "500": $ref: '#/components/responses/500' + /api/dossier-templates/{dossierTemplateId}/dossiers/{dossierId}/files/{fileId}/overrides: + post: + operationId: addOverride + tags: + - 4. Components + summary: Adds the component override associated with a specific file. + description: | + This endpoint allows the user to add an override for a specific component of a dossier file. The component override data is provided in the request body. + parameters: + - $ref: '#/components/parameters/dossierTemplateId' + - $ref: '#/components/parameters/dossierId' + - $ref: '#/components/parameters/fileId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Component' + required: true + responses: + "200": + description: | + Component was successfully overridden. + "400": + $ref: '#/components/responses/400' + "403": + $ref: '#/components/responses/403' + "404": + $ref: '#/components/responses/404-file' + "500": + $ref: '#/components/responses/500' + get: + operationId: getOverrides + tags: + - 4. Components + summary: Returns the component overrides associated with a specific file. + description: | + This endpoint retrieves all the overrides for a specific component within a dossier file. + The response includes a list of all component overrides associated with the specified file. + parameters: + - $ref: '#/components/parameters/dossierTemplateId' + - $ref: '#/components/parameters/dossierId' + - $ref: '#/components/parameters/fileId' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ComponentOverrideModelList' + application/xml: + schema: + $ref: '#/components/schemas/ComponentOverrideModelList' + description: | + Successfully fetched component overrides for the file in the dossier. + "404": + $ref: '#/components/responses/404-dossier' + "400": + $ref: '#/components/responses/400' + "403": + $ref: '#/components/responses/403' + "500": + $ref: '#/components/responses/500' + /api/dossier-templates/{dossierTemplateId}/dossiers/{dossierId}/files/{fileId}/overrides/revert: + post: + operationId: revertOverrides + tags: + - 4. Components + summary: Reverts the component overrides associated with a specific file. + description: | + Reverts the component overrides associated with a specific file. + parameters: + - $ref: '#/components/parameters/dossierTemplateId' + - $ref: '#/components/parameters/dossierId' + - $ref: '#/components/parameters/fileId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RevertOverrideRequest' + required: true + responses: + "200": + description: | + Component overrides were successfully reverted. + "400": + $ref: '#/components/responses/400' + "403": + $ref: '#/components/responses/403' + "404": + $ref: '#/components/responses/404-file' + "500": + $ref: '#/components/responses/500' /api/license/active/usage: post: operationId: getReport @@ -1203,6 +1294,94 @@ components: entityRuleId: DEF.13.37 type: another_entity_type page: 456 + ComponentOverrideModelList: + type: object + description: A list of component overrides and their associated components. + properties: + dossierTemplateId: + format: uuid + type: string + description: Identifier for the template associated with the dossier. + dossierId: + format: uuid + type: string + description: Identifier for the dossier. + fileId: + type: string + description: Identifier for the file. + componentOverrideModels: + type: array + description: List of files with their component details. + items: + $ref: '#/components/schemas/Component' + example: + dossierTemplateId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + dossierId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + fileId: 1fdbd888b39059c8cf171df26f62f8a5 + componentOverrideModels: + - name: the component name + componentValues: + - value: my overwritten component value + originalValue: the original value + componentRuleId: COM.0.0 + valueDescription: My value description + entityReferences: + - id: bcd22239-cedf-442f-a5a1-1664cba94dc6 + entityRuleId: ABC.0.0 + type: entity_type + page: 123 + - id: bcd22239-c3df-442f-a5a1-1664cba94dc6_2 + entityRuleId: ABC.0.0 + type: entity_type + page: 124 + - id: b748b89a-5679-4254-9286-1dd652d9970b + entityRuleId: DEF.13.37 + type: another_entity_type + page: 456 + - value: yet another component value + originalValue: yet another component value + componentRuleId: COM.0.1 + valueDescription: Another value description + entityReferences: + - id: 70496456-a016-4679-81b1-6c8856dded6e + entityRuleId: XYZ.0.0 + type: yet_another_entity_type + page: 123 + overridden: true + - name: other component name + componentValues: + - value: my overwritten component value + originalValue: the original value + componentRuleId: COM.0.0 + valueDescription: My value description + entityReferences: + - id: bcd22239-cedf-442f-a5a1-1664cba94dc6 + entityRuleId: ABC.0.0 + type: entity_type + page: 123 + - id: bcd22239-c3df-442f-a5a1-1664cba94dc6_2 + entityRuleId: ABC.0.0 + type: entity_type + page: 124 + - id: b748b89a-5679-4254-9286-1dd652d9970b + entityRuleId: DEF.13.37 + type: another_entity_type + page: 456 + overridden: true + RevertOverrideRequest: + type: object + description: Set of component names to revert. + properties: + components: + type: array + items: + type: string + uniqueItems: true + example: + components: + - component1 + - component2 + - component3 FileComponents: type: object description: Represents file details along with its associated components and values.