From a0697aee2c850156df25503b42bd667377cc6aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20J=C3=B8rgen=20Skogstad?= Date: Tue, 14 Jan 2025 13:24:53 +0100 Subject: [PATCH] fix(graphql): Add missing activity types (#1684) ## Description ## Related Issue(s) - #1683 ## Verification - [ ] **Your** code builds clean without any errors or warnings - [ ] Manual testing done (required) - [ ] Relevant automated test added (if you find this hard, leave it and we'll help out) ## Documentation - [ ] Documentation is updated (either in `docs`-directory, Altinnpedia or a separate linked PR in [altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if applicable) --- docs/schema/V1/schema.verified.graphql | 20 +++++++++++--- .../EndUser/Common/ObjectTypes.cs | 26 ++++++++++++++++--- .../ObjectTypes/ActivityTests.cs | 23 ++++++++++++++++ 3 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/ObjectTypes/ActivityTests.cs diff --git a/docs/schema/V1/schema.verified.graphql b/docs/schema/V1/schema.verified.graphql index d875b0ff8..cfc276346 100644 --- a/docs/schema/V1/schema.verified.graphql +++ b/docs/schema/V1/schema.verified.graphql @@ -304,20 +304,32 @@ input SetSystemLabelInput { } enum ActivityType { - "Refers to a dialog that has been created." + "Indicates that a dialog has been created." DIALOG_CREATED - "Refers to a dialog that has been closed." + "Indicates that a dialog has been closed." DIALOG_CLOSED "Information from the service provider, not (directly) related to any transmission." INFORMATION - "Refers to a transmission that has been opened." + "Indicates that a transmission has been opened." TRANSMISSION_OPENED "Indicates that payment has been made." PAYMENT_MADE "Indicates that a signature has been provided." SIGNATURE_PROVIDED - "Refers to a dialog that has been opened." + "Indicates that a dialog has been opened." DIALOG_OPENED + "Indicates that a dialog has been deleted." + DIALOG_DELETED + "Indicates that a dialog has been restored." + DIALOG_RESTORED + "Indicates that a dialog has been sent to signing." + SENT_TO_SIGNING + "Indicates that a dialog has been sent to form fill." + SENT_TO_FORM_FILL + "Indicates that a dialog has been sent to send in." + SENT_TO_SEND_IN + "Indicates that a dialog has been sent to payment." + SENT_TO_PAYMENT } enum ActorType { diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs index 16256d50e..56d415bfa 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs @@ -52,16 +52,16 @@ public enum ActorType public enum ActivityType { - [GraphQLDescription("Refers to a dialog that has been created.")] + [GraphQLDescription("Indicates that a dialog has been created.")] DialogCreated = 1, - [GraphQLDescription("Refers to a dialog that has been closed.")] + [GraphQLDescription("Indicates that a dialog has been closed.")] DialogClosed = 2, [GraphQLDescription("Information from the service provider, not (directly) related to any transmission.")] Information = 3, - [GraphQLDescription("Refers to a transmission that has been opened.")] + [GraphQLDescription("Indicates that a transmission has been opened.")] TransmissionOpened = 4, [GraphQLDescription("Indicates that payment has been made.")] @@ -70,8 +70,26 @@ public enum ActivityType [GraphQLDescription("Indicates that a signature has been provided.")] SignatureProvided = 6, - [GraphQLDescription("Refers to a dialog that has been opened.")] + [GraphQLDescription("Indicates that a dialog has been opened.")] DialogOpened = 7, + + [GraphQLDescription("Indicates that a dialog has been deleted.")] + DialogDeleted = 8, + + [GraphQLDescription("Indicates that a dialog has been restored.")] + DialogRestored = 9, + + [GraphQLDescription("Indicates that a dialog has been sent to signing.")] + SentToSigning = 10, + + [GraphQLDescription("Indicates that a dialog has been sent to form fill.")] + SentToFormFill = 11, + + [GraphQLDescription("Indicates that a dialog has been sent to send in.")] + SentToSendIn = 12, + + [GraphQLDescription("Indicates that a dialog has been sent to payment.")] + SentToPayment = 13, } public enum DialogStatus diff --git a/tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/ObjectTypes/ActivityTests.cs b/tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/ObjectTypes/ActivityTests.cs new file mode 100644 index 000000000..816692de9 --- /dev/null +++ b/tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/ObjectTypes/ActivityTests.cs @@ -0,0 +1,23 @@ +using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities; +using Digdir.Domain.Dialogporten.GraphQL.EndUser.Common; + +namespace Digdir.Domain.Dialogporten.GraphQl.Unit.Tests.ObjectTypes; + +public class ActivityTests +{ + [Fact] + public void Activity_Types_In_GraphQl_Must_Match_Domain_Types() + { + // Arrange + var domainTypes = Enum.GetValues(typeof(DialogActivityType.Values)).Cast().ToList(); + var graphQlTypes = Enum.GetValues(typeof(ActivityType)).Cast().ToList(); + + // Assert + Assert.Equal(domainTypes.Count, graphQlTypes.Count); + + for (var i = 0; i < domainTypes.Count; i++) + { + Assert.Equal(domainTypes[i].ToString(), graphQlTypes[i].ToString()); + } + } +}