From 431c529ebecd8e21463545f85f91b9107f86b57c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20J=C3=B8rgen=20Skogstad?= Date: Thu, 30 Jan 2025 15:56:44 +0100 Subject: [PATCH] fix(graphql): Add SystemLabel search filter (#1767) ## Description ## Related Issue(s) - #1765 ## 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 | 4 +++- .../EndUser/Common/ObjectTypes.cs | 7 +++++++ .../EndUser/DialogById/ObjectTypes.cs | 1 - .../EndUser/MutationTypes/ObjectTypes.cs | 9 ++------- .../EndUser/SearchDialogs/MappingProfile.cs | 1 + .../EndUser/SearchDialogs/ObjectTypes.cs | 4 +++- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/schema/V1/schema.verified.graphql b/docs/schema/V1/schema.verified.graphql index cc79809eb..979493fa9 100644 --- a/docs/schema/V1/schema.verified.graphql +++ b/docs/schema/V1/schema.verified.graphql @@ -296,6 +296,8 @@ input SearchDialogInput { externalReference: String "Filter by status" status: [DialogStatus!] + "Filter by system label" + systemLabel: [SystemLabel!] "Only return dialogs created after this date" createdAfter: DateTime "Only return dialogs created before this date" @@ -456,4 +458,4 @@ scalar DateTime @specifiedBy(url: "https:\/\/www.graphql-scalars.com\/date-time" scalar URL @specifiedBy(url: "https:\/\/tools.ietf.org\/html\/rfc3986") -scalar UUID @specifiedBy(url: "https:\/\/tools.ietf.org\/html\/rfc4122") \ No newline at end of file +scalar UUID @specifiedBy(url: "https:\/\/tools.ietf.org\/html\/rfc4122") diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs index f12400c36..e8a201b9e 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs @@ -118,3 +118,10 @@ public enum DialogStatus [GraphQLDescription("The dialogue was completed. This typically means that the dialogue is moved to a GUI archive or similar.")] Completed = 6 } + +public enum SystemLabel +{ + Default = 1, + Bin = 2, + Archive = 3 +} diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs index f4a6d65b9..8aedc2859 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs @@ -1,5 +1,4 @@ using Digdir.Domain.Dialogporten.GraphQL.EndUser.Common; -using Digdir.Domain.Dialogporten.GraphQL.EndUser.MutationTypes; namespace Digdir.Domain.Dialogporten.GraphQL.EndUser.DialogById; diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/MutationTypes/ObjectTypes.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/MutationTypes/ObjectTypes.cs index c6b00b7be..34504cd5c 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/MutationTypes/ObjectTypes.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/MutationTypes/ObjectTypes.cs @@ -1,3 +1,5 @@ +using Digdir.Domain.Dialogporten.GraphQL.EndUser.Common; + namespace Digdir.Domain.Dialogporten.GraphQL.EndUser.MutationTypes; public sealed class SetSystemLabelPayload @@ -12,13 +14,6 @@ public sealed class SetSystemLabelInput public SystemLabel Label { get; set; } } -public enum SystemLabel -{ - Default = 1, - Bin = 2, - Archive = 3 -} - [InterfaceType("SetSystemLabelError")] public interface ISetSystemLabelError { diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/MappingProfile.cs index 16505d3ac..65c663e83 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/MappingProfile.cs @@ -11,6 +11,7 @@ public MappingProfile() CreateMap() .ForMember(dest => dest.OrderBy, opt => opt.Ignore()) .ForMember(dest => dest.ContinuationToken, opt => opt.Ignore()) + .ForMember(dest => dest.SystemLabel, opt => opt.MapFrom(src => src.SystemLabel)) .ForMember(dest => dest.Status, opt => opt.MapFrom(src => src.Status)); CreateMap, SearchDialogsPayload>() diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs index acd4ea3f5..98d165e30 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs @@ -1,6 +1,5 @@ using Digdir.Domain.Dialogporten.Application.Common.Pagination.Order; using Digdir.Domain.Dialogporten.GraphQL.EndUser.Common; -using Digdir.Domain.Dialogporten.GraphQL.EndUser.MutationTypes; namespace Digdir.Domain.Dialogporten.GraphQL.EndUser.SearchDialogs; @@ -105,6 +104,9 @@ public sealed class SearchDialogInput [GraphQLDescription("Filter by status")] public List? Status { get; init; } + [GraphQLDescription("Filter by system label")] + public List? SystemLabel { get; init; } + [GraphQLDescription("Only return dialogs created after this date")] public DateTimeOffset? CreatedAfter { get; init; }