Skip to content

Commit

Permalink
feat: Change content array to object with properties for each content…
Browse files Browse the repository at this point in the history
… type (#905)

#891 

Changes content on the API layers to be an object with all content types
as properties.
Required props are non-nullable, the rest is nullable.

Validators are re-written to use reflection, all DialogContentTypes are
looked up on the incomming DTOs
Tests have been added to ensure that ContentDTOs prop. count matches
those of DialogContentTypes

There is some weird naming/mapping stuff when it comes to the search
mapping, but it works OK, see comments 🙈

Co-authored-by: Knut Haug <knut.espen.haug@digdir.no>
  • Loading branch information
oskogstad and knuhau authored Jul 24, 2024
1 parent ec1fcb1 commit d549f19
Show file tree
Hide file tree
Showing 45 changed files with 988 additions and 470 deletions.
7 changes: 7 additions & 0 deletions Digdir.Domain.Dialogporten.sln
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Digdir.Domain.Dialogporten.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Digdir.Domain.Dialogporten.GraphQl.Integration.Tests", "tests\Digdir.Domain.Dialogporten.GraphQl.Integration.Tests\Digdir.Domain.Dialogporten.GraphQl.Integration.Tests.csproj", "{1EF1AE42-17F1-4761-ACFE-DF8E8A9B9429}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Digdir.Domain.Dialogporten.GraphQl.Unit.Tests", "tests\Digdir.Domain.Dialogporten.GraphQl.Unit.Tests\Digdir.Domain.Dialogporten.GraphQl.Unit.Tests.csproj", "{AF35FFCA-1206-4C08-A003-DA4A1344CCD5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -135,6 +137,10 @@ Global
{1EF1AE42-17F1-4761-ACFE-DF8E8A9B9429}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1EF1AE42-17F1-4761-ACFE-DF8E8A9B9429}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1EF1AE42-17F1-4761-ACFE-DF8E8A9B9429}.Release|Any CPU.Build.0 = Release|Any CPU
{AF35FFCA-1206-4C08-A003-DA4A1344CCD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF35FFCA-1206-4C08-A003-DA4A1344CCD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF35FFCA-1206-4C08-A003-DA4A1344CCD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF35FFCA-1206-4C08-A003-DA4A1344CCD5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -161,6 +167,7 @@ Global
{42004236-D45C-4A1F-9FF9-CF12B7388389} = {CADB8189-4AA1-4732-844A-C41DBF3EC8B7}
{234FE24D-1047-4E29-A625-1EB406C37A2D} = {320B47A0-5EB8-4B6E-8C84-90633A1849CA}
{1EF1AE42-17F1-4761-ACFE-DF8E8A9B9429} = {CADB8189-4AA1-4732-844A-C41DBF3EC8B7}
{AF35FFCA-1206-4C08-A003-DA4A1344CCD5} = {CADB8189-4AA1-4732-844A-C41DBF3EC8B7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B2FE67FF-7622-4AFB-AD8E-961B6A39D888}
Expand Down
32 changes: 19 additions & 13 deletions docs/schema/V1/schema.verified.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,17 @@ type AuthorizedParty {
}

type Content {
type: ContentType!
title: ContentValue!
summary: ContentValue!
senderName: ContentValue
additionalInfo: ContentValue
extendedStatus: ContentValue
mainContentReference: ContentValue
}

type ContentValue {
value: [Localization!]!
mediaType: String
mediaType: String!
}

type Dialog {
Expand All @@ -93,7 +101,7 @@ type Dialog {
updatedAt: DateTime!
dialogToken: String
status: DialogStatus!
content: [Content!]!
content: Content!
attachments: [Attachment!]!
guiActions: [GuiAction!]!
apiActions: [ApiAction!]!
Expand Down Expand Up @@ -142,6 +150,13 @@ type Queries @authorize(policy: "enduser") {
parties: [AuthorizedParty!]!
}

type SearchContent {
title: ContentValue!
summary: ContentValue!
senderName: ContentValue
extendedStatus: ContentValue
}

type SearchDialog {
id: UUID!
org: String!
Expand All @@ -156,7 +171,7 @@ type SearchDialog {
dueAt: DateTime
status: DialogStatus!
latestActivity: Activity
content: [Content!]!
content: SearchContent!
seenSinceLastUpdate: [SeenLog!]!
}

Expand Down Expand Up @@ -245,15 +260,6 @@ enum AttachmentUrlConsumer {
API
}

enum ContentType {
TITLE
SENDER_NAME
SUMMARY
ADDITIONAL_INFO
EXTENDED_STATUS
MAIN_CONTENT_REFERENCE
}

enum DialogStatus {
"The dialogue is considered new. Typically used for simple messages that do not require any interaction, or as an initial step for dialogues. This is the default."
NEW
Expand Down
Loading

0 comments on commit d549f19

Please sign in to comment.