diff --git a/docs/schema/V1/swagger.verified.json b/docs/schema/V1/swagger.verified.json index 5f481c350..9b5573caa 100644 --- a/docs/schema/V1/swagger.verified.json +++ b/docs/schema/V1/swagger.verified.json @@ -344,6 +344,32 @@ }, "type": "object" }, + "V1EndUserCommonActors_Actor": { + "additionalProperties": false, + "properties": { + "actorId": { + "description": "The identifier of the person or organization that sent the transmission. Mutually exclusive with ActorName.\nMight be omitted if ActorType is \u0022ServiceOwner\u0022.", + "example": "urn:altinn:person:identifier-no:12018212345", + "nullable": true, + "type": "string" + }, + "actorName": { + "description": "Specifies the name of the entity that sent the transmission. Mutually exclusive with ActorId. If ActorId\nis supplied, the name will be automatically populated from the name registries.", + "example": "Ola Nordmann", + "nullable": true, + "type": "string" + }, + "actorType": { + "description": "The type of actor that sent the transmission.", + "oneOf": [ + { + "$ref": "#/components/schemas/Actors_ActorType" + } + ] + } + }, + "type": "object" + }, "V1EndUserDialogActivitiesQueriesGet_Activity": { "additionalProperties": false, "properties": { @@ -369,7 +395,7 @@ "type": "string" }, "performedBy": { - "$ref": "#/components/schemas/V1EndUserDialogActivitiesQueriesGet_PerformedByActor" + "$ref": "#/components/schemas/V1EndUserCommonActors_Actor" }, "transmissionId": { "format": "guid", @@ -382,27 +408,6 @@ }, "type": "object" }, - "V1EndUserDialogActivitiesQueriesGet_PerformedByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "nullable": true, - "type": "string" - }, - "actorName": { - "nullable": true, - "type": "string" - }, - "actorType": { - "$ref": "#/components/schemas/Actors_ActorType" - }, - "id": { - "format": "guid", - "type": "string" - } - }, - "type": "object" - }, "V1EndUserDialogActivitiesQueriesSearch_Activity": { "additionalProperties": false, "properties": { @@ -448,19 +453,7 @@ "type": "string" }, "performedBy": { - "$ref": "#/components/schemas/V1EndUserDialogLabelAssignmentLogQueriesSearch_LabelAssignmentLogActor" - } - }, - "type": "object" - }, - "V1EndUserDialogLabelAssignmentLogQueriesSearch_LabelAssignmentLogActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "type": "string" - }, - "actorName": { - "type": "string" + "$ref": "#/components/schemas/V1EndUserCommonActors_Actor" } }, "type": "object" @@ -483,23 +476,7 @@ "type": "string" }, "seenBy": { - "$ref": "#/components/schemas/V1EndUserDialogSeenLogsQueriesGet_SeenLogSeenByActor" - } - }, - "type": "object" - }, - "V1EndUserDialogSeenLogsQueriesGet_SeenLogSeenByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "type": "string" - }, - "actorName": { - "type": "string" - }, - "id": { - "format": "guid", - "type": "string" + "$ref": "#/components/schemas/V1EndUserCommonActors_Actor" } }, "type": "object" @@ -522,23 +499,7 @@ "type": "string" }, "seenBy": { - "$ref": "#/components/schemas/V1EndUserDialogSeenLogsQueriesSearch_SeenLogSeenByActor" - } - }, - "type": "object" - }, - "V1EndUserDialogSeenLogsQueriesSearch_SeenLogSeenByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "type": "string" - }, - "actorName": { - "type": "string" - }, - "id": { - "format": "guid", - "type": "string" + "$ref": "#/components/schemas/V1EndUserCommonActors_Actor" } }, "type": "object" @@ -799,7 +760,7 @@ "description": "The actor that performed the activity.", "oneOf": [ { - "$ref": "#/components/schemas/V1EndUserDialogsQueriesGet_DialogActivityPerformedByActor" + "$ref": "#/components/schemas/V1EndUserCommonActors_Actor" } ] }, @@ -820,30 +781,6 @@ }, "type": "object" }, - "V1EndUserDialogsQueriesGet_DialogActivityPerformedByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person or organization that performed the activity.\nMay be omitted if ActorType is \u0022ServiceOwner\u0022.", - "nullable": true, - "type": "string" - }, - "actorName": { - "description": "The name of the person or organization that performed the activity.\nOnly set if the actor type is \u0022PartyRepresentative\u0022.", - "nullable": true, - "type": "string" - }, - "actorType": { - "description": "The type of actor that performed the activity.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - } - }, - "type": "object" - }, "V1EndUserDialogsQueriesGet_DialogApiAction": { "additionalProperties": false, "properties": { @@ -1087,28 +1024,13 @@ "description": "The actor that saw the dialog revision.", "oneOf": [ { - "$ref": "#/components/schemas/V1EndUserDialogsQueriesGet_DialogSeenLogSeenByActor" + "$ref": "#/components/schemas/V1EndUserCommonActors_Actor" } ] } }, "type": "object" }, - "V1EndUserDialogsQueriesGet_DialogSeenLogSeenByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person/business that saw the dialog revision.", - "example": "urn:altinn:person:identifier-no:01125512345\nurn:altinn:organization:identifier-no:912345678", - "type": "string" - }, - "actorName": { - "description": "The natural name of the person/business that saw the dialog revision.", - "type": "string" - } - }, - "type": "object" - }, "V1EndUserDialogsQueriesGet_DialogTransmission": { "additionalProperties": false, "properties": { @@ -1164,7 +1086,7 @@ "description": "The actor that sent the transmission.", "oneOf": [ { - "$ref": "#/components/schemas/V1EndUserDialogsQueriesGet_DialogTransmissionSenderActor" + "$ref": "#/components/schemas/V1EndUserCommonActors_Actor" } ] }, @@ -1263,30 +1185,6 @@ }, "type": "object" }, - "V1EndUserDialogsQueriesGet_DialogTransmissionSenderActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person or organization that sent the transmission.", - "example": "urn:altinn:person:identifier-no:12018212345", - "type": "string" - }, - "actorName": { - "description": "The name of the person or organization that sent the transmission.", - "example": "Ola Nordmann", - "type": "string" - }, - "actorType": { - "description": "The type of actor that sent the transmission.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - } - }, - "type": "object" - }, "V1EndUserDialogsQueriesSearch_Content": { "additionalProperties": false, "properties": { @@ -1482,7 +1380,7 @@ "description": "The actor that performed the activity.", "oneOf": [ { - "$ref": "#/components/schemas/V1EndUserDialogsQueriesSearch_DialogActivityPerformedByActor" + "$ref": "#/components/schemas/V1EndUserCommonActors_Actor" } ] }, @@ -1503,30 +1401,6 @@ }, "type": "object" }, - "V1EndUserDialogsQueriesSearch_DialogActivityPerformedByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person or organization that performed the activity.\nMay be omitted if ActorType is \u0022ServiceOwner\u0022.", - "nullable": true, - "type": "string" - }, - "actorName": { - "description": "The name of the person or organization that performed the activity.\nOnly set if the actor type is \u0022PartyRepresentative\u0022.", - "nullable": true, - "type": "string" - }, - "actorType": { - "description": "What type of actor performed the activity.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - } - }, - "type": "object" - }, "V1EndUserDialogsQueriesSearch_DialogSeenLog": { "additionalProperties": false, "properties": { @@ -1553,28 +1427,13 @@ "description": "The actor that saw the dialog revision.", "oneOf": [ { - "$ref": "#/components/schemas/V1EndUserDialogsQueriesSearch_DialogSeenLogSeenByActor" + "$ref": "#/components/schemas/V1EndUserCommonActors_Actor" } ] } }, "type": "object" }, - "V1EndUserDialogsQueriesSearch_DialogSeenLogSeenByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person/business that saw the dialog revision.", - "example": "urn:altinn:person:identifier-no:01125512345\nurn:altinn:organization:identifier-no:912345678", - "type": "string" - }, - "actorName": { - "description": "The natural name of the person/business that saw the dialog revision.", - "type": "string" - } - }, - "type": "object" - }, "V1EndUserDialogSystemLabelsCommandsSet_SystemLabelCommand": { "additionalProperties": false, "properties": { @@ -1678,33 +1537,6 @@ }, "type": "object" }, - "V1EndUserDialogTransmissionsQueriesGet_SenderActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the actor.", - "type": "string" - }, - "actorName": { - "description": "The name of the actor.", - "type": "string" - }, - "actorType": { - "description": "The type of the actor.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - }, - "id": { - "description": "The unique identifier for the sender actor in UUIDv7 format.", - "format": "guid", - "type": "string" - } - }, - "type": "object" - }, "V1EndUserDialogTransmissionsQueriesGet_Transmission": { "additionalProperties": false, "properties": { @@ -1765,7 +1597,7 @@ "description": "The sender actor information for the transmission.", "oneOf": [ { - "$ref": "#/components/schemas/V1EndUserDialogTransmissionsQueriesGet_SenderActor" + "$ref": "#/components/schemas/V1EndUserCommonActors_Actor" } ] }, @@ -1869,33 +1701,6 @@ }, "type": "object" }, - "V1EndUserDialogTransmissionsQueriesSearch_SenderActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the actor.", - "type": "string" - }, - "actorName": { - "description": "The name of the actor.", - "type": "string" - }, - "actorType": { - "description": "The type of the actor.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - }, - "id": { - "description": "The unique identifier for the sender actor in UUIDv7 format.", - "format": "guid", - "type": "string" - } - }, - "type": "object" - }, "V1EndUserDialogTransmissionsQueriesSearch_Transmission": { "additionalProperties": false, "properties": { @@ -1956,7 +1761,7 @@ "description": "The sender actor information for the transmission.", "oneOf": [ { - "$ref": "#/components/schemas/V1EndUserDialogTransmissionsQueriesSearch_SenderActor" + "$ref": "#/components/schemas/V1EndUserCommonActors_Actor" } ] }, @@ -2024,6 +1829,32 @@ }, "type": "object" }, + "V1ServiceOwnerCommonActors_Actor": { + "additionalProperties": false, + "properties": { + "actorId": { + "description": "The identifier of the person or organization that sent the transmission. Mutually exclusive with ActorName.\nMight be omitted if ActorType is \u0022ServiceOwner\u0022.", + "example": "urn:altinn:person:identifier-no:12018212345", + "nullable": true, + "type": "string" + }, + "actorName": { + "description": "Specifies the name of the entity that sent the transmission. Mutually exclusive with ActorId. If ActorId\nis supplied, the name will be automatically populated from the name registries.", + "example": "Ola Nordmann", + "nullable": true, + "type": "string" + }, + "actorType": { + "description": "The type of actor that sent the transmission.", + "oneOf": [ + { + "$ref": "#/components/schemas/Actors_ActorType" + } + ] + } + }, + "type": "object" + }, "V1ServiceOwnerDialogActivitiesCreate_ActivityRequest": { "additionalProperties": false, "properties": { @@ -2058,7 +1889,7 @@ "description": "The actor that performed the activity.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogsCommandsUpdate_ActivityPerformedByActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] }, @@ -2109,7 +1940,7 @@ "type": "string" }, "performedBy": { - "$ref": "#/components/schemas/V1ServiceOwnerDialogActivitiesQueriesGet_ActivityPerformedByActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" }, "transmissionId": { "format": "guid", @@ -2122,27 +1953,6 @@ }, "type": "object" }, - "V1ServiceOwnerDialogActivitiesQueriesGet_ActivityPerformedByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "nullable": true, - "type": "string" - }, - "actorName": { - "nullable": true, - "type": "string" - }, - "actorType": { - "$ref": "#/components/schemas/Actors_ActorType" - }, - "id": { - "format": "guid", - "type": "string" - } - }, - "type": "object" - }, "V1ServiceOwnerDialogActivitiesQueriesNotificationCondition_NotificationCondition": { "additionalProperties": false, "properties": { @@ -2230,7 +2040,7 @@ "description": "The actor that performed the activity.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogsCommandsCreate_ActivityPerformedByActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] }, @@ -2251,32 +2061,6 @@ }, "type": "object" }, - "V1ServiceOwnerDialogsCommandsCreate_ActivityPerformedByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person or organization that performed the activity. Mutually exclusive with ActorName.\nMight be omitted if ActorType is \u0022ServiceOwner\u0022.", - "example": "urn:altinn:person:identifier-no:12018212345", - "nullable": true, - "type": "string" - }, - "actorName": { - "description": "Specifies the name of the entity that performed the activity. Mutually exclusive with ActorId. If ActorId\nis supplied, the name will be automatically populated from the name registries.", - "example": "Ola Nordmann", - "nullable": true, - "type": "string" - }, - "actorType": { - "description": "What type of actor performed the activity.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - } - }, - "type": "object" - }, "V1ServiceOwnerDialogsCommandsCreate_ApiAction": { "additionalProperties": false, "properties": { @@ -2736,7 +2520,7 @@ "description": "The actor that sent the transmission.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogsCommandsCreate_TransmissionSenderActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] }, @@ -2836,32 +2620,6 @@ }, "type": "object" }, - "V1ServiceOwnerDialogsCommandsCreate_TransmissionSenderActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person or organization that sent the transmission. Mutually exclusive with ActorName.\nMight be omitted if ActorType is \u0022ServiceOwner\u0022.", - "example": "urn:altinn:person:identifier-no:12018212345", - "nullable": true, - "type": "string" - }, - "actorName": { - "description": "Specifies the name of the entity that sent the transmission. Mutually exclusive with ActorId. If ActorId\nis supplied, the name will be automatically populated from the name registries.", - "example": "Ola Nordmann", - "nullable": true, - "type": "string" - }, - "actorType": { - "description": "The type of actor that sent the transmission.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - } - }, - "type": "object" - }, "V1ServiceOwnerDialogsCommandsUpdate_Activity": { "additionalProperties": false, "properties": { @@ -2896,7 +2654,7 @@ "description": "The actor that performed the activity.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogsCommandsUpdate_ActivityPerformedByActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] }, @@ -2917,32 +2675,6 @@ }, "type": "object" }, - "V1ServiceOwnerDialogsCommandsUpdate_ActivityPerformedByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person or organization that performed the activity. Mutually exclusive with ActorName.\nMight be omitted if ActorType is \u0022ServiceOwner\u0022.", - "example": "urn:altinn:person:identifier-no:12018212345", - "nullable": true, - "type": "string" - }, - "actorName": { - "description": "Specifies the name of the entity that performed the activity. Mutually exclusive with ActorId. If ActorId\nis supplied, the name will be automatically populated from the name registries.", - "example": "Ola Nordmann", - "nullable": true, - "type": "string" - }, - "actorType": { - "description": "What type of actor performed the activity.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - } - }, - "type": "object" - }, "V1ServiceOwnerDialogsCommandsUpdate_ApiAction": { "additionalProperties": false, "properties": { @@ -3389,7 +3121,7 @@ "description": "The actor that sent the transmission.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogsCommandsUpdate_TransmissionSenderActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] }, @@ -3489,32 +3221,6 @@ }, "type": "object" }, - "V1ServiceOwnerDialogsCommandsUpdate_TransmissionSenderActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person or organization that sent the transmission. Mutually exclusive with ActorName.\nMight be omitted if ActorType is \u0022ServiceOwner\u0022.", - "example": "urn:altinn:person:identifier-no:12018212345", - "nullable": true, - "type": "string" - }, - "actorName": { - "description": "Specifies the name of the entity that sent the transmission. Mutually exclusive with ActorId. If ActorId\nis supplied, the name will be automatically populated from the name registries.", - "example": "Ola Nordmann", - "nullable": true, - "type": "string" - }, - "actorType": { - "description": "The type of actor that sent the transmission.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - } - }, - "type": "object" - }, "V1ServiceOwnerDialogSeenLogsQueriesGet_SeenLog": { "additionalProperties": false, "properties": { @@ -3531,39 +3237,7 @@ "type": "string" }, "seenBy": { - "$ref": "#/components/schemas/V1ServiceOwnerDialogSeenLogsQueriesGet_SeenLogSeenByActor" - } - }, - "type": "object" - }, - "V1ServiceOwnerDialogSeenLogsQueriesGet_SeenLogSeenByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "type": "string" - }, - "actorName": { - "type": "string" - }, - "id": { - "format": "guid", - "type": "string" - } - }, - "type": "object" - }, - "V1ServiceOwnerDialogSeenLogsQueriesSearch_SeenByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "type": "string" - }, - "actorName": { - "type": "string" - }, - "id": { - "format": "guid", - "type": "string" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } }, "type": "object" @@ -3584,7 +3258,7 @@ "type": "string" }, "seenBy": { - "$ref": "#/components/schemas/V1ServiceOwnerDialogSeenLogsQueriesSearch_SeenByActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } }, "type": "object" @@ -3861,7 +3535,7 @@ "description": "The actor that performed the activity.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogsQueriesGet_DialogActivityPerformedByActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] }, @@ -3882,30 +3556,6 @@ }, "type": "object" }, - "V1ServiceOwnerDialogsQueriesGet_DialogActivityPerformedByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person or organization that performed the activity.\nMay be omitted if ActorType is \u0022ServiceOwner\u0022.", - "nullable": true, - "type": "string" - }, - "actorName": { - "description": "The name of the person or organization that performed the activity.\nOnly set if the actor type is \u0022PartyRepresentative\u0022.", - "nullable": true, - "type": "string" - }, - "actorType": { - "description": "What type of actor performed the activity.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - } - }, - "type": "object" - }, "V1ServiceOwnerDialogsQueriesGet_DialogApiAction": { "additionalProperties": false, "properties": { @@ -4149,28 +3799,13 @@ "description": "The actor that saw the dialog revision.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogsQueriesGet_DialogSeenLogSeenByActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] } }, "type": "object" }, - "V1ServiceOwnerDialogsQueriesGet_DialogSeenLogSeenByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person/business that saw the dialog revision.", - "example": "urn:altinn:person:identifier-no:01125512345\nurn:altinn:organization:identifier-no:912345678", - "type": "string" - }, - "actorName": { - "description": "The natural name of the person/business that saw the dialog revision.", - "type": "string" - } - }, - "type": "object" - }, "V1ServiceOwnerDialogsQueriesGet_DialogTransmission": { "additionalProperties": false, "properties": { @@ -4227,7 +3862,7 @@ "description": "The actor that sent the transmission.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogsQueriesGet_DialogTransmissionSenderActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] }, @@ -4326,30 +3961,6 @@ }, "type": "object" }, - "V1ServiceOwnerDialogsQueriesGet_DialogTransmissionSenderActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person or organization that sent the transmission.", - "example": "urn:altinn:person:identifier-no:12018212345", - "type": "string" - }, - "actorName": { - "description": "The name of the person or organization that sent the transmission.", - "example": "Ola Nordmann", - "type": "string" - }, - "actorType": { - "description": "The type of actor that sent the transmission.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - } - }, - "type": "object" - }, "V1ServiceOwnerDialogsQueriesGet_SearchTag": { "additionalProperties": false, "properties": { @@ -4567,7 +4178,7 @@ "description": "The actor that performed the activity.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogsQueriesSearch_DialogActivityPerformedByActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] }, @@ -4588,30 +4199,6 @@ }, "type": "object" }, - "V1ServiceOwnerDialogsQueriesSearch_DialogActivityPerformedByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person or organization that performed the activity.\nMay be omitted if ActorType is \u0022ServiceOwner\u0022.", - "nullable": true, - "type": "string" - }, - "actorName": { - "description": "The name of the person or organization that performed the activity.\nOnly set if the actor type is \u0022PartyRepresentative\u0022.", - "nullable": true, - "type": "string" - }, - "actorType": { - "description": "What type of actor performed the activity.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - } - }, - "type": "object" - }, "V1ServiceOwnerDialogsQueriesSearch_DialogSeenLog": { "additionalProperties": false, "properties": { @@ -4638,28 +4225,13 @@ "description": "The actor that saw the dialog revision.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogsQueriesSearch_DialogSeenLogSeenByActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] } }, "type": "object" }, - "V1ServiceOwnerDialogsQueriesSearch_DialogSeenLogSeenByActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the person/business that saw the dialog revision.", - "example": "urn:altinn:person:identifier-no:01125512345\nurn:altinn:organization:identifier-no:912345678", - "type": "string" - }, - "actorName": { - "description": "The natural name of the person/business that saw the dialog revision.", - "type": "string" - } - }, - "type": "object" - }, "V1ServiceOwnerDialogsUpdate_DialogRequest": { "additionalProperties": false, "properties": { @@ -4722,7 +4294,7 @@ "description": "The actor that sent the transmission.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogsCommandsUpdate_TransmissionSenderActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] }, @@ -4826,33 +4398,6 @@ }, "type": "object" }, - "V1ServiceOwnerDialogTransmissionsQueriesGet_SenderActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the actor.", - "type": "string" - }, - "actorName": { - "description": "The name of the actor.", - "type": "string" - }, - "actorType": { - "description": "The type of the actor.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - }, - "id": { - "description": "The unique identifier for the sender actor in UUIDv7 format.", - "format": "guid", - "type": "string" - } - }, - "type": "object" - }, "V1ServiceOwnerDialogTransmissionsQueriesGet_Transmission": { "additionalProperties": false, "properties": { @@ -4909,7 +4454,7 @@ "description": "The sender actor information for the transmission.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogTransmissionsQueriesGet_SenderActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] }, @@ -5013,33 +4558,6 @@ }, "type": "object" }, - "V1ServiceOwnerDialogTransmissionsQueriesSearch_SenderActor": { - "additionalProperties": false, - "properties": { - "actorId": { - "description": "The identifier of the actor.", - "type": "string" - }, - "actorName": { - "description": "The name of the actor.", - "type": "string" - }, - "actorType": { - "description": "The type of the actor.", - "oneOf": [ - { - "$ref": "#/components/schemas/Actors_ActorType" - } - ] - }, - "id": { - "description": "The unique identifier for the sender actor in UUIDv7 format.", - "format": "guid", - "type": "string" - } - }, - "type": "object" - }, "V1ServiceOwnerDialogTransmissionsQueriesSearch_Transmission": { "additionalProperties": false, "properties": { @@ -5096,7 +4614,7 @@ "description": "The sender actor information for the transmission.", "oneOf": [ { - "$ref": "#/components/schemas/V1ServiceOwnerDialogTransmissionsQueriesSearch_SenderActor" + "$ref": "#/components/schemas/V1ServiceOwnerCommonActors_Actor" } ] }, diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Common/Actors/ActorDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Common/Actors/ActorDto.cs new file mode 100644 index 000000000..e32459496 --- /dev/null +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Common/Actors/ActorDto.cs @@ -0,0 +1,26 @@ +using Digdir.Domain.Dialogporten.Domain.Actors; + +namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Common.Actors; + +public sealed class ActorDto +{ + /// + /// The type of actor that sent the transmission. + /// + public ActorType.Values ActorType { get; set; } + + /// + /// Specifies the name of the entity that sent the transmission. Mutually exclusive with ActorId. If ActorId + /// is supplied, the name will be automatically populated from the name registries. + /// + /// Ola Nordmann + public string? ActorName { get; set; } + + /// + /// The identifier of the person or organization that sent the transmission. Mutually exclusive with ActorName. + /// Might be omitted if ActorType is "ServiceOwner". + /// + /// urn:altinn:person:identifier-no:12018212345 + public string? ActorId { get; set; } + +} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Common/Actors/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Common/Actors/MappingProfile.cs new file mode 100644 index 000000000..789d0026f --- /dev/null +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Common/Actors/MappingProfile.cs @@ -0,0 +1,32 @@ +using AutoMapper; +using Digdir.Domain.Dialogporten.Application.Common; +using Digdir.Domain.Dialogporten.Domain; +using Digdir.Domain.Dialogporten.Domain.Actors; + +namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Common.Actors; + +internal sealed class MappingProfile : Profile +{ + public MappingProfile() + { + + var actorDtoType = typeof(ActorDto); + var actorType = typeof(Actor); + + var derivedActorTypes = DomainAssemblyMarker + .Assembly + .GetTypes() + .Where(x => x.IsClass && !x.IsAbstract && x.IsSubclassOf(actorType)) + .ToList(); + + CreateMap() + .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)) + .ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => IdentifierMasker.GetMaybeMaskedIdentifier(src.ActorId))); + + foreach (var outputActor in derivedActorTypes) + { + CreateMap(outputActor, actorDtoType) + .IncludeBase(actorType, actorDtoType); + } + } +} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogActivities/Queries/Get/ActivityDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogActivities/Queries/Get/ActivityDto.cs index 75aefae05..9450a2311 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogActivities/Queries/Get/ActivityDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogActivities/Queries/Get/ActivityDto.cs @@ -1,5 +1,5 @@ using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities; namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogActivities.Queries.Get; @@ -14,14 +14,6 @@ public sealed class ActivityDto public Guid? TransmissionId { get; set; } - public PerformedByActorDto PerformedBy { get; set; } = null!; + public ActorDto PerformedBy { get; set; } = null!; public List Description { get; set; } = []; } - -public sealed class PerformedByActorDto -{ - public Guid Id { get; set; } - public ActorType.Values ActorType { get; set; } - public string? ActorName { get; set; } - public string? ActorId { get; set; } -} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogActivities/Queries/Get/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogActivities/Queries/Get/MappingProfile.cs index dad292bc6..acc0c1250 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogActivities/Queries/Get/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogActivities/Queries/Get/MappingProfile.cs @@ -1,5 +1,4 @@ using AutoMapper; -using Digdir.Domain.Dialogporten.Application.Common; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities; namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogActivities.Queries.Get; @@ -11,8 +10,5 @@ public MappingProfile() CreateMap() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId)); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)) - .ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => IdentifierMasker.GetMaybeMaskedIdentifier(src.ActorId))); } } diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogLabelAssignmentLog/Queries/Search/LabelAssignmentLogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogLabelAssignmentLog/Queries/Search/LabelAssignmentLogDto.cs index 8e20618ae..aa6bce8b8 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogLabelAssignmentLog/Queries/Search/LabelAssignmentLogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogLabelAssignmentLog/Queries/Search/LabelAssignmentLogDto.cs @@ -1,3 +1,5 @@ +using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Common.Actors; + namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogLabelAssignmentLog.Queries.Search; public sealed class LabelAssignmentLogDto @@ -8,14 +10,6 @@ public sealed class LabelAssignmentLogDto public string Action { get; set; } = null!; - public LabelAssignmentLogActorDto PerformedBy { get; set; } = null!; - -} - -public sealed class LabelAssignmentLogActorDto -{ - - public string ActorName { get; set; } = null!; + public ActorDto PerformedBy { get; set; } = null!; - public string ActorId { get; set; } = null!; } diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogLabelAssignmentLog/Queries/Search/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogLabelAssignmentLog/Queries/Search/MappingProfile.cs index 9d801ae4e..75104715d 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogLabelAssignmentLog/Queries/Search/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogLabelAssignmentLog/Queries/Search/MappingProfile.cs @@ -8,6 +8,5 @@ public sealed class MappingProfile : Profile public MappingProfile() { CreateMap(); - CreateMap(); } } diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Get/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Get/MappingProfile.cs index c3cb377a3..df8360782 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Get/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Get/MappingProfile.cs @@ -1,5 +1,4 @@ using AutoMapper; -using Digdir.Domain.Dialogporten.Application.Common; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities; namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogSeenLogs.Queries.Get; @@ -11,8 +10,5 @@ public MappingProfile() CreateMap() .ForMember(dest => dest.SeenAt, opt => opt.MapFrom(src => src.CreatedAt)); - CreateMap() - .ForMember(dest => dest.ActorId, - opt => opt.MapFrom(src => IdentifierMasker.GetMaybeMaskedIdentifier(src.ActorId))); } } diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Get/SeenLogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Get/SeenLogDto.cs index eab7c1eda..6d210ae99 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Get/SeenLogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Get/SeenLogDto.cs @@ -1,18 +1,14 @@ +using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Common.Actors; + namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogSeenLogs.Queries.Get; public sealed class SeenLogDto { public Guid Id { get; set; } public DateTimeOffset SeenAt { get; set; } - public SeenLogSeenByActorDto SeenBy { get; set; } = null!; + public ActorDto SeenBy { get; set; } = null!; public bool IsViaServiceOwner { get; set; } public bool IsCurrentEndUser { get; set; } } -public sealed class SeenLogSeenByActorDto -{ - public Guid Id { get; set; } - public string ActorName { get; set; } = null!; - public string ActorId { get; set; } = null!; -} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Search/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Search/MappingProfile.cs index be1f80c87..e1b6b59f6 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Search/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Search/MappingProfile.cs @@ -1,5 +1,4 @@ using AutoMapper; -using Digdir.Domain.Dialogporten.Application.Common; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities; namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogSeenLogs.Queries.Search; @@ -11,7 +10,5 @@ public MappingProfile() CreateMap() .ForMember(dest => dest.SeenAt, opt => opt.MapFrom(src => src.CreatedAt)); - CreateMap() - .ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => IdentifierMasker.GetMaybeMaskedIdentifier(src.ActorId))); } } diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Search/SeenLogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Search/SeenLogDto.cs index 0bf9b14c0..b766d2e6c 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Search/SeenLogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogSeenLogs/Queries/Search/SeenLogDto.cs @@ -1,3 +1,5 @@ +using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Common.Actors; + namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogSeenLogs.Queries.Search; public sealed class SeenLogDto @@ -5,15 +7,8 @@ public sealed class SeenLogDto public Guid Id { get; set; } public DateTimeOffset SeenAt { get; set; } - public SeenLogSeenByActorDto SeenBy { get; set; } = null!; + public ActorDto SeenBy { get; set; } = null!; public bool IsViaServiceOwner { get; set; } public bool IsCurrentEndUser { get; set; } } - -public sealed class SeenLogSeenByActorDto -{ - public Guid Id { get; set; } - public string ActorName { get; set; } = null!; - public string ActorId { get; set; } = null!; -} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Get/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Get/MappingProfile.cs index 315cc06f2..94059a6ff 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Get/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Get/MappingProfile.cs @@ -14,8 +14,6 @@ public MappingProfile() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId)) .ForMember(dest => dest.DeletedAt, opt => opt.MapFrom(src => src.Dialog.DeletedAt)); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)); CreateMap?, ContentDto?>() .ConvertUsing>(); diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Get/TransmissionDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Get/TransmissionDto.cs index b065b0c66..8a482b8b2 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Get/TransmissionDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Get/TransmissionDto.cs @@ -1,6 +1,6 @@ using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions; @@ -52,7 +52,7 @@ public sealed class TransmissionDto /// /// The sender actor information for the transmission. /// - public SenderActorDto Sender { get; set; } = null!; + public ActorDto Sender { get; set; } = null!; /// /// The content of the transmission. @@ -65,29 +65,6 @@ public sealed class TransmissionDto public List Attachments { get; set; } = []; } -public sealed class SenderActorDto -{ - /// - /// The unique identifier for the sender actor in UUIDv7 format. - /// - public Guid Id { get; set; } - - /// - /// The type of the actor. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// The name of the actor. - /// - public string ActorName { get; set; } = null!; - - /// - /// The identifier of the actor. - /// - public string ActorId { get; set; } = null!; -} - public sealed class ContentDto { /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Search/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Search/MappingProfile.cs index 32b686063..8feaae07c 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Search/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Search/MappingProfile.cs @@ -14,8 +14,6 @@ public MappingProfile() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId)) .ForMember(dest => dest.DeletedAt, opt => opt.MapFrom(src => src.Dialog.DeletedAt)); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)); CreateMap?, ContentDto?>() .ConvertUsing>(); diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Search/TransmissionDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Search/TransmissionDto.cs index e35a0b21e..49b6132bb 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Search/TransmissionDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogTransmissions/Queries/Search/TransmissionDto.cs @@ -1,6 +1,6 @@ using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions; @@ -52,7 +52,7 @@ public sealed class TransmissionDto /// /// The sender actor information for the transmission. /// - public SenderActorDto Sender { get; set; } = null!; + public ActorDto Sender { get; set; } = null!; /// /// The content of the transmission. @@ -65,29 +65,6 @@ public sealed class TransmissionDto public List Attachments { get; set; } = []; } -public sealed class SenderActorDto -{ - /// - /// The unique identifier for the sender actor in UUIDv7 format. - /// - public Guid Id { get; set; } - - /// - /// The type of the actor. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// The name of the actor. - /// - public string ActorName { get; set; } = null!; - - /// - /// The identifier of the actor. - /// - public string ActorId { get; set; } = null!; -} - public sealed class ContentDto { /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/DialogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/DialogDto.cs index d20183a80..2389ae6ff 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/DialogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/DialogDto.cs @@ -1,6 +1,6 @@ using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.DialogEndUserContexts.Entities; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities; @@ -217,7 +217,7 @@ public sealed class DialogTransmissionDto /// /// The actor that sent the transmission. /// - public DialogTransmissionSenderActorDto Sender { get; set; } = null!; + public ActorDto Sender { get; set; } = null!; /// /// The transmission unstructured text content. @@ -245,7 +245,7 @@ public sealed class DialogSeenLogDto /// /// The actor that saw the dialog revision. /// - public DialogSeenLogSeenByActorDto SeenBy { get; set; } = null!; + public ActorDto SeenBy { get; set; } = null!; /// /// Flag indicating whether the seen log entry was created via the service owner. @@ -260,42 +260,6 @@ public sealed class DialogSeenLogDto public bool IsCurrentEndUser { get; set; } } -public sealed class DialogSeenLogSeenByActorDto -{ - /// - /// The natural name of the person/business that saw the dialog revision. - /// - public string ActorName { get; set; } = null!; - - /// - /// The identifier of the person/business that saw the dialog revision. - /// - /// - /// urn:altinn:person:identifier-no:01125512345 - /// urn:altinn:organization:identifier-no:912345678 - /// - public string ActorId { get; set; } = null!; -} - -public sealed class DialogTransmissionSenderActorDto -{ - /// - /// The type of actor that sent the transmission. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// The name of the person or organization that sent the transmission. - /// - /// Ola Nordmann - public string ActorName { get; set; } = null!; - - /// - /// The identifier of the person or organization that sent the transmission. - /// - /// urn:altinn:person:identifier-no:12018212345 - public string ActorId { get; set; } = null!; -} public sealed class ContentDto { @@ -381,7 +345,7 @@ public sealed class DialogActivityDto /// /// The actor that performed the activity. /// - public DialogActivityPerformedByActorDto PerformedBy { get; set; } = null!; + public ActorDto PerformedBy { get; set; } = null!; /// /// Unstructured text describing the activity. Only set if the activity type is "Information". @@ -389,25 +353,6 @@ public sealed class DialogActivityDto public List Description { get; set; } = []; } -public sealed class DialogActivityPerformedByActorDto -{ - /// - /// The type of actor that performed the activity. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// The name of the person or organization that performed the activity. - /// Only set if the actor type is "PartyRepresentative". - /// - public string? ActorName { get; set; } - - /// - /// The identifier of the person or organization that performed the activity. - /// May be omitted if ActorType is "ServiceOwner". - /// - public string? ActorId { get; set; } -} public sealed class DialogApiActionDto { diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/MappingProfile.cs index f98167e5f..04153d89c 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/MappingProfile.cs @@ -1,5 +1,4 @@ using AutoMapper; -using Digdir.Domain.Dialogporten.Application.Common; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities; @@ -24,16 +23,9 @@ public MappingProfile() CreateMap() .ForMember(dest => dest.SeenAt, opt => opt.MapFrom(src => src.CreatedAt)); - CreateMap() - .ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => IdentifierMasker.GetMaybeMaskedIdentifier(src.ActorId))); - CreateMap() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId)); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)) - .ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => IdentifierMasker.GetMaybeMaskedIdentifier(src.ActorId))); - CreateMap(); CreateMap() @@ -51,10 +43,6 @@ public MappingProfile() CreateMap?, ContentDto?>() .ConvertUsing>(); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)) - .ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => IdentifierMasker.GetMaybeMaskedIdentifier(src.ActorId))); - CreateMap?, DialogTransmissionContentDto?>() .ConvertUsing>(); diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/DialogDtoBase.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/DialogDtoBase.cs index 7d904e170..e523f2cbe 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/DialogDtoBase.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/DialogDtoBase.cs @@ -1,5 +1,5 @@ using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Common.Actors; using Digdir.Domain.Dialogporten.Domain.DialogEndUserContexts.Entities; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities; @@ -131,7 +131,7 @@ public sealed class DialogSeenLogDto /// /// The actor that saw the dialog revision. /// - public DialogSeenLogSeenByActorDto SeenBy { get; set; } = null!; + public ActorDto SeenBy { get; set; } = null!; /// /// Flag indicating whether the seen log entry was created via the service owner. @@ -146,23 +146,6 @@ public sealed class DialogSeenLogDto public bool IsCurrentEndUser { get; set; } } -public sealed class DialogSeenLogSeenByActorDto -{ - /// - /// The natural name of the person/business that saw the dialog revision. - /// - public string ActorName { get; set; } = null!; - - /// - /// The identifier of the person/business that saw the dialog revision. - /// - /// - /// urn:altinn:person:identifier-no:01125512345 - /// urn:altinn:organization:identifier-no:912345678 - /// - public string ActorId { get; set; } = null!; -} - public sealed class DialogActivityDto { /// @@ -195,30 +178,10 @@ public sealed class DialogActivityDto /// /// The actor that performed the activity. /// - public DialogActivityPerformedByActorDto PerformedBy { get; set; } = null!; + public ActorDto PerformedBy { get; set; } = null!; /// /// Unstructured text describing the activity. Only set if the activity type is "Information". /// public List Description { get; set; } = []; } - -public sealed class DialogActivityPerformedByActorDto -{ - /// - /// What type of actor performed the activity. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// The name of the person or organization that performed the activity. - /// Only set if the actor type is "PartyRepresentative". - /// - public string? ActorName { get; set; } - - /// - /// The identifier of the person or organization that performed the activity. - /// May be omitted if ActorType is "ServiceOwner". - /// - public string? ActorId { get; set; } -} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/MappingProfile.cs index badefbcb3..d2bee9209 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/MappingProfile.cs @@ -1,5 +1,4 @@ using AutoMapper; -using Digdir.Domain.Dialogporten.Application.Common; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities; @@ -33,16 +32,9 @@ public MappingProfile() CreateMap() .ForMember(dest => dest.SeenAt, opt => opt.MapFrom(src => src.CreatedAt)); - CreateMap() - .ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => IdentifierMasker.GetMaybeMaskedIdentifier(src.ActorId))); - CreateMap() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId)); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)) - .ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => IdentifierMasker.GetMaybeMaskedIdentifier(src.ActorId))); - CreateMap?, ContentDto?>() .ConvertUsing>(); } diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Common/Actors/ActorDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Common/Actors/ActorDto.cs new file mode 100644 index 000000000..3cea258a3 --- /dev/null +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Common/Actors/ActorDto.cs @@ -0,0 +1,25 @@ +using Digdir.Domain.Dialogporten.Domain.Actors; + +namespace Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; + +public sealed class ActorDto +{ + /// + /// The type of actor that sent the transmission. + /// + public ActorType.Values ActorType { get; set; } + + /// + /// Specifies the name of the entity that sent the transmission. Mutually exclusive with ActorId. If ActorId + /// is supplied, the name will be automatically populated from the name registries. + /// + /// Ola Nordmann + public string? ActorName { get; set; } + + /// + /// The identifier of the person or organization that sent the transmission. Mutually exclusive with ActorName. + /// Might be omitted if ActorType is "ServiceOwner". + /// + /// urn:altinn:person:identifier-no:12018212345 + public string? ActorId { get; set; } +} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Common/Actors/ActorValidator.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Common/Actors/ActorValidator.cs new file mode 100644 index 000000000..0227e2be1 --- /dev/null +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Common/Actors/ActorValidator.cs @@ -0,0 +1,26 @@ +using Digdir.Domain.Dialogporten.Application.Common.Extensions.FluentValidation; +using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Actors; +using Digdir.Domain.Dialogporten.Domain.Actors; +using FluentValidation; + +namespace Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; + +public sealed class ActorValidator : AbstractValidator +{ + + public ActorValidator() + { + RuleFor(x => x.ActorType) + .IsInEnum(); + + RuleFor(x => x) + .Must(dto => (dto.ActorId is null || dto.ActorName is null) && + ((dto.ActorType == ActorType.Values.ServiceOwner && dto.ActorId is null && dto.ActorName is null) || + (dto.ActorType != ActorType.Values.ServiceOwner && (dto.ActorId is not null || dto.ActorName is not null)))) + .WithMessage(ActorValidationErrorMessages.ActorIdActorNameExclusiveOr); + + RuleFor(x => x.ActorId!) + .IsValidPartyIdentifier() + .When(x => x.ActorId is not null); + } +} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Common/Actors/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Common/Actors/MappingProfile.cs new file mode 100644 index 000000000..82c5a164e --- /dev/null +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Common/Actors/MappingProfile.cs @@ -0,0 +1,40 @@ +using AutoMapper; +using Digdir.Domain.Dialogporten.Domain; +using Digdir.Domain.Dialogporten.Domain.Actors; + +namespace Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; + +internal sealed class MappingProfile : Profile +{ + public MappingProfile() + { + var actorDtoType = typeof(ActorDto); + var actorType = typeof(Actor); + + var derivedActorTypes = DomainAssemblyMarker + .Assembly + .GetTypes() + .Where(x => x.IsClass && !x.IsAbstract && x.IsSubclassOf(actorType)) + .ToList(); + + CreateMap() + .ForMember(dest => dest.ActorType, opt => opt.Ignore()) + .ForMember(dest => dest.ActorTypeId, opt => opt.MapFrom(src => src.ActorType)); + + foreach (var inputActor in derivedActorTypes) + { + CreateMap(actorDtoType, inputActor) + .IncludeBase(actorDtoType, actorType); + } + + CreateMap() + .ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => src.ActorId)) + .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)); + + foreach (var outputActor in derivedActorTypes) + { + CreateMap(outputActor, actorDtoType) + .IncludeBase(actorType, actorDtoType); + } + } +} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogActivities/Queries/Get/ActivityDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogActivities/Queries/Get/ActivityDto.cs index 4175bfe73..30b290f2e 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogActivities/Queries/Get/ActivityDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogActivities/Queries/Get/ActivityDto.cs @@ -1,5 +1,5 @@ using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities; namespace Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.DialogActivities.Queries.Get; @@ -16,14 +16,6 @@ public sealed class ActivityDto public Guid? TransmissionId { get; set; } - public ActivityPerformedByActorDto PerformedBy { get; set; } = null!; + public ActorDto PerformedBy { get; set; } = null!; public List Description { get; set; } = []; } - -public sealed class ActivityPerformedByActorDto -{ - public Guid Id { get; set; } - public ActorType.Values ActorType { get; set; } - public string? ActorName { get; set; } - public string? ActorId { get; set; } -} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogActivities/Queries/Get/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogActivities/Queries/Get/MappingProfile.cs index e5c55c1df..95a39be73 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogActivities/Queries/Get/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogActivities/Queries/Get/MappingProfile.cs @@ -10,9 +10,5 @@ public MappingProfile() CreateMap() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId)) .ForMember(dest => dest.DeletedAt, opt => opt.MapFrom(src => src.Dialog.DeletedAt)); - - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)); - } } diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Get/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Get/MappingProfile.cs index 3b03e5be7..40762b058 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Get/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Get/MappingProfile.cs @@ -10,6 +10,5 @@ public MappingProfile() CreateMap() .ForMember(dest => dest.SeenAt, opt => opt.MapFrom(src => src.CreatedAt)); - CreateMap(); } } diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Get/SeenLogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Get/SeenLogDto.cs index bc679ce0a..44c5384d5 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Get/SeenLogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Get/SeenLogDto.cs @@ -1,3 +1,5 @@ +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; + namespace Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.DialogSeenLogs.Queries.Get; public sealed class SeenLogDto @@ -5,14 +7,8 @@ public sealed class SeenLogDto public Guid Id { get; set; } public DateTimeOffset SeenAt { get; set; } - public SeenLogSeenByActorDto SeenBy { get; set; } = null!; + public ActorDto SeenBy { get; set; } = null!; public bool? IsViaServiceOwner { get; set; } } -public sealed class SeenLogSeenByActorDto -{ - public Guid Id { get; set; } - public string ActorName { get; set; } = null!; - public string ActorId { get; set; } = null!; -} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Search/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Search/MappingProfile.cs index 00aa44509..4f3492709 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Search/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Search/MappingProfile.cs @@ -10,6 +10,5 @@ public MappingProfile() CreateMap() .ForMember(dest => dest.SeenAt, opt => opt.MapFrom(src => src.CreatedAt)); - CreateMap(); } } diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Search/SeenLogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Search/SeenLogDto.cs index 818d7e208..b62276943 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Search/SeenLogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogSeenLogs/Queries/Search/SeenLogDto.cs @@ -1,3 +1,5 @@ +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; + namespace Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.DialogSeenLogs.Queries.Search; public sealed class SeenLogDto @@ -5,14 +7,8 @@ public sealed class SeenLogDto public Guid Id { get; set; } public DateTimeOffset SeenAt { get; set; } - public SeenByActorDto SeenBy { get; set; } = null!; + public ActorDto SeenBy { get; set; } = null!; public bool? IsViaServiceOwner { get; set; } } -public sealed class SeenByActorDto -{ - public Guid Id { get; set; } - public string ActorName { get; set; } = null!; - public string ActorId { get; set; } = null!; -} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Get/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Get/MappingProfile.cs index 5d219c6e8..a2b3961fd 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Get/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Get/MappingProfile.cs @@ -14,8 +14,6 @@ public MappingProfile() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId)) .ForMember(dest => dest.DeletedAt, opt => opt.MapFrom(src => src.Dialog.DeletedAt)); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)); CreateMap?, ContentDto?>() .ConvertUsing>(); diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Get/TransmissionDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Get/TransmissionDto.cs index 9bbbce81d..e94fb55fd 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Get/TransmissionDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Get/TransmissionDto.cs @@ -1,6 +1,6 @@ using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions; @@ -46,7 +46,7 @@ public sealed class TransmissionDto /// /// The sender actor information for the transmission. /// - public SenderActorDto Sender { get; set; } = null!; + public ActorDto Sender { get; set; } = null!; /// /// The content of the transmission. @@ -59,28 +59,6 @@ public sealed class TransmissionDto public List Attachments { get; set; } = []; } -public sealed class SenderActorDto -{ - /// - /// The unique identifier for the sender actor in UUIDv7 format. - /// - public Guid Id { get; set; } - - /// - /// The type of the actor. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// The name of the actor. - /// - public string ActorName { get; set; } = null!; - - /// - /// The identifier of the actor. - /// - public string ActorId { get; set; } = null!; -} public sealed class ContentDto { diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Search/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Search/MappingProfile.cs index 559a2a1b0..292410634 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Search/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Search/MappingProfile.cs @@ -14,8 +14,6 @@ public MappingProfile() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId)) .ForMember(dest => dest.DeletedAt, opt => opt.MapFrom(src => src.Dialog.DeletedAt)); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)); CreateMap?, ContentDto?>() .ConvertUsing>(); diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Search/TransmissionDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Search/TransmissionDto.cs index 0a2cc431e..5fe23c019 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Search/TransmissionDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Search/TransmissionDto.cs @@ -1,6 +1,6 @@ using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions; @@ -46,7 +46,7 @@ public sealed class TransmissionDto /// /// The sender actor information for the transmission. /// - public SenderActorDto Sender { get; set; } = null!; + public ActorDto Sender { get; set; } = null!; /// /// The content of the transmission. @@ -59,29 +59,6 @@ public sealed class TransmissionDto public List Attachments { get; set; } = []; } -public sealed class SenderActorDto -{ - /// - /// The unique identifier for the sender actor in UUIDv7 format. - /// - public Guid Id { get; set; } - - /// - /// The type of the actor. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// The name of the actor. - /// - public string ActorName { get; set; } = null!; - - /// - /// The identifier of the actor. - /// - public string ActorId { get; set; } = null!; -} - public sealed class ContentDto { /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogCommandValidator.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogCommandValidator.cs index 4f04c7a75..42a867469 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogCommandValidator.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogCommandValidator.cs @@ -2,10 +2,9 @@ using Digdir.Domain.Dialogporten.Application.Common.Extensions.Enumerables; using Digdir.Domain.Dialogporten.Application.Common.Extensions.FluentValidation; using Digdir.Domain.Dialogporten.Application.Externals.Presentation; -using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Actors; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Common; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities; @@ -150,7 +149,7 @@ public CreateDialogCommandValidator( internal sealed class CreateDialogDialogTransmissionDtoValidator : AbstractValidator { public CreateDialogDialogTransmissionDtoValidator( - IValidator actorValidator, + IValidator actorValidator, IValidator contentValidator, IValidator attachmentValidator) { @@ -409,7 +408,7 @@ internal sealed class CreateDialogDialogActivityDtoValidator : AbstractValidator { public CreateDialogDialogActivityDtoValidator( IValidator> localizationsValidator, - IValidator actorValidator) + IValidator actorValidator) { RuleFor(x => x.Id) .IsValidUuidV7() @@ -443,41 +442,3 @@ public CreateDialogDialogActivityDtoValidator( .When(x => x.Type == DialogActivityType.Values.TransmissionOpened); } } - -internal sealed class CreateDialogDialogTransmissionActorDtoValidator : AbstractValidator -{ - public CreateDialogDialogTransmissionActorDtoValidator() - { - RuleFor(x => x.ActorType) - .IsInEnum(); - - RuleFor(x => x) - .Must(dto => (dto.ActorId is null || dto.ActorName is null) && - ((dto.ActorType == ActorType.Values.ServiceOwner && dto.ActorId is null && dto.ActorName is null) || - (dto.ActorType != ActorType.Values.ServiceOwner && (dto.ActorId is not null || dto.ActorName is not null)))) - .WithMessage(ActorValidationErrorMessages.ActorIdActorNameExclusiveOr); - - RuleFor(x => x.ActorId!) - .IsValidPartyIdentifier() - .When(x => x.ActorId is not null); - } -} - -internal sealed class CreateDialogDialogActivityActorDtoValidator : AbstractValidator -{ - public CreateDialogDialogActivityActorDtoValidator() - { - RuleFor(x => x.ActorType) - .IsInEnum(); - - RuleFor(x => x) - .Must(dto => (dto.ActorId is null || dto.ActorName is null) && - ((dto.ActorType == ActorType.Values.ServiceOwner && dto.ActorId is null && dto.ActorName is null) || - (dto.ActorType != ActorType.Values.ServiceOwner && (dto.ActorId is not null || dto.ActorName is not null)))) - .WithMessage(ActorValidationErrorMessages.ActorIdActorNameExclusiveOr); - - RuleFor(x => x.ActorId!) - .IsValidPartyIdentifier() - .When(x => x.ActorId is not null); - } -} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogDto.cs index 1458d12a5..5b7791a71 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogDto.cs @@ -1,6 +1,6 @@ using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.DialogEndUserContexts.Entities; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities; @@ -193,7 +193,7 @@ public sealed class TransmissionDto /// /// The actor that sent the transmission. /// - public TransmissionSenderActorDto Sender { get; set; } = null!; + public ActorDto Sender { get; set; } = null!; /// /// The transmission unstructured text content. @@ -305,7 +305,7 @@ public sealed class ActivityDto /// /// The actor that performed the activity. /// - public ActivityPerformedByActorDto PerformedBy { get; set; } = null!; + public ActorDto PerformedBy { get; set; } = null!; /// /// Unstructured text describing the activity. Only set if the activity type is "Information". @@ -313,50 +313,6 @@ public sealed class ActivityDto public List Description { get; set; } = []; } -public sealed class ActivityPerformedByActorDto -{ - /// - /// What type of actor performed the activity. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// Specifies the name of the entity that performed the activity. Mutually exclusive with ActorId. If ActorId - /// is supplied, the name will be automatically populated from the name registries. - /// - /// Ola Nordmann - public string? ActorName { get; set; } - - /// - /// The identifier of the person or organization that performed the activity. Mutually exclusive with ActorName. - /// Might be omitted if ActorType is "ServiceOwner". - /// - /// urn:altinn:person:identifier-no:12018212345 - public string? ActorId { get; set; } -} - -public sealed class TransmissionSenderActorDto -{ - /// - /// The type of actor that sent the transmission. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// Specifies the name of the entity that sent the transmission. Mutually exclusive with ActorId. If ActorId - /// is supplied, the name will be automatically populated from the name registries. - /// - /// Ola Nordmann - public string? ActorName { get; set; } - - /// - /// The identifier of the person or organization that sent the transmission. Mutually exclusive with ActorName. - /// Might be omitted if ActorType is "ServiceOwner". - /// - /// urn:altinn:person:identifier-no:12018212345 - public string? ActorId { get; set; } -} - public sealed class ApiActionDto { /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/MappingProfile.cs index abc884a5f..702eef3d2 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/MappingProfile.cs @@ -40,20 +40,12 @@ public MappingProfile() .ForMember(dest => dest.Type, opt => opt.Ignore()) .ForMember(dest => dest.TypeId, opt => opt.MapFrom(src => src.Type)); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.Ignore()) - .ForMember(dest => dest.ActorTypeId, opt => opt.MapFrom(src => src.ActorType)); - CreateMap?>() .ConvertUsing>(); CreateMap?>() .ConvertUsing>(); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.Ignore()) - .ForMember(dest => dest.ActorTypeId, opt => opt.MapFrom(src => src.ActorType)); - CreateMap() .ForMember(dest => dest.Type, opt => opt.Ignore()) .ForMember(dest => dest.TypeId, opt => opt.MapFrom(src => src.Type)); diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/MappingProfile.cs index d13fd80f0..49a6fa612 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/MappingProfile.cs @@ -66,10 +66,6 @@ public MappingProfile() .ForMember(dest => dest.Type, opt => opt.Ignore()) .ForMember(dest => dest.TypeId, opt => opt.MapFrom(src => src.Type)); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.Ignore()) - .ForMember(dest => dest.ActorTypeId, opt => opt.MapFrom(src => src.ActorType)); - CreateMap() .ForMember(dest => dest.Type, opt => opt.Ignore()) .ForMember(dest => dest.TypeId, opt => opt.MapFrom(src => src.Type)); @@ -77,10 +73,6 @@ public MappingProfile() CreateMap?>() .ConvertUsing>(); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.Ignore()) - .ForMember(dest => dest.ActorTypeId, opt => opt.MapFrom(src => src.ActorType)); - CreateMap(); CreateMap() @@ -98,7 +90,6 @@ public MappingProfile() .ForMember(dest => dest.Transmissions, opt => opt.Ignore()); CreateMap(); CreateMap(); - CreateMap(); CreateMap(); CreateMap(); CreateMap(); diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommandValidator.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommandValidator.cs index 8778a3550..909d47e7a 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommandValidator.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommandValidator.cs @@ -2,10 +2,9 @@ using Digdir.Domain.Dialogporten.Application.Common.Extensions.Enumerables; using Digdir.Domain.Dialogporten.Application.Common.Extensions.FluentValidation; using Digdir.Domain.Dialogporten.Application.Externals.Presentation; -using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Actors; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Common; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities; @@ -139,25 +138,6 @@ public UpdateDialogTransmissionAttachmentUrlDtoValidator() } } -internal sealed class UpdateDialogDialogTransmissionActorDtoValidator : AbstractValidator -{ - public UpdateDialogDialogTransmissionActorDtoValidator() - { - RuleFor(x => x.ActorType) - .IsInEnum(); - - RuleFor(x => x) - .Must(dto => (dto.ActorId is null || dto.ActorName is null) && - ((dto.ActorType == ActorType.Values.ServiceOwner && dto.ActorId is null && dto.ActorName is null) || - (dto.ActorType != ActorType.Values.ServiceOwner && (dto.ActorId is not null || dto.ActorName is not null)))) - .WithMessage(ActorValidationErrorMessages.ActorIdActorNameExclusiveOr); - - RuleFor(x => x.ActorId!) - .IsValidPartyIdentifier() - .When(x => x.ActorId is not null); - } -} - internal sealed class UpdateDialogDialogTransmissionContentDtoValidator : AbstractValidator { private static readonly NullabilityInfoContext Context = new(); @@ -201,7 +181,7 @@ public UpdateDialogDialogTransmissionContentDtoValidator() internal sealed class UpdateDialogDialogTransmissionDtoValidator : AbstractValidator { public UpdateDialogDialogTransmissionDtoValidator( - IValidator actorValidator, + IValidator actorValidator, IValidator contentValidator, IValidator attachmentValidator) { @@ -394,7 +374,7 @@ internal sealed class UpdateDialogDialogActivityDtoValidator : AbstractValidator { public UpdateDialogDialogActivityDtoValidator( IValidator> localizationsValidator, - IValidator actorValidator) + IValidator actorValidator) { RuleFor(x => x.Id) .IsValidUuidV7() @@ -428,22 +408,3 @@ public UpdateDialogDialogActivityDtoValidator( .When(x => x.Type == DialogActivityType.Values.TransmissionOpened); } } - -internal sealed class UpdateDialogDialogActivityActorDtoValidator : AbstractValidator -{ - public UpdateDialogDialogActivityActorDtoValidator() - { - RuleFor(x => x.ActorType) - .IsInEnum(); - - RuleFor(x => x) - .Must(dto => (dto.ActorId is null || dto.ActorName is null) && - ((dto.ActorType == ActorType.Values.ServiceOwner && dto.ActorId is null && dto.ActorName is null) || - (dto.ActorType != ActorType.Values.ServiceOwner && (dto.ActorId is not null || dto.ActorName is not null)))) - .WithMessage(ActorValidationErrorMessages.ActorIdActorNameExclusiveOr); - - RuleFor(x => x.ActorId!) - .IsValidPartyIdentifier() - .When(x => x.ActorId is not null); - } -} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogDto.cs index f65c6347e..44b15b702 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogDto.cs @@ -1,6 +1,6 @@ using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions; @@ -145,7 +145,7 @@ public class TransmissionDto /// /// The actor that sent the transmission. /// - public TransmissionSenderActorDto Sender { get; set; } = null!; + public ActorDto Sender { get; set; } = null!; /// /// The transmission unstructured text content. @@ -177,28 +177,6 @@ public sealed class TransmissionContentDto public ContentValueDto? ContentReference { get; set; } } -public sealed class TransmissionSenderActorDto -{ - /// - /// The type of actor that sent the transmission. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// Specifies the name of the entity that sent the transmission. Mutually exclusive with ActorId. If ActorId - /// is supplied, the name will be automatically populated from the name registries. - /// - /// Ola Nordmann - public string? ActorName { get; set; } - - /// - /// The identifier of the person or organization that sent the transmission. Mutually exclusive with ActorName. - /// Might be omitted if ActorType is "ServiceOwner". - /// - /// urn:altinn:person:identifier-no:12018212345 - public string? ActorId { get; set; } -} - public sealed class ContentDto { /// @@ -274,7 +252,7 @@ public class ActivityDto /// /// The actor that performed the activity. /// - public ActivityPerformedByActorDto PerformedBy { get; set; } = null!; + public ActorDto PerformedBy { get; set; } = null!; /// /// Unstructured text describing the activity. Only set if the activity type is "Information". @@ -282,28 +260,6 @@ public class ActivityDto public List Description { get; set; } = []; } -public sealed class ActivityPerformedByActorDto -{ - /// - /// What type of actor performed the activity. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// Specifies the name of the entity that performed the activity. Mutually exclusive with ActorId. If ActorId - /// is supplied, the name will be automatically populated from the name registries. - /// - /// Ola Nordmann - public string? ActorName { get; set; } - - /// - /// The identifier of the person or organization that performed the activity. Mutually exclusive with ActorName. - /// Might be omitted if ActorType is "ServiceOwner". - /// - /// urn:altinn:person:identifier-no:12018212345 - public string? ActorId { get; set; } -} - public sealed class ApiActionDto { /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/DialogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/DialogDto.cs index 84bc3ae9c..8d5ce8951 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/DialogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/DialogDto.cs @@ -1,6 +1,6 @@ using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.DialogEndUserContexts.Entities; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities; @@ -227,7 +227,7 @@ public sealed class DialogTransmissionDto /// /// The actor that sent the transmission. /// - public DialogTransmissionSenderActorDto Sender { get; set; } = null!; + public ActorDto Sender { get; set; } = null!; /// /// The transmission unstructured text content. @@ -255,7 +255,7 @@ public sealed class DialogSeenLogDto /// /// The actor that saw the dialog revision. /// - public DialogSeenLogSeenByActorDto SeenBy { get; set; } = null!; + public ActorDto SeenBy { get; set; } = null!; /// /// Flag indicating whether the seen log entry was created via the service owner. @@ -270,42 +270,6 @@ public sealed class DialogSeenLogDto public bool IsCurrentEndUser { get; set; } } -public sealed class DialogSeenLogSeenByActorDto -{ - /// - /// The natural name of the person/business that saw the dialog revision. - /// - public string ActorName { get; set; } = null!; - - /// - /// The identifier of the person/business that saw the dialog revision. - /// - /// - /// urn:altinn:person:identifier-no:01125512345 - /// urn:altinn:organization:identifier-no:912345678 - /// - public string ActorId { get; set; } = null!; -} - -public sealed class DialogTransmissionSenderActorDto -{ - /// - /// The type of actor that sent the transmission. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// The name of the person or organization that sent the transmission. - /// - /// Ola Nordmann - public string ActorName { get; set; } = null!; - - /// - /// The identifier of the person or organization that sent the transmission. - /// - /// urn:altinn:person:identifier-no:12018212345 - public string ActorId { get; set; } = null!; -} public sealed class ContentDto { @@ -400,7 +364,7 @@ public sealed class DialogActivityDto /// /// The actor that performed the activity. /// - public DialogActivityPerformedByActorDto PerformedBy { get; set; } = null!; + public ActorDto PerformedBy { get; set; } = null!; /// /// Unstructured text describing the activity. Only set if the activity type is "Information". @@ -408,25 +372,6 @@ public sealed class DialogActivityDto public List Description { get; set; } = []; } -public sealed class DialogActivityPerformedByActorDto -{ - /// - /// What type of actor performed the activity. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// The name of the person or organization that performed the activity. - /// Only set if the actor type is "PartyRepresentative". - /// - public string? ActorName { get; set; } - - /// - /// The identifier of the person or organization that performed the activity. - /// May be omitted if ActorType is "ServiceOwner". - /// - public string? ActorId { get; set; } -} public sealed class DialogApiActionDto { diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/MappingProfile.cs index 4e01c904d..2b46a8a3c 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/MappingProfile.cs @@ -1,5 +1,6 @@ using AutoMapper; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions; @@ -19,14 +20,12 @@ public MappingProfile() .ForMember(dest => dest.SeenSinceLastUpdate, opt => opt.Ignore()) .ForMember(dest => dest.SystemLabel, opt => opt.MapFrom(src => src.DialogEndUserContext.SystemLabelId)); - CreateMap(); + CreateMap(); CreateMap() .ForMember(dest => dest.SeenAt, opt => opt.MapFrom(src => src.CreatedAt)); CreateMap() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId)); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)); CreateMap(); CreateMap() @@ -45,9 +44,6 @@ public MappingProfile() CreateMap?, ContentDto?>() .ConvertUsing>(); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)); - CreateMap?, DialogTransmissionContentDto?>() .ConvertUsing>(); diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/DialogDtoBase.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/DialogDtoBase.cs index 1f28661fc..f086ed884 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/DialogDtoBase.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/DialogDtoBase.cs @@ -1,5 +1,5 @@ using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; using Digdir.Domain.Dialogporten.Domain.DialogEndUserContexts.Entities; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities; @@ -143,7 +143,7 @@ public sealed class DialogSeenLogDto /// /// The actor that saw the dialog revision. /// - public DialogSeenLogSeenByActorDto SeenBy { get; set; } = null!; + public ActorDto SeenBy { get; set; } = null!; /// /// Flag indicating whether the seen log entry was created via the service owner. @@ -158,22 +158,6 @@ public sealed class DialogSeenLogDto public bool IsCurrentEndUser { get; set; } } -public sealed class DialogSeenLogSeenByActorDto -{ - /// - /// The natural name of the person/business that saw the dialog revision. - /// - public string ActorName { get; set; } = null!; - - /// - /// The identifier of the person/business that saw the dialog revision. - /// - /// - /// urn:altinn:person:identifier-no:01125512345 - /// urn:altinn:organization:identifier-no:912345678 - /// - public string ActorId { get; set; } = null!; -} public sealed class DialogActivityDto { @@ -207,7 +191,7 @@ public sealed class DialogActivityDto /// /// The actor that performed the activity. /// - public DialogActivityPerformedByActorDto PerformedBy { get; set; } = null!; + public ActorDto PerformedBy { get; set; } = null!; /// /// Unstructured text describing the activity. Only set if the activity type is "Information". @@ -215,22 +199,3 @@ public sealed class DialogActivityDto public List Description { get; set; } = []; } -public sealed class DialogActivityPerformedByActorDto -{ - /// - /// What type of actor performed the activity. - /// - public ActorType.Values ActorType { get; set; } - - /// - /// The name of the person or organization that performed the activity. - /// Only set if the actor type is "PartyRepresentative". - /// - public string? ActorName { get; set; } - - /// - /// The identifier of the person or organization that performed the activity. - /// May be omitted if ActorType is "ServiceOwner". - /// - public string? ActorId { get; set; } -} diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/MappingProfile.cs index 0f61aa4e8..3039a68d2 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/MappingProfile.cs @@ -32,16 +32,9 @@ public MappingProfile() CreateMap() .ForMember(dest => dest.SeenAt, opt => opt.MapFrom(src => src.CreatedAt)); - CreateMap() - .ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => src.ActorId)); - CreateMap() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId)); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId)) - .ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => src.ActorId)); - CreateMap?, ContentDto?>() .ConvertUsing>(); } diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs index cee98bf2b..61e524950 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs @@ -9,6 +9,7 @@ using Digdir.Domain.Dialogporten.Domain.Dialogs.Events; using Digdir.Library.Entity.Abstractions; using Digdir.Library.Entity.Abstractions.Features.Aggregate; +using Digdir.Library.Entity.Abstractions.Features.Identifiable; using Digdir.Library.Entity.Abstractions.Features.SoftDeletable; using Digdir.Library.Entity.Abstractions.Features.Versionable; @@ -97,7 +98,7 @@ public void UpdateSeenAt(string endUserId, DialogUserType.Values userTypeId, str return; } - SeenLog.Add(new() + SeenLog.Add(new DialogSeenLog { EndUserTypeId = userTypeId, IsViaServiceOwner = userTypeId == DialogUserType.Values.ServiceOwnerOnBehalfOfPerson, @@ -108,7 +109,6 @@ public void UpdateSeenAt(string endUserId, DialogUserType.Values userTypeId, str ActorName = endUserName } }); - _domainEvents.Add(new DialogSeenDomainEvent(Id, ServiceResource, Party, Process, PrecedingProcess)); } diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/MappingProfile.cs index 28124881a..90370570c 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/MappingProfile.cs @@ -1,10 +1,9 @@ using AutoMapper; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Content; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; +using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Common.Actors; using DialogActivityDto = Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Dialogs.Queries.Search.DialogActivityDto; -using DialogActivityPerformedByActorDto = Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Dialogs.Queries.Search.DialogActivityPerformedByActorDto; using DialogSeenLogDto = Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Dialogs.Queries.Search.DialogSeenLogDto; -using DialogSeenLogSeenByActorDto = Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Dialogs.Queries.Search.DialogSeenLogSeenByActorDto; namespace Digdir.Domain.Dialogporten.GraphQL.EndUser.Common; @@ -16,20 +15,16 @@ public MappingProfile() CreateMap(); - CreateMap(); - CreateMap(); + CreateMap(); CreateMap(); - CreateMap(); CreateMap() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.Type)); - CreateMap() - .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorType)); CreateMap() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.Type)); - CreateMap() + CreateMap() .ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorType)); } } diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/MappingProfile.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/MappingProfile.cs index b42d1a997..dffcaf849 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/MappingProfile.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/MappingProfile.cs @@ -1,4 +1,5 @@ using AutoMapper; +using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Actors; using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Dialogs.Queries.Get; using Digdir.Domain.Dialogporten.GraphQL.EndUser.Common; @@ -28,7 +29,6 @@ public MappingProfile() CreateMap() .ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.Type)); - CreateMap(); CreateMap(); CreateMap() .ForMember(dest => dest.ConsumerType, opt => opt.MapFrom(src => src.ConsumerType)); diff --git a/src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/ServiceOwner/Dialogs/Update/UpdateDialogSwaggerConfig.cs b/src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/ServiceOwner/Dialogs/Update/UpdateDialogSwaggerConfig.cs index 99dbb6e82..c8b7a2afc 100644 --- a/src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/ServiceOwner/Dialogs/Update/UpdateDialogSwaggerConfig.cs +++ b/src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/ServiceOwner/Dialogs/Update/UpdateDialogSwaggerConfig.cs @@ -1,5 +1,6 @@ using System.Globalization; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Commands.Update; using Digdir.Domain.Dialogporten.Domain; using Digdir.Domain.Dialogporten.Domain.Actors; @@ -148,7 +149,7 @@ internal abstract class UpdateDialogSwaggerConfig { Id = Guid.Parse("8b95d42d-d2b6-4c01-8ca0-a817a4b3c50d"), Type = DialogActivityType.Values.Information, - PerformedBy = new ActivityPerformedByActorDto + PerformedBy = new ActorDto { ActorType = ActorType.Values.ServiceOwner }, diff --git a/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs b/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs index eadeca86f..b08569874 100644 --- a/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs +++ b/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs @@ -1,6 +1,8 @@ using System.Globalization; using Bogus; +using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Actors; using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Commands.Create; using Digdir.Domain.Dialogporten.Domain.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; @@ -265,7 +267,7 @@ public static List GenerateFakeDialogActivities(int? count = null, .RuleFor(o => o.CreatedAt, f => f.Date.Past()) .RuleFor(o => o.ExtendedType, f => new Uri(f.Internet.UrlWithPath(Uri.UriSchemeHttps))) .RuleFor(o => o.Type, f => type ?? f.PickRandom(activityTypes)) - .RuleFor(o => o.PerformedBy, f => new ActivityPerformedByActorDto { ActorType = ActorType.Values.PartyRepresentative, ActorName = f.Name.FullName() }) + .RuleFor(o => o.PerformedBy, f => new ActorDto { ActorType = ActorType.Values.PartyRepresentative, ActorName = f.Name.FullName() }) .RuleFor(o => o.Description, (f, o) => o.Type == DialogActivityType.Values.Information ? GenerateFakeLocalizations(f.Random.Number(4, 8)) : null) .Generate(count ?? new Randomizer().Number(1, 4)); } diff --git a/tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/UpdateDialogTests.cs b/tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/UpdateDialogTests.cs index 871ad6faf..d8e752f60 100644 --- a/tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/UpdateDialogTests.cs +++ b/tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/UpdateDialogTests.cs @@ -1,4 +1,5 @@ -using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Queries.Get; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Queries.Get; using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Commands.Create; using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Commands.Update; using Digdir.Domain.Dialogporten.Application.Integration.Tests.Common; @@ -8,7 +9,6 @@ using Digdir.Tool.Dialogporten.GenerateFakeData; using FluentAssertions; using ActivityDto = Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Commands.Update.ActivityDto; -using ActivityPerformedByActorDto = Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Commands.Update.ActivityPerformedByActorDto; using TransmissionDto = Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Commands.Update.TransmissionDto; namespace Digdir.Domain.Dialogporten.Application.Integration.Tests.Features.V1.ServiceOwner.Dialogs.Commands; @@ -32,7 +32,7 @@ public async Task Cannot_Include_Old_Activities_To_UpdateCommand() { Id = getDialogDto.AsT0.Activities.First().Id, Type = DialogActivityType.Values.DialogCreated, - PerformedBy = new ActivityPerformedByActorDto + PerformedBy = new ActorDto { ActorType = ActorType.Values.ServiceOwner } diff --git a/tests/Digdir.Domain.Dialogporten.Application.Unit.Tests/Features/V1/ServiceOwner/Common/ActorValidatorTest.cs b/tests/Digdir.Domain.Dialogporten.Application.Unit.Tests/Features/V1/ServiceOwner/Common/ActorValidatorTest.cs new file mode 100644 index 000000000..5e1baa51c --- /dev/null +++ b/tests/Digdir.Domain.Dialogporten.Application.Unit.Tests/Features/V1/ServiceOwner/Common/ActorValidatorTest.cs @@ -0,0 +1,80 @@ +using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Common.Actors; +using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Tool.Dialogporten.GenerateFakeData; + +namespace Digdir.Domain.Dialogporten.Application.Unit.Tests.Features.V1.ServiceOwner.Common; + +public class ActorValidatorTest +{ + private readonly ActorValidator _actorValidator = new(); + + [Fact] + public void Given_Invalid_ActorId_Should_Return_Error() + { + var actorDto = new ActorDto + { + ActorType = ActorType.Values.PartyRepresentative, + ActorName = null, + ActorId = "InvalidId!" + }; + var result = _actorValidator.Validate(actorDto); + Assert.NotEmpty(result.Errors); + } + + [Theory] + [InlineData(ActorType.Values.PartyRepresentative)] + [InlineData(ActorType.Values.ServiceOwner)] + public void Given_Valid_ActorId_Should_Return_Success(ActorType.Values actorType) + { + + var actorDto = new ActorDto + { + ActorType = actorType, + ActorId = actorType == ActorType.Values.PartyRepresentative ? DialogGenerator.GenerateRandomParty(forcePerson: true) : null + }; + var result = _actorValidator.Validate(actorDto); + Assert.Empty(result.Errors); + } + + [Fact] + public void Given_Null_ActorType_Should_Return_Error() + { + var actorDto = new ActorDto + { + ActorId = DialogGenerator.GenerateRandomParty(forcePerson: true) + }; + var result = _actorValidator.Validate(actorDto); + Assert.NotEmpty(result.Errors); + } + + + [Theory] + [InlineData(ActorType.Values.PartyRepresentative)] + [InlineData(ActorType.Values.ServiceOwner)] + public void Given_ActorId_And_ActorName_Should_Return_Error(ActorType.Values actorType) + { + var actorDto = new ActorDto + { + ActorType = actorType, + ActorName = "Fredrik Testland", + ActorId = DialogGenerator.GenerateRandomParty(forcePerson: true) + }; + var result = _actorValidator.Validate(actorDto); + Assert.NotEmpty(result.Errors); + } + + [Theory] + [InlineData("Fredik TestLand", false)] + [InlineData(null, true)] + public void ActorType_ServiceOwner_Rules(string? actorName, bool generateActorId) + { + var actorDto = new ActorDto + { + ActorType = ActorType.Values.ServiceOwner, + ActorName = actorName, + ActorId = generateActorId ? DialogGenerator.GenerateRandomParty(forcePerson: true) : null + }; + var result = _actorValidator.Validate(actorDto); + Assert.NotEmpty(result.Errors); + } +}