diff --git a/src/Altinn.App.Api/Controllers/SigningController.cs b/src/Altinn.App.Api/Controllers/SigningController.cs index ac34a46df..559d403e0 100644 --- a/src/Altinn.App.Api/Controllers/SigningController.cs +++ b/src/Altinn.App.Api/Controllers/SigningController.cs @@ -2,6 +2,7 @@ using Altinn.App.Api.Models; using Altinn.App.Core.Features.Signing.Interfaces; using Altinn.App.Core.Features.Signing.Models; +using Altinn.App.Core.Helpers; using Altinn.App.Core.Internal.App; using Altinn.App.Core.Internal.Instances; using Altinn.App.Core.Internal.Process; @@ -47,7 +48,7 @@ IProcessReader processReader /// unique id of the party that this the owner of the instance /// unique id to identify the instance /// The currently used language by the user (or null if not available) - /// An object containing updated signing information + /// An object containing updated signee state [HttpGet] [ProducesResponseType(typeof(SingingStateResponse), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] @@ -108,10 +109,10 @@ public async Task GetSigneesState( /// /// /// - /// + /// An object containing the documents to be signed /// [HttpGet("data-elements")] - [ProducesResponseType(typeof(SingingStateResponse), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(SigningDataElementsResponse), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] public async Task GetDataElements( [FromRoute] string org, @@ -141,6 +142,11 @@ public async Task GetDataElements( .Data.Where(x => signingConfiguration.DataTypesToSign.Contains(x.DataType)) .ToList(); + foreach (DataElement dataElement in dataElements) + { + SelfLinkHelper.SetDataAppSelfLinks(instanceOwnerPartyId, instanceGuid, dataElement, Request); + } + SigningDataElementsResponse response = new() { DataElements = dataElements }; return Ok(response); diff --git a/test/Altinn.App.Api.Tests/OpenApi/swagger.json b/test/Altinn.App.Api.Tests/OpenApi/swagger.json index 04101492e..153f81547 100644 --- a/test/Altinn.App.Api.Tests/OpenApi/swagger.json +++ b/test/Altinn.App.Api.Tests/OpenApi/swagger.json @@ -4693,27 +4693,27 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/SingingStateResponse" + "$ref": "#/components/schemas/SigningDataElementsResponse" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/SingingStateResponse" + "$ref": "#/components/schemas/SigningDataElementsResponse" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/SingingStateResponse" + "$ref": "#/components/schemas/SigningDataElementsResponse" } }, "application/xml": { "schema": { - "$ref": "#/components/schemas/SingingStateResponse" + "$ref": "#/components/schemas/SigningDataElementsResponse" } }, "text/xml": { "schema": { - "$ref": "#/components/schemas/SingingStateResponse" + "$ref": "#/components/schemas/SigningDataElementsResponse" } } } @@ -7634,6 +7634,22 @@ }, "additionalProperties": false }, + "SigningDataElementsResponse": { + "required": [ + "dataElements" + ], + "type": "object", + "properties": { + "dataElements": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DataElement" + }, + "nullable": true + } + }, + "additionalProperties": false + }, "SimpleInstance": { "type": "object", "properties": { diff --git a/test/Altinn.App.Api.Tests/OpenApi/swagger.yaml b/test/Altinn.App.Api.Tests/OpenApi/swagger.yaml index 53489529d..e91162ec6 100644 --- a/test/Altinn.App.Api.Tests/OpenApi/swagger.yaml +++ b/test/Altinn.App.Api.Tests/OpenApi/swagger.yaml @@ -2859,19 +2859,19 @@ paths: content: text/plain: schema: - $ref: '#/components/schemas/SingingStateResponse' + $ref: '#/components/schemas/SigningDataElementsResponse' application/json: schema: - $ref: '#/components/schemas/SingingStateResponse' + $ref: '#/components/schemas/SigningDataElementsResponse' text/json: schema: - $ref: '#/components/schemas/SingingStateResponse' + $ref: '#/components/schemas/SigningDataElementsResponse' application/xml: schema: - $ref: '#/components/schemas/SingingStateResponse' + $ref: '#/components/schemas/SigningDataElementsResponse' text/xml: schema: - $ref: '#/components/schemas/SingingStateResponse' + $ref: '#/components/schemas/SigningDataElementsResponse' '400': description: Bad Request content: @@ -4886,6 +4886,17 @@ components: notificationSuccessful: type: boolean additionalProperties: false + SigningDataElementsResponse: + required: + - dataElements + type: object + properties: + dataElements: + type: array + items: + $ref: '#/components/schemas/DataElement' + nullable: true + additionalProperties: false SimpleInstance: type: object properties: