From e9d05ca277f7eb172b96e72d8d6343291d61addc Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Thu, 5 Sep 2024 16:09:30 +0200 Subject: [PATCH 01/30] Bigus commitus --- .../Dialogs/Queries/Get/GetDialogDto.cs | 4 + .../Queries/Search/SearchDialogDtoBase.cs | 4 + .../Queries/Search/SearchDialogQuery.cs | 4 + .../Search/SearchDialogQueryValidator.cs | 4 + .../Create/CreateDialogCommandValidator.cs | 27 +- .../Commands/Create/CreateDialogDto.cs | 1 + .../Commands/Update/UpdateDialogCommand.cs | 1 + .../Update/UpdateDialogCommandValidator.cs | 21 +- .../Commands/Update/UpdateDialogDto.cs | 2 + .../Dialogs/Queries/Get/GetDialogDto.cs | 4 + .../Queries/Search/SearchDialogDtoBase.cs | 4 + .../Queries/Search/SearchDialogQuery.cs | 5 + .../Search/SearchDialogQueryValidator.cs | 4 + .../Dialogs/Entities/DialogEntity.cs | 15 +- .../Events/DialogCreatedDomainEvent.cs | 2 +- .../Events/DialogDeletedDomainEvent.cs | 4 +- .../Dialogs/Events/DialogSeenDomainEvent.cs | 2 +- .../Events/DialogUpdatedDomainEvent.cs | 2 +- .../EndUser/DialogById/ObjectTypes.cs | 2 + .../EndUser/SearchDialogs/ObjectTypes.cs | 2 + .../Dialogs/DialogEntityConfiguration.cs | 1 + .../20240904114609_AddProcess.Designer.cs | 1793 +++++++++++++++++ .../Migrations/20240904114609_AddProcess.cs | 49 + .../DialogDbContextModelSnapshot.cs | 82 +- .../appsettings.Development.json | 14 +- tests/k6/common/dialog.js | 6 + tests/k6/common/testimports.js | 3 +- tests/k6/tests/enduser/dialogSearch.js | 18 +- 28 files changed, 2006 insertions(+), 74 deletions(-) create mode 100644 src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240904114609_AddProcess.Designer.cs create mode 100644 src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240904114609_AddProcess.cs diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs index 1ce7b96b0..a509ec6ca 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs @@ -57,6 +57,10 @@ public sealed class GetDialogDto /// public int? Progress { get; set; } + public string? Process { get; set; } + + public string? PrecedingProcess { get; set; } + /// /// Arbitrary string with a service-specific indicator of status, typically used to indicate a fine-grained state of /// the dialog to further specify the "status" enum. diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs index 8d3e30939..65e285a37 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs @@ -46,6 +46,10 @@ public class SearchDialogDtoBase /// public int? Progress { get; set; } + public string? Process { get; set; } + + public string? PrecedingProcess { get; set; } + /// /// The number of attachments in the dialog made available for browser-based frontends. /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs index 4685eac8b..09ad18459 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs @@ -81,6 +81,9 @@ public sealed class SearchDialogQuery : SortablePaginationParameter public DateTimeOffset? DueBefore { get; init; } + public string? Process { get; init; } + + /// /// Search string for free text search. Will attempt to fuzzily match in all free text fields in the aggregate /// @@ -164,6 +167,7 @@ public async Task Handle(SearchDialogQuery request, Cancella .WhereIf(request.UpdatedBefore.HasValue, x => x.UpdatedAt <= request.UpdatedBefore) .WhereIf(request.DueAfter.HasValue, x => request.DueAfter <= x.DueAt) .WhereIf(request.DueBefore.HasValue, x => x.DueAt <= request.DueBefore) + .WhereIf(request.Process is not null, x => x.Process == request.Process) .WhereIf(request.Search is not null, x => x.Content.Any(x => x.Value.Localizations.AsQueryable().Any(searchExpression)) || x.SearchTags.Any(x => EF.Functions.ILike(x.Value, request.Search!)) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQueryValidator.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQueryValidator.cs index b64b3796c..f8e1ae26b 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQueryValidator.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQueryValidator.cs @@ -44,6 +44,10 @@ public SearchDialogQueryValidator() .LessThanOrEqualTo(20) .When(x => x.ExtendedStatus is not null); + RuleFor(x => x) + .Must(x => x.Process is null || Uri.IsWellFormedUriString(x.Process, UriKind.Absolute)) + .WithMessage($"{nameof(SearchDialogQuery.Process)} must be a valid URI"); + RuleForEach(x => x.Status).IsInEnum(); } } 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 057ea04df..43d8065af 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 @@ -1,4 +1,5 @@ -using System.Reflection; +using System.Diagnostics; +using System.Reflection; using Digdir.Domain.Dialogporten.Application.Common.Extensions.Enumerables; using Digdir.Domain.Dialogporten.Application.Common.Extensions.FluentValidation; using Digdir.Domain.Dialogporten.Application.Features.V1.Common; @@ -36,7 +37,7 @@ public CreateDialogCommandValidator( .MaximumLength(Constants.DefaultMaxUriLength) .Must(x => x?.StartsWith(Constants.ServiceResourcePrefix, StringComparison.InvariantCulture) ?? false) - .WithMessage($"'{{PropertyName}}' must start with '{Constants.ServiceResourcePrefix}'."); + .WithMessage($"'{{PropertyName}}' must start with '{Constants.ServiceResourcePrefix}'."); RuleFor(x => x.Party) .IsValidPartyIdentifier() @@ -55,16 +56,16 @@ public CreateDialogCommandValidator( RuleFor(x => x.ExpiresAt) .IsInFuture() .GreaterThanOrEqualTo(x => x.DueAt) - .WithMessage(FluentValidationDateTimeOffsetExtensions.InFutureOfMessage) - .When(x => x.DueAt.HasValue, ApplyConditionTo.CurrentValidator) + .WithMessage(FluentValidationDateTimeOffsetExtensions.InFutureOfMessage) + .When(x => x.DueAt.HasValue, ApplyConditionTo.CurrentValidator) .GreaterThanOrEqualTo(x => x.VisibleFrom) - .WithMessage(FluentValidationDateTimeOffsetExtensions.InFutureOfMessage) - .When(x => x.VisibleFrom.HasValue, ApplyConditionTo.CurrentValidator); + .WithMessage(FluentValidationDateTimeOffsetExtensions.InFutureOfMessage) + .When(x => x.VisibleFrom.HasValue, ApplyConditionTo.CurrentValidator); RuleFor(x => x.DueAt) .IsInFuture() .GreaterThanOrEqualTo(x => x.VisibleFrom) - .WithMessage(FluentValidationDateTimeOffsetExtensions.InFutureOfMessage) - .When(x => x.VisibleFrom.HasValue, ApplyConditionTo.CurrentValidator); + .WithMessage(FluentValidationDateTimeOffsetExtensions.InFutureOfMessage) + .When(x => x.VisibleFrom.HasValue, ApplyConditionTo.CurrentValidator); RuleFor(x => x.VisibleFrom) .IsInFuture(); @@ -82,15 +83,15 @@ public CreateDialogCommandValidator( .Must(x => x .EmptyIfNull() .Count(x => x.Priority == DialogGuiActionPriority.Values.Primary) <= 1) - .WithMessage("Only one primary GUI action is allowed.") + .WithMessage("Only one primary GUI action is allowed.") .Must(x => x .EmptyIfNull() .Count(x => x.Priority == DialogGuiActionPriority.Values.Secondary) <= 1) - .WithMessage("Only one secondary GUI action is allowed.") + .WithMessage("Only one secondary GUI action is allowed.") .Must(x => x .EmptyIfNull() .Count(x => x.Priority == DialogGuiActionPriority.Values.Tertiary) <= 5) - .WithMessage("Only five tertiary GUI actions are allowed.") + .WithMessage("Only five tertiary GUI actions are allowed.") .ForEach(x => x.SetValidator(guiActionValidator)); RuleForEach(x => x.ApiActions) @@ -117,6 +118,10 @@ public CreateDialogCommandValidator( dependentKeySelector: activity => activity.RelatedActivityId, principalKeySelector: activity => activity.Id) .SetValidator(activityValidator); + + + RuleFor(x => x) + .Must(x => x.Process is null || Uri.IsWellFormedUriString(x.Process, UriKind.Absolute)).WithMessage("Process must be a valid absolute URI."); } } 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 037778d46..51c2736bb 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 @@ -64,6 +64,7 @@ public class CreateDialogDto /// /// 2022-12-31T23:59:59Z public DateTimeOffset? DueAt { get; set; } + public string? Process { get; set; } /// /// The expiration date for the dialog. This is the last date when the dialog is available for the end user. diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs index 7ac9ca025..f95ddf07a 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs @@ -89,6 +89,7 @@ public async Task Handle(UpdateDialogCommand request, Cancel } // Update primitive properties + // Alle? inc string? _mapper.Map(request.Dto, dialog); ValidateTimeFields(dialog); 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 c78702713..38ae320e3 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 @@ -49,15 +49,15 @@ public UpdateDialogDtoValidator( RuleFor(x => x.ExpiresAt) .GreaterThanOrEqualTo(x => x.DueAt) - .WithMessage(FluentValidationDateTimeOffsetExtensions.InFutureOfMessage) - .When(x => x.DueAt.HasValue, ApplyConditionTo.CurrentValidator) + .WithMessage(FluentValidationDateTimeOffsetExtensions.InFutureOfMessage) + .When(x => x.DueAt.HasValue, ApplyConditionTo.CurrentValidator) .GreaterThanOrEqualTo(x => x.VisibleFrom) - .WithMessage(FluentValidationDateTimeOffsetExtensions.InFutureOfMessage) - .When(x => x.VisibleFrom.HasValue, ApplyConditionTo.CurrentValidator); + .WithMessage(FluentValidationDateTimeOffsetExtensions.InFutureOfMessage) + .When(x => x.VisibleFrom.HasValue, ApplyConditionTo.CurrentValidator); RuleFor(x => x.DueAt) .GreaterThanOrEqualTo(x => x.VisibleFrom) - .WithMessage(FluentValidationDateTimeOffsetExtensions.InFutureOfMessage) - .When(x => x.VisibleFrom.HasValue, ApplyConditionTo.CurrentValidator); + .WithMessage(FluentValidationDateTimeOffsetExtensions.InFutureOfMessage) + .When(x => x.VisibleFrom.HasValue, ApplyConditionTo.CurrentValidator); RuleFor(x => x.Status) .IsInEnum(); @@ -73,15 +73,15 @@ public UpdateDialogDtoValidator( .Must(x => x .EmptyIfNull() .Count(x => x.Priority == DialogGuiActionPriority.Values.Primary) <= 1) - .WithMessage("Only one primary GUI action is allowed.") + .WithMessage("Only one primary GUI action is allowed.") .Must(x => x .EmptyIfNull() .Count(x => x.Priority == DialogGuiActionPriority.Values.Secondary) <= 1) - .WithMessage("Only one secondary GUI action is allowed.") + .WithMessage("Only one secondary GUI action is allowed.") .Must(x => x .EmptyIfNull() .Count(x => x.Priority == DialogGuiActionPriority.Values.Tertiary) <= 5) - .WithMessage("Only five tertiary GUI actions are allowed.") + .WithMessage("Only five tertiary GUI actions are allowed.") .UniqueBy(x => x.Id) .ForEach(x => x.SetValidator(guiActionValidator)); @@ -104,6 +104,9 @@ public UpdateDialogDtoValidator( .UniqueBy(x => x.Id); RuleForEach(x => x.Activities) .SetValidator(activityValidator); + + RuleFor(x => x) + .Must(x => x.Process is null || Uri.IsWellFormedUriString(x.Process, UriKind.Absolute)).WithMessage("Process must be a valid absolute URI."); } } 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 3172d59e2..3d3ec3a68 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 @@ -42,6 +42,8 @@ public sealed class UpdateDialogDto /// 2022-12-31T23:59:59Z public DateTimeOffset? DueAt { get; set; } + + public string? Process { get; set; } /// /// The expiration date for the dialog. This is the last date when the dialog is available for the end user. /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs index 7ee1465c7..42c168262 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs @@ -57,6 +57,10 @@ public sealed class GetDialogDto /// public int? Progress { get; set; } + public string? Process { get; set; } + + public string? PrecedingProcess { get; set; } + /// /// Arbitrary string with a service-specific indicator of status, typically used to indicate a fine-grained state of /// the dialog to further specify the "status" enum. diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs index c4c582ac5..4a19634bd 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs @@ -46,6 +46,10 @@ public class SearchDialogDtoBase /// public int? Progress { get; set; } + public string? Process { get; set; } + + public string? PrecedingProcess { get; set; } + /// /// The number of attachments in the dialog made available for browser-based frontends. /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs index 8b72e17e7..5a0ae9503 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs @@ -89,6 +89,11 @@ public sealed class SearchDialogQuery : SortablePaginationParameter public DateTimeOffset? VisibleBefore { get; init; } + /// + /// Filter by process + /// + public string? Process { get; init; } + /// /// Search string for free text search. Will attempt to fuzzily match in all free text fields in the aggregate /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQueryValidator.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQueryValidator.cs index 44af73157..4720f726f 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQueryValidator.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQueryValidator.cs @@ -51,5 +51,9 @@ public SearchDialogQueryValidator() .When(x => x.ExtendedStatus is not null); RuleForEach(x => x.Status).IsInEnum(); + + RuleFor(x => x) + .Must(x => x.Process is null || Uri.IsWellFormedUriString(x.Process, UriKind.Absolute)) + .WithMessage($"{nameof(SearchDialogQuery.Process)} must be a valid URI"); } } diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs index e5ce07ea8..d86ad7ab4 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs @@ -1,4 +1,5 @@ -using Digdir.Domain.Dialogporten.Domain.Actors; +using System.Diagnostics; +using Digdir.Domain.Dialogporten.Domain.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities; @@ -37,6 +38,10 @@ public class DialogEntity : public DateTimeOffset? DueAt { get; set; } public DateTimeOffset? ExpiresAt { get; set; } + public string? Process { get; set; } + + public string? PrecedingProcess { get; set; } + // === Dependent relationships === public DialogStatus.Values StatusId { get; set; } public DialogStatus Status { get; set; } = null!; @@ -68,7 +73,7 @@ public class DialogEntity : public List SeenLog { get; set; } = []; public void OnCreate(AggregateNode self, DateTimeOffset utcNow) - => _domainEvents.Add(new DialogCreatedDomainEvent(Id, ServiceResource, Party)); + => _domainEvents.Add(new DialogCreatedDomainEvent(Id, ServiceResource, Party, Process, PrecedingProcess)); public void OnUpdate(AggregateNode self, DateTimeOffset utcNow) { @@ -80,12 +85,12 @@ x.Entity is not DialogSearchTag && var shouldProduceEvent = self.IsDirectlyModified() || changedChildren.Any(); if (shouldProduceEvent) { - _domainEvents.Add(new DialogUpdatedDomainEvent(Id, ServiceResource, Party)); + _domainEvents.Add(new DialogUpdatedDomainEvent(Id, ServiceResource, Party, Process, PrecedingProcess)); } } public void OnDelete(AggregateNode self, DateTimeOffset utcNow) - => _domainEvents.Add(new DialogDeletedDomainEvent(Id, ServiceResource, Party)); + => _domainEvents.Add(new DialogDeletedDomainEvent(Id, ServiceResource, Party, Process, PrecedingProcess)); public void UpdateSeenAt(string endUserId, DialogUserType.Values userTypeId, string? endUserName) { @@ -112,7 +117,7 @@ public void UpdateSeenAt(string endUserId, DialogUserType.Values userTypeId, str } }); - _domainEvents.Add(new DialogSeenDomainEvent(Id, ServiceResource, Party)); + _domainEvents.Add(new DialogSeenDomainEvent(Id, ServiceResource, Party, Process, PrecedingProcess)); } private readonly List _domainEvents = []; diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs index 06483b28c..4b4682625 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs @@ -2,4 +2,4 @@ namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; -public sealed record DialogCreatedDomainEvent(Guid DialogId, string ServiceResource, string Party) : DomainEvent; +public sealed record DialogCreatedDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DomainEvent; diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs index da891fb40..f67ae54ac 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs @@ -5,5 +5,7 @@ namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; public sealed record DialogDeletedDomainEvent( Guid DialogId, string ServiceResource, - string Party) : + string Party, + string? Process, + string? PrecedingProcess) : DomainEvent; diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogSeenDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogSeenDomainEvent.cs index cb4597d6c..440543be3 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogSeenDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogSeenDomainEvent.cs @@ -2,4 +2,4 @@ namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; -public sealed record DialogSeenDomainEvent(Guid DialogId, string ServiceResource, string Party) : DomainEvent; +public sealed record DialogSeenDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DomainEvent; diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogUpdatedDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogUpdatedDomainEvent.cs index 662fe2d5d..9cafa157b 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogUpdatedDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogUpdatedDomainEvent.cs @@ -2,4 +2,4 @@ namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; -public sealed record DialogUpdatedDomainEvent(Guid DialogId, string ServiceResource, string Party) : DomainEvent; +public sealed record DialogUpdatedDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DomainEvent; diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs index ec0417bbf..cbde48265 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs @@ -38,6 +38,8 @@ public sealed class Dialog public string ServiceResourceType { get; set; } = null!; public string Party { get; set; } = null!; public int? Progress { get; set; } + public string? Process { get; set; } + public string? PrecedingProcess { get; set; } public string? ExtendedStatus { get; set; } public string? ExternalReference { get; set; } public DateTimeOffset? VisibleFrom { get; set; } diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs index f7ceb071f..ed6d6dc50 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs @@ -35,6 +35,8 @@ public sealed class SearchDialog public string ServiceResourceType { get; set; } = null!; public string Party { get; set; } = null!; public int? Progress { get; set; } + public string? Process { get; set; } + public string? PrecedingProcess { get; set; } public int? GuiAttachmentCount { get; set; } public string? ExtendedStatus { get; set; } public DateTimeOffset CreatedAt { get; set; } diff --git a/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Configurations/Dialogs/DialogEntityConfiguration.cs b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Configurations/Dialogs/DialogEntityConfiguration.cs index db456e3bd..c93a26c41 100644 --- a/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Configurations/Dialogs/DialogEntityConfiguration.cs +++ b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Configurations/Dialogs/DialogEntityConfiguration.cs @@ -21,5 +21,6 @@ public void Configure(EntityTypeBuilder builder) builder.HasIndex(x => x.Org); builder.HasIndex(x => x.ServiceResource); builder.HasIndex(x => x.Party); + builder.HasIndex(x => x.Process); } } diff --git a/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240904114609_AddProcess.Designer.cs b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240904114609_AddProcess.Designer.cs new file mode 100644 index 000000000..aa766926a --- /dev/null +++ b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240904114609_AddProcess.Designer.cs @@ -0,0 +1,1793 @@ +// +using System; +using Digdir.Domain.Dialogporten.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Digdir.Domain.Dialogporten.Infrastructure.Persistence.Migrations +{ + [DbContext(typeof(DialogDbContext))] + [Migration("20240904114609_AddProcess")] + partial class AddProcess + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Actors.Actor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("ActorId") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ActorName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ActorTypeId") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.HasKey("Id"); + + b.HasIndex("ActorTypeId"); + + b.ToTable("Actor"); + + b.HasDiscriminator().HasValue("Actor"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Actors.ActorType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.ToTable("ActorType"); + + b.HasData( + new + { + Id = 1, + Name = "PartyRepresentative" + }, + new + { + Id = 2, + Name = "ServiceOwner" + }); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Attachments.Attachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.HasKey("Id"); + + b.ToTable("Attachment"); + + b.HasDiscriminator().HasValue("Attachment"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Attachments.AttachmentUrl", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("AttachmentId") + .HasColumnType("uuid"); + + b.Property("ConsumerTypeId") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("MediaType") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(1023) + .HasColumnType("character varying(1023)"); + + b.HasKey("Id"); + + b.HasIndex("AttachmentId"); + + b.HasIndex("ConsumerTypeId"); + + b.ToTable("AttachmentUrl"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Attachments.AttachmentUrlConsumerType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.ToTable("AttachmentUrlConsumerType"); + + b.HasData( + new + { + Id = 1, + Name = "Gui" + }, + new + { + Id = 2, + Name = "Api" + }); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogApiAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("Action") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("AuthorizationAttribute") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("DialogId") + .HasColumnType("uuid"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.HasKey("Id"); + + b.HasIndex("DialogId"); + + b.ToTable("DialogApiAction"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogApiActionEndpoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("ActionId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("Deprecated") + .HasColumnType("boolean"); + + b.Property("DocumentationUrl") + .HasMaxLength(1023) + .HasColumnType("character varying(1023)"); + + b.Property("HttpMethodId") + .HasColumnType("integer"); + + b.Property("RequestSchema") + .HasMaxLength(1023) + .HasColumnType("character varying(1023)"); + + b.Property("ResponseSchema") + .HasMaxLength(1023) + .HasColumnType("character varying(1023)"); + + b.Property("SunsetAt") + .HasColumnType("timestamp with time zone"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(1023) + .HasColumnType("character varying(1023)"); + + b.Property("Version") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.HasIndex("ActionId"); + + b.HasIndex("HttpMethodId"); + + b.ToTable("DialogApiActionEndpoint"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("Action") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("AuthorizationAttribute") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("DialogId") + .HasColumnType("uuid"); + + b.Property("HttpMethodId") + .HasColumnType("integer"); + + b.Property("IsDeleteDialogAction") + .HasColumnType("boolean"); + + b.Property("PriorityId") + .HasColumnType("integer"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(1023) + .HasColumnType("character varying(1023)"); + + b.HasKey("Id"); + + b.HasIndex("DialogId"); + + b.HasIndex("HttpMethodId"); + + b.HasIndex("PriorityId"); + + b.ToTable("DialogGuiAction"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiActionPriority", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.ToTable("DialogGuiActionPriority"); + + b.HasData( + new + { + Id = 1, + Name = "Primary" + }, + new + { + Id = 2, + Name = "Secondary" + }, + new + { + Id = 3, + Name = "Tertiary" + }); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("DialogId") + .HasColumnType("uuid"); + + b.Property("ExtendedType") + .HasMaxLength(1023) + .HasColumnType("character varying(1023)"); + + b.Property("RelatedActivityId") + .HasColumnType("uuid"); + + b.Property("TransmissionId") + .HasColumnType("uuid"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("DialogId"); + + b.HasIndex("RelatedActivityId"); + + b.HasIndex("TransmissionId"); + + b.HasIndex("TypeId"); + + b.ToTable("DialogActivity"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivityType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.ToTable("DialogActivityType"); + + b.HasData( + new + { + Id = 1, + Name = "DialogCreated" + }, + new + { + Id = 2, + Name = "DialogClosed" + }, + new + { + Id = 3, + Name = "Information" + }, + new + { + Id = 4, + Name = "TransmissionOpened" + }, + new + { + Id = 5, + Name = "PaymentMade" + }, + new + { + Id = 6, + Name = "SignatureProvided" + }); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Contents.DialogContent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("DialogId") + .HasColumnType("uuid"); + + b.Property("MediaType") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.HasIndex("DialogId", "TypeId") + .IsUnique(); + + b.ToTable("DialogContent"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Contents.DialogContentType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("AllowedMediaTypes") + .IsRequired() + .HasColumnType("text[]"); + + b.Property("MaxLength") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("OutputInList") + .HasColumnType("boolean"); + + b.Property("Required") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.ToTable("DialogContentType"); + + b.HasData( + new + { + Id = 1, + AllowedMediaTypes = new[] { "text/plain" }, + MaxLength = 255, + Name = "Title", + OutputInList = true, + Required = true + }, + new + { + Id = 2, + AllowedMediaTypes = new[] { "text/plain" }, + MaxLength = 255, + Name = "SenderName", + OutputInList = true, + Required = false + }, + new + { + Id = 3, + AllowedMediaTypes = new[] { "text/plain" }, + MaxLength = 255, + Name = "Summary", + OutputInList = true, + Required = true + }, + new + { + Id = 4, + AllowedMediaTypes = new[] { "text/html", "text/plain", "text/markdown" }, + MaxLength = 1023, + Name = "AdditionalInfo", + OutputInList = false, + Required = false + }, + new + { + Id = 5, + AllowedMediaTypes = new[] { "text/plain" }, + MaxLength = 20, + Name = "ExtendedStatus", + OutputInList = true, + Required = false + }, + new + { + Id = 6, + AllowedMediaTypes = new[] { "application/vnd.dialogporten.frontchannelembed+json;type=markdown" }, + MaxLength = 1023, + Name = "MainContentReference", + OutputInList = false, + Required = false + }); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("Deleted") + .HasColumnType("boolean"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DueAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ExtendedStatus") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ExternalReference") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Org") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .UseCollation("C"); + + b.Property("Party") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .UseCollation("C"); + + b.Property("PrecedingProcess") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Process") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Progress") + .HasColumnType("integer"); + + b.Property("Revision") + .IsConcurrencyToken() + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("ServiceResource") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .UseCollation("C"); + + b.Property("ServiceResourceType") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("StatusId") + .HasColumnType("integer"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("VisibleFrom") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedAt"); + + b.HasIndex("DueAt"); + + b.HasIndex("Org"); + + b.HasIndex("Party"); + + b.HasIndex("Process"); + + b.HasIndex("ServiceResource"); + + b.HasIndex("StatusId"); + + b.HasIndex("UpdatedAt"); + + b.ToTable("Dialog", (string)null); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSearchTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("DialogId") + .HasColumnType("uuid"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(63) + .HasColumnType("character varying(63)"); + + b.HasKey("Id"); + + b.HasIndex("DialogId", "Value") + .IsUnique(); + + b.ToTable("DialogSearchTag"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSeenLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("DialogId") + .HasColumnType("uuid"); + + b.Property("EndUserTypeId") + .HasColumnType("integer"); + + b.Property("IsViaServiceOwner") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("DialogId"); + + b.HasIndex("EndUserTypeId"); + + b.ToTable("DialogSeenLog"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogStatus", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.ToTable("DialogStatus"); + + b.HasData( + new + { + Id = 1, + Name = "New" + }, + new + { + Id = 2, + Name = "InProgress" + }, + new + { + Id = 3, + Name = "Signing" + }, + new + { + Id = 4, + Name = "Processing" + }, + new + { + Id = 5, + Name = "RequiresAttention" + }, + new + { + Id = 6, + Name = "Completed" + }); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogUserType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.ToTable("DialogUserType"); + + b.HasData( + new + { + Id = 0, + Name = "Unknown" + }, + new + { + Id = 1, + Name = "Person" + }, + new + { + Id = 2, + Name = "LegacySystemUser" + }, + new + { + Id = 3, + Name = "SystemUser" + }, + new + { + Id = 4, + Name = "ServiceOwner" + }, + new + { + Id = 5, + Name = "ServiceOwnerOnBehalfOfPerson" + }); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("MediaType") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("TransmissionId") + .HasColumnType("uuid"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.HasIndex("TransmissionId", "TypeId") + .IsUnique(); + + b.ToTable("DialogTransmissionContent"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContentType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("AllowedMediaTypes") + .IsRequired() + .HasColumnType("text[]"); + + b.Property("MaxLength") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Required") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.ToTable("DialogTransmissionContentType"); + + b.HasData( + new + { + Id = 1, + AllowedMediaTypes = new[] { "text/plain" }, + MaxLength = 255, + Name = "Title", + Required = true + }, + new + { + Id = 2, + AllowedMediaTypes = new[] { "text/plain" }, + MaxLength = 255, + Name = "Summary", + Required = true + }); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("AuthorizationAttribute") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("DialogId") + .HasColumnType("uuid"); + + b.Property("ExtendedType") + .HasMaxLength(1023) + .HasColumnType("character varying(1023)"); + + b.Property("RelatedTransmissionId") + .HasColumnType("uuid"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("DialogId"); + + b.HasIndex("RelatedTransmissionId"); + + b.HasIndex("TypeId"); + + b.ToTable("DialogTransmission"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmissionType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.ToTable("DialogTransmissionType"); + + b.HasData( + new + { + Id = 1, + Name = "Information" + }, + new + { + Id = 2, + Name = "Acceptance" + }, + new + { + Id = 3, + Name = "Rejection" + }, + new + { + Id = 4, + Name = "Request" + }, + new + { + Id = 5, + Name = "Alert" + }, + new + { + Id = 6, + Name = "Decision" + }, + new + { + Id = 7, + Name = "Submission" + }, + new + { + Id = 8, + Name = "Correction" + }); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Http.HttpVerb", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.ToTable("HttpVerb"); + + b.HasData( + new + { + Id = 1, + Name = "GET" + }, + new + { + Id = 2, + Name = "POST" + }, + new + { + Id = 3, + Name = "PUT" + }, + new + { + Id = 4, + Name = "PATCH" + }, + new + { + Id = 5, + Name = "DELETE" + }, + new + { + Id = 6, + Name = "HEAD" + }, + new + { + Id = 7, + Name = "OPTIONS" + }, + new + { + Id = 8, + Name = "TRACE" + }, + new + { + Id = 9, + Name = "CONNECT" + }); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Localizations.Localization", b => + { + b.Property("LocalizationSetId") + .HasColumnType("uuid"); + + b.Property("LanguageCode") + .HasMaxLength(15) + .HasColumnType("character varying(15)"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(4095) + .HasColumnType("character varying(4095)"); + + b.HasKey("LocalizationSetId", "LanguageCode"); + + b.ToTable("Localization"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Localizations.LocalizationSet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("Id"); + + b.ToTable("LocalizationSet"); + + b.HasDiscriminator().HasValue("LocalizationSet"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Outboxes.OutboxMessage", b => + { + b.Property("EventId") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CorrelationId") + .IsRequired() + .ValueGeneratedOnAdd() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasDefaultValueSql("gen_random_uuid()"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("current_timestamp at time zone 'utc'"); + + b.Property("EventPayload") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("EventType") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("EventId"); + + b.ToTable("OutboxMessage"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Outboxes.OutboxMessageConsumer", b => + { + b.Property("EventId") + .HasColumnType("uuid"); + + b.Property("ConsumerName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.HasKey("EventId", "ConsumerName"); + + b.ToTable("OutboxMessageConsumer"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivityPerformedByActor", b => + { + b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Actors.Actor"); + + b.Property("ActivityId") + .HasColumnType("uuid"); + + b.HasIndex("ActivityId") + .IsUnique(); + + b.HasDiscriminator().HasValue("DialogActivityPerformedByActor"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSeenLogSeenByActor", b => + { + b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Actors.Actor"); + + b.Property("DialogSeenLogId") + .HasColumnType("uuid"); + + b.HasIndex("DialogSeenLogId") + .IsUnique(); + + b.HasDiscriminator().HasValue("DialogSeenLogSeenByActor"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmissionSenderActor", b => + { + b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Actors.Actor"); + + b.Property("TransmissionId") + .HasColumnType("uuid"); + + b.HasIndex("TransmissionId") + .IsUnique(); + + b.HasDiscriminator().HasValue("DialogTransmissionSenderActor"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogAttachment", b => + { + b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Attachments.Attachment"); + + b.Property("DialogId") + .HasColumnType("uuid"); + + b.HasIndex("DialogId"); + + b.HasDiscriminator().HasValue("DialogAttachment"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmissionAttachment", b => + { + b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Attachments.Attachment"); + + b.Property("TransmissionId") + .HasColumnType("uuid"); + + b.HasIndex("TransmissionId"); + + b.HasDiscriminator().HasValue("DialogTransmissionAttachment"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Attachments.AttachmentDisplayName", b => + { + b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Localizations.LocalizationSet"); + + b.Property("AttachmentId") + .HasColumnType("uuid"); + + b.HasIndex("AttachmentId") + .IsUnique(); + + b.HasDiscriminator().HasValue("AttachmentDisplayName"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiActionPrompt", b => + { + b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Localizations.LocalizationSet"); + + b.Property("GuiActionId") + .HasColumnType("uuid"); + + b.HasIndex("GuiActionId") + .IsUnique(); + + b.ToTable("LocalizationSet", t => + { + t.Property("GuiActionId") + .HasColumnName("DialogGuiActionPrompt_GuiActionId"); + }); + + b.HasDiscriminator().HasValue("DialogGuiActionPrompt"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiActionTitle", b => + { + b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Localizations.LocalizationSet"); + + b.Property("GuiActionId") + .HasColumnType("uuid"); + + b.HasIndex("GuiActionId") + .IsUnique(); + + b.HasDiscriminator().HasValue("DialogGuiActionTitle"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivityDescription", b => + { + b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Localizations.LocalizationSet"); + + b.Property("ActivityId") + .HasColumnType("uuid"); + + b.HasIndex("ActivityId") + .IsUnique(); + + b.HasDiscriminator().HasValue("DialogActivityDescription"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Contents.DialogContentValue", b => + { + b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Localizations.LocalizationSet"); + + b.Property("DialogContentId") + .HasColumnType("uuid"); + + b.HasIndex("DialogContentId") + .IsUnique(); + + b.HasDiscriminator().HasValue("DialogContentValue"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContentValue", b => + { + b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Localizations.LocalizationSet"); + + b.Property("TransmissionContentId") + .HasColumnType("uuid"); + + b.HasIndex("TransmissionContentId") + .IsUnique(); + + b.HasDiscriminator().HasValue("DialogTransmissionContentValue"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Actors.Actor", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Actors.ActorType", "ActorType") + .WithMany() + .HasForeignKey("ActorTypeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ActorType"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Attachments.AttachmentUrl", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Attachments.Attachment", "Attachment") + .WithMany("Urls") + .HasForeignKey("AttachmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Digdir.Domain.Dialogporten.Domain.Attachments.AttachmentUrlConsumerType", "ConsumerType") + .WithMany() + .HasForeignKey("ConsumerTypeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Attachment"); + + b.Navigation("ConsumerType"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogApiAction", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", "Dialog") + .WithMany("ApiActions") + .HasForeignKey("DialogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Dialog"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogApiActionEndpoint", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogApiAction", "Action") + .WithMany("Endpoints") + .HasForeignKey("ActionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Digdir.Domain.Dialogporten.Domain.Http.HttpVerb", "HttpMethod") + .WithMany() + .HasForeignKey("HttpMethodId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Action"); + + b.Navigation("HttpMethod"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiAction", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", "Dialog") + .WithMany("GuiActions") + .HasForeignKey("DialogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Digdir.Domain.Dialogporten.Domain.Http.HttpVerb", "HttpMethod") + .WithMany() + .HasForeignKey("HttpMethodId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiActionPriority", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Dialog"); + + b.Navigation("HttpMethod"); + + b.Navigation("Priority"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivity", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", "Dialog") + .WithMany("Activities") + .HasForeignKey("DialogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivity", "RelatedActivity") + .WithMany("RelatedActivities") + .HasForeignKey("RelatedActivityId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmission", "Transmission") + .WithMany("Activities") + .HasForeignKey("TransmissionId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivityType", "Type") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Dialog"); + + b.Navigation("RelatedActivity"); + + b.Navigation("Transmission"); + + b.Navigation("Type"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Contents.DialogContent", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", "Dialog") + .WithMany("Content") + .HasForeignKey("DialogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Contents.DialogContentType", "Type") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Dialog"); + + b.Navigation("Type"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSearchTag", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", "Dialog") + .WithMany("SearchTags") + .HasForeignKey("DialogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Dialog"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSeenLog", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", "Dialog") + .WithMany("SeenLog") + .HasForeignKey("DialogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogUserType", "EndUserType") + .WithMany() + .HasForeignKey("EndUserTypeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Dialog"); + + b.Navigation("EndUserType"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContent", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmission", "Transmission") + .WithMany("Content") + .HasForeignKey("TransmissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContentType", "Type") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Transmission"); + + b.Navigation("Type"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmission", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", "Dialog") + .WithMany("Transmissions") + .HasForeignKey("DialogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmission", "RelatedTransmission") + .WithMany("RelatedTransmissions") + .HasForeignKey("RelatedTransmissionId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmissionType", "Type") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Dialog"); + + b.Navigation("RelatedTransmission"); + + b.Navigation("Type"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Localizations.Localization", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Localizations.LocalizationSet", "LocalizationSet") + .WithMany("Localizations") + .HasForeignKey("LocalizationSetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LocalizationSet"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Outboxes.OutboxMessageConsumer", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Outboxes.OutboxMessage", "OutboxMessage") + .WithMany("OutboxMessageConsumers") + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OutboxMessage"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivityPerformedByActor", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivity", "Activity") + .WithOne("PerformedBy") + .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivityPerformedByActor", "ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Activity"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSeenLogSeenByActor", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSeenLog", "DialogSeenLog") + .WithOne("SeenBy") + .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSeenLogSeenByActor", "DialogSeenLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DialogSeenLog"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmissionSenderActor", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmission", "Transmission") + .WithOne("Sender") + .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmissionSenderActor", "TransmissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Transmission"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogAttachment", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", "Dialog") + .WithMany("Attachments") + .HasForeignKey("DialogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Dialog"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmissionAttachment", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmission", "Transmission") + .WithMany("Attachments") + .HasForeignKey("TransmissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Transmission"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Attachments.AttachmentDisplayName", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Attachments.Attachment", "Attachment") + .WithOne("DisplayName") + .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Attachments.AttachmentDisplayName", "AttachmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Attachment"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiActionPrompt", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiAction", "GuiAction") + .WithOne("Prompt") + .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiActionPrompt", "GuiActionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GuiAction"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiActionTitle", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiAction", "GuiAction") + .WithOne("Title") + .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiActionTitle", "GuiActionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GuiAction"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivityDescription", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivity", "Activity") + .WithOne("Description") + .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivityDescription", "ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Activity"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Contents.DialogContentValue", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Contents.DialogContent", "DialogContent") + .WithOne("Value") + .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Contents.DialogContentValue", "DialogContentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DialogContent"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContentValue", b => + { + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContent", "TransmissionContent") + .WithOne("Value") + .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContentValue", "TransmissionContentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TransmissionContent"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Attachments.Attachment", b => + { + b.Navigation("DisplayName"); + + b.Navigation("Urls"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogApiAction", b => + { + b.Navigation("Endpoints"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiAction", b => + { + b.Navigation("Prompt"); + + b.Navigation("Title"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivity", b => + { + b.Navigation("Description"); + + b.Navigation("PerformedBy") + .IsRequired(); + + b.Navigation("RelatedActivities"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Contents.DialogContent", b => + { + b.Navigation("Value") + .IsRequired(); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", b => + { + b.Navigation("Activities"); + + b.Navigation("ApiActions"); + + b.Navigation("Attachments"); + + b.Navigation("Content"); + + b.Navigation("GuiActions"); + + b.Navigation("SearchTags"); + + b.Navigation("SeenLog"); + + b.Navigation("Transmissions"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSeenLog", b => + { + b.Navigation("SeenBy") + .IsRequired(); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContent", b => + { + b.Navigation("Value") + .IsRequired(); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmission", b => + { + b.Navigation("Activities"); + + b.Navigation("Attachments"); + + b.Navigation("Content"); + + b.Navigation("RelatedTransmissions"); + + b.Navigation("Sender") + .IsRequired(); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Localizations.LocalizationSet", b => + { + b.Navigation("Localizations"); + }); + + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Outboxes.OutboxMessage", b => + { + b.Navigation("OutboxMessageConsumers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240904114609_AddProcess.cs b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240904114609_AddProcess.cs new file mode 100644 index 000000000..c32cd4a4e --- /dev/null +++ b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240904114609_AddProcess.cs @@ -0,0 +1,49 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Digdir.Domain.Dialogporten.Infrastructure.Persistence.Migrations +{ + /// + public partial class AddProcess : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "PrecedingProcess", + table: "Dialog", + type: "character varying(255)", + maxLength: 255, + nullable: true); + + migrationBuilder.AddColumn( + name: "Process", + table: "Dialog", + type: "character varying(255)", + maxLength: 255, + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Dialog_Process", + table: "Dialog", + column: "Process"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_Dialog_Process", + table: "Dialog"); + + migrationBuilder.DropColumn( + name: "PrecedingProcess", + table: "Dialog"); + + migrationBuilder.DropColumn( + name: "Process", + table: "Dialog"); + } + } +} diff --git a/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs index ce8d9c51b..69b8b36dc 100644 --- a/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs +++ b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") + .HasAnnotation("ProductVersion", "8.0.8") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -59,14 +59,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ActorTypeId"); - b.ToTable("Actor", (string)null); + b.ToTable("Actor"); b.HasDiscriminator().HasValue("Actor"); b.UseTphMappingStrategy(); }); - modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Actors.DialogActorType", b => + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Actors.ActorType", b => { b.Property("Id") .HasColumnType("integer"); @@ -78,7 +78,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("ActorType", (string)null); + b.ToTable("ActorType"); b.HasData( new @@ -117,7 +117,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("Attachment", (string)null); + b.ToTable("Attachment"); b.HasDiscriminator().HasValue("Attachment"); @@ -162,7 +162,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ConsumerTypeId"); - b.ToTable("AttachmentUrl", (string)null); + b.ToTable("AttachmentUrl"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Attachments.AttachmentUrlConsumerType", b => @@ -177,7 +177,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("AttachmentUrlConsumerType", (string)null); + b.ToTable("AttachmentUrlConsumerType"); b.HasData( new @@ -225,7 +225,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("DialogId"); - b.ToTable("DialogApiAction", (string)null); + b.ToTable("DialogApiAction"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogApiActionEndpoint", b => @@ -284,7 +284,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("HttpMethodId"); - b.ToTable("DialogApiActionEndpoint", (string)null); + b.ToTable("DialogApiActionEndpoint"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiAction", b => @@ -338,7 +338,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("PriorityId"); - b.ToTable("DialogGuiAction", (string)null); + b.ToTable("DialogGuiAction"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogGuiActionPriority", b => @@ -353,7 +353,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("DialogGuiActionPriority", (string)null); + b.ToTable("DialogGuiActionPriority"); b.HasData( new @@ -411,7 +411,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("TypeId"); - b.ToTable("DialogActivity", (string)null); + b.ToTable("DialogActivity"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivityType", b => @@ -426,7 +426,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("DialogActivityType", (string)null); + b.ToTable("DialogActivityType"); b.HasData( new @@ -496,7 +496,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("DialogId", "TypeId") .IsUnique(); - b.ToTable("DialogContent", (string)null); + b.ToTable("DialogContent"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Contents.DialogContentType", b => @@ -524,7 +524,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("DialogContentType", (string)null); + b.ToTable("DialogContentType"); b.HasData( new @@ -627,6 +627,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(255)") .UseCollation("C"); + b.Property("PrecedingProcess") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Process") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + b.Property("Progress") .HasColumnType("integer"); @@ -668,6 +676,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("Party"); + b.HasIndex("Process"); + b.HasIndex("ServiceResource"); b.HasIndex("StatusId"); @@ -702,7 +712,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("DialogId", "Value") .IsUnique(); - b.ToTable("DialogSearchTag", (string)null); + b.ToTable("DialogSearchTag"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSeenLog", b => @@ -732,7 +742,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("EndUserTypeId"); - b.ToTable("DialogSeenLog", (string)null); + b.ToTable("DialogSeenLog"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogStatus", b => @@ -747,7 +757,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("DialogStatus", (string)null); + b.ToTable("DialogStatus"); b.HasData( new @@ -794,7 +804,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("DialogUserType", (string)null); + b.ToTable("DialogUserType"); b.HasData( new @@ -829,7 +839,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); - modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.TransmissionContent", b => + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContent", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -864,10 +874,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("TransmissionId", "TypeId") .IsUnique(); - b.ToTable("DialogTransmissionContent", (string)null); + b.ToTable("DialogTransmissionContent"); }); - modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.TransmissionContentType", b => + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContentType", b => { b.Property("Id") .HasColumnType("integer"); @@ -889,7 +899,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("DialogTransmissionContentType", (string)null); + b.ToTable("DialogTransmissionContentType"); b.HasData( new @@ -947,7 +957,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("TypeId"); - b.ToTable("DialogTransmission", (string)null); + b.ToTable("DialogTransmission"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmissionType", b => @@ -962,7 +972,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("DialogTransmissionType", (string)null); + b.ToTable("DialogTransmissionType"); b.HasData( new @@ -1019,7 +1029,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("HttpVerb", (string)null); + b.ToTable("HttpVerb"); b.HasData( new @@ -1095,7 +1105,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("LocalizationSetId", "LanguageCode"); - b.ToTable("Localization", (string)null); + b.ToTable("Localization"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Localizations.LocalizationSet", b => @@ -1117,7 +1127,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("LocalizationSet", (string)null); + b.ToTable("LocalizationSet"); b.HasDiscriminator().HasValue("LocalizationSet"); @@ -1153,7 +1163,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("EventId"); - b.ToTable("OutboxMessage", (string)null); + b.ToTable("OutboxMessage"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Outboxes.OutboxMessageConsumer", b => @@ -1167,7 +1177,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("EventId", "ConsumerName"); - b.ToTable("OutboxMessageConsumer", (string)null); + b.ToTable("OutboxMessageConsumer"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivityPerformedByActor", b => @@ -1256,7 +1266,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("GuiActionId") .IsUnique(); - b.ToTable("LocalizationSet", null, t => + b.ToTable("LocalizationSet", t => { t.Property("GuiActionId") .HasColumnName("DialogGuiActionPrompt_GuiActionId"); @@ -1319,7 +1329,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Actors.Actor", b => { - b.HasOne("Digdir.Domain.Dialogporten.Domain.Actors.DialogActorType", "ActorType") + b.HasOne("Digdir.Domain.Dialogporten.Domain.Actors.ActorType", "ActorType") .WithMany() .HasForeignKey("ActorTypeId") .OnDelete(DeleteBehavior.Restrict) @@ -1497,7 +1507,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("EndUserType"); }); - modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.TransmissionContent", b => + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContent", b => { b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.DialogTransmission", "Transmission") .WithMany("Content") @@ -1505,7 +1515,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.TransmissionContentType", "Type") + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContentType", "Type") .WithMany() .HasForeignKey("TypeId") .OnDelete(DeleteBehavior.Restrict) @@ -1676,7 +1686,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContentValue", b => { - b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.TransmissionContent", "TransmissionContent") + b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContent", "TransmissionContent") .WithOne("Value") .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContentValue", "TransmissionContentId") .OnDelete(DeleteBehavior.Cascade) @@ -1745,7 +1755,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); - modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.TransmissionContent", b => + modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions.Contents.DialogTransmissionContent", b => { b.Navigation("Value") .IsRequired(); diff --git a/src/Digdir.Domain.Dialogporten.WebApi/appsettings.Development.json b/src/Digdir.Domain.Dialogporten.WebApi/appsettings.Development.json index 204b90984..c5d6961db 100644 --- a/src/Digdir.Domain.Dialogporten.WebApi/appsettings.Development.json +++ b/src/Digdir.Domain.Dialogporten.WebApi/appsettings.Development.json @@ -67,15 +67,15 @@ } }, "LocalDevelopment": { - "UseLocalDevelopmentUser": true, - "UseLocalDevelopmentResourceRegister": true, - "UseLocalDevelopmentOrganizationRegister": true, - "UseLocalDevelopmentNameRegister": true, - "UseLocalDevelopmentAltinnAuthorization": true, + "UseLocalDevelopmentUser": false, + "UseLocalDevelopmentResourceRegister": false, + "UseLocalDevelopmentOrganizationRegister": false, + "UseLocalDevelopmentNameRegister": false, + "UseLocalDevelopmentAltinnAuthorization": false, "UseLocalDevelopmentCloudEventBus": true, - "UseLocalDevelopmentCompactJwsGenerator": true, + "UseLocalDevelopmentCompactJwsGenerator": false, "DisableShortCircuitOutboxDispatcher": true, "DisableCache": false, - "DisableAuth": true + "DisableAuth": false } } diff --git a/tests/k6/common/dialog.js b/tests/k6/common/dialog.js index c051e731c..130f036c5 100644 --- a/tests/k6/common/dialog.js +++ b/tests/k6/common/dialog.js @@ -83,6 +83,12 @@ export function setParty(dialog, party) { dialog.party = party; } +export function setProcess(dialog, process) { + if (!isValidURI(process)) { + throw new Error("Invalid process provided. " + process); + } + setContent(dialog, "Process", process); +} export function setDueAt(dialog, dueAt) { if (dueAt == null) { delete dialog.dueAt; diff --git a/tests/k6/common/testimports.js b/tests/k6/common/testimports.js index 40b05e4bc..64914fba1 100644 --- a/tests/k6/common/testimports.js +++ b/tests/k6/common/testimports.js @@ -24,5 +24,6 @@ export { setParty, setDueAt, setExpiresAt, - setVisibleFrom + setVisibleFrom, + setProcess } from './dialog.js'; diff --git a/tests/k6/tests/enduser/dialogSearch.js b/tests/k6/tests/enduser/dialogSearch.js index 7d38702a7..5088e6715 100644 --- a/tests/k6/tests/enduser/dialogSearch.js +++ b/tests/k6/tests/enduser/dialogSearch.js @@ -14,6 +14,7 @@ import { setDueAt, setExpiresAt, setVisibleFrom, + setProcess, postSO, putSO, purgeSO } from '../../common/testimports.js' @@ -26,6 +27,7 @@ export default function () { let dialogIds = []; let titleToSearchFor = uuidv4(); + let processToSearchFor = "urn:test:process:1" let additionalInfoToSearchFor = uuidv4(); let searchTagsToSearchFor = [ uuidv4(), uuidv4() ]; let extendedStatusToSearchFor = "status:" + uuidv4(); @@ -48,6 +50,7 @@ export default function () { for (let i = 0; i < 15; i++) { let d = dialogToInsert(); setTitle(d, "e2e-test-dialog eu #" + (i+1), "nn_NO"); + setProcess(d, "urn:test:process:" + (i+1)); setParty(d, defaultParty); setVisibleFrom(d, null); dialogs.push(d); @@ -191,7 +194,20 @@ export default function () { expect(r.json(), 'response json').to.have.property("items").with.lengthOf(1); expect(r.json().items[0], 'party').to.have.property("serviceResource").that.equals(auxResource); }); - + + describe('List with invalid process filter', () => { + let r = getEU('dialogs/' + defaultFilter + '&process=.,.'); + expectStatusFor(r).to.equal(400); + expect(r, 'response').to.have.validJsonBody(); + }) + + describe('List with process filter', () => { + let r = getEU('dialogs/' + defaultFilter + '&process=' + processToSearchFor ); + expectStatusFor(r).to.equal(200); + expect(r, 'response').to.have.validJsonBody(); + expect(r.json(), 'response json').to.have.property("items").with.lengthOf(1); + expect(r.json().items[0], 'process').to.have.property("process").that.equals(processToSearchFor); + }) /* Disabled for now. Dialogporten doesn't have proper TTD handling as of yet. From 159f3fb1d567e805a8a5f6e2bc5edb04c3ee2e48 Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Fri, 6 Sep 2024 10:07:07 +0200 Subject: [PATCH 02/30] setProcess va broken, i fix --- tests/k6/common/dialog.js | 3 +- tests/k6/tests/enduser/dialogSearch.js | 57 +++++++++++++++----------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/tests/k6/common/dialog.js b/tests/k6/common/dialog.js index 130f036c5..53c72fab2 100644 --- a/tests/k6/common/dialog.js +++ b/tests/k6/common/dialog.js @@ -87,7 +87,8 @@ export function setProcess(dialog, process) { if (!isValidURI(process)) { throw new Error("Invalid process provided. " + process); } - setContent(dialog, "Process", process); + // setContent(dialog, "Process", process); + dialog.process = process; } export function setDueAt(dialog, dueAt) { if (dueAt == null) { diff --git a/tests/k6/tests/enduser/dialogSearch.js b/tests/k6/tests/enduser/dialogSearch.js index 5088e6715..a1b0d460a 100644 --- a/tests/k6/tests/enduser/dialogSearch.js +++ b/tests/k6/tests/enduser/dialogSearch.js @@ -17,10 +17,12 @@ import { setProcess, postSO, putSO, - purgeSO } from '../../common/testimports.js' + purgeSO +} from '../../common/testimports.js' + +import {default as dialogToInsert} from '../serviceowner/testdata/01-create-dialog.js'; +import {getDefaultEnduserOrgNo, getDefaultEnduserSsn} from '../../common/token.js'; -import { default as dialogToInsert } from '../serviceowner/testdata/01-create-dialog.js'; -import { getDefaultEnduserOrgNo, getDefaultEnduserSsn } from '../../common/token.js'; export default function () { let dialogs = []; @@ -29,7 +31,7 @@ export default function () { let titleToSearchFor = uuidv4(); let processToSearchFor = "urn:test:process:1" let additionalInfoToSearchFor = uuidv4(); - let searchTagsToSearchFor = [ uuidv4(), uuidv4() ]; + let searchTagsToSearchFor = [uuidv4(), uuidv4()]; let extendedStatusToSearchFor = "status:" + uuidv4(); let secondExtendedStatusToSearchFor = "status:" + uuidv4(); let senderNameToSearchFor = uuidv4() @@ -46,13 +48,16 @@ export default function () { let auxOrg = "ttd"; describe('Arrange: Create some dialogs to test against', () => { - + console.log(setProcess.name); for (let i = 0; i < 15; i++) { let d = dialogToInsert(); - setTitle(d, "e2e-test-dialog eu #" + (i+1), "nn_NO"); - setProcess(d, "urn:test:process:" + (i+1)); + setTitle(d, "e2e-test-dialog eu #" + (i + 1), "nn_NO"); + + setProcess(d, ("urn:test:process:" + (i + 1))); setParty(d, defaultParty); setVisibleFrom(d, null); + console.log("Process skal vare her!"); + console.log(d.process); dialogs.push(d); } @@ -77,18 +82,18 @@ export default function () { dialogs[++d].id = idForCustomOrg; - setTitle(dialogs[dialogs.length-1], titleForLastItem); + setTitle(dialogs[dialogs.length - 1], titleForLastItem); let tokenOptions = {}; dialogs.forEach((d) => { - tokenOptions = (d.id == idForCustomOrg) ? { orgName: auxOrg } : {}; + tokenOptions = (d.id == idForCustomOrg) ? {orgName: auxOrg} : {}; let r = postSO("dialogs", d, null, tokenOptions); expectStatusFor(r).to.equal(201); dialogIds.push(r.json()); }); - let penultimateDialog = dialogs[dialogs.length-2]; - let penultimateDialogId = dialogIds[dialogIds.length-2]; + let penultimateDialog = dialogs[dialogs.length - 2]; + let penultimateDialogId = dialogIds[dialogIds.length - 2]; setTitle(penultimateDialog, titleForUpdatedItem); let r = putSO("dialogs/" + penultimateDialogId, penultimateDialog); expectStatusFor(r).to.equal(204); @@ -194,20 +199,24 @@ export default function () { expect(r.json(), 'response json').to.have.property("items").with.lengthOf(1); expect(r.json().items[0], 'party').to.have.property("serviceResource").that.equals(auxResource); }); - + describe('List with invalid process filter', () => { - let r = getEU('dialogs/' + defaultFilter + '&process=.,.'); - expectStatusFor(r).to.equal(400); - expect(r, 'response').to.have.validJsonBody(); - }) - - describe('List with process filter', () => { - let r = getEU('dialogs/' + defaultFilter + '&process=' + processToSearchFor ); - expectStatusFor(r).to.equal(200); - expect(r, 'response').to.have.validJsonBody(); - expect(r.json(), 'response json').to.have.property("items").with.lengthOf(1); - expect(r.json().items[0], 'process').to.have.property("process").that.equals(processToSearchFor); - }) + let r = getEU('dialogs/' + defaultFilter + '&process=.,.'); + expectStatusFor(r).to.equal(400); + expect(r, 'response').to.have.validJsonBody(); + }) + + describe('List with process filter', () => { + let r = getEU('dialogs/' + defaultFilter + '&process=' + 'urn:test:process:1'); + // let r = getEU('dialogs/' + defaultFilter ); + expectStatusFor(r).to.equal(200); + expect(r, 'response').to.have.validJsonBody(); + console.log(r.json()); + console.log(dialogs.length) + console.log("FREDIK"); + expect(r.json(), 'response json').to.have.property("items").with.lengthOf(1); + expect(r.json().items[0], 'process').to.have.property("process").that.equals(processToSearchFor); + }) /* Disabled for now. Dialogporten doesn't have proper TTD handling as of yet. From 490d351ddabe5e45e84a6fae1e048523eab2365b Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Fri, 6 Sep 2024 10:18:58 +0200 Subject: [PATCH 03/30] endUser e2e complete? --- tests/k6/tests/enduser/dialogSearch.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/k6/tests/enduser/dialogSearch.js b/tests/k6/tests/enduser/dialogSearch.js index a1b0d460a..b5b7b96e9 100644 --- a/tests/k6/tests/enduser/dialogSearch.js +++ b/tests/k6/tests/enduser/dialogSearch.js @@ -204,10 +204,12 @@ export default function () { let r = getEU('dialogs/' + defaultFilter + '&process=.,.'); expectStatusFor(r).to.equal(400); expect(r, 'response').to.have.validJsonBody(); + expect(r.json(), 'response json').to.have.property("errors"); + expect(r.json().errors[""], 'errors').with.lengthOf(1); }) describe('List with process filter', () => { - let r = getEU('dialogs/' + defaultFilter + '&process=' + 'urn:test:process:1'); + let r = getEU('dialogs/' + defaultFilter + '&process=' + processToSearchFor); // let r = getEU('dialogs/' + defaultFilter ); expectStatusFor(r).to.equal(200); expect(r, 'response').to.have.validJsonBody(); From df982cae98121dd0d45f8c385e576164321cecde Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Fri, 6 Sep 2024 10:44:30 +0200 Subject: [PATCH 04/30] serviceowner search process, Query param added. e2e made --- .../Queries/Search/SearchDialogQuery.cs | 1 + tests/k6/tests/serviceowner/dialogSearch.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs index 5a0ae9503..bcb3250c0 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs @@ -162,6 +162,7 @@ public async Task Handle(SearchDialogQuery request, Cancella .WhereIf(request.UpdatedBefore.HasValue, x => x.UpdatedAt <= request.UpdatedBefore) .WhereIf(request.DueAfter.HasValue, x => request.DueAfter <= x.DueAt) .WhereIf(request.DueBefore.HasValue, x => x.DueAt <= request.DueBefore) + .WhereIf(request.Process is not null, x => x.Process == request.Process) .WhereIf(request.VisibleAfter.HasValue, x => request.VisibleAfter <= x.VisibleFrom) .WhereIf(request.VisibleBefore.HasValue, x => x.VisibleFrom <= request.VisibleBefore) .WhereIf(request.Search is not null, x => diff --git a/tests/k6/tests/serviceowner/dialogSearch.js b/tests/k6/tests/serviceowner/dialogSearch.js index e99176784..40e4e7da0 100644 --- a/tests/k6/tests/serviceowner/dialogSearch.js +++ b/tests/k6/tests/serviceowner/dialogSearch.js @@ -12,6 +12,7 @@ import { setServiceResource, setParty, setDueAt, + setProcess, setExpiresAt, setVisibleFrom, postSO, @@ -28,6 +29,7 @@ export default function () { let dialogIds = []; let titleToSearchFor = uuidv4(); + let processToSeachFor = "urn:test:process:1"; let additionalInfoToSearchFor = uuidv4(); let searchTagsToSearchFor = [ uuidv4(), uuidv4() ]; let extendedStatusToSearchFor = "status:" + uuidv4(); @@ -47,6 +49,7 @@ export default function () { for (let i = 0; i < 20; i++) { let d = dialogToInsert(); setTitle(d, "e2e-test-dialog #" + (i+1), "nn_NO"); + setProcess(d, "urn:test:process:" + (i+1)) dialogs.push(d); } @@ -173,7 +176,23 @@ export default function () { expect(r.json(), 'response json').to.have.property("items").with.lengthOf(1); expect(r.json().items[0], 'party').to.have.property("serviceResource").that.equals(auxResource); }); + + describe('List with invalid process', () => { + let r = getSO('dialogs/?CreatedAfter=' + createdAfter + '&process=.,.'); + expectStatusFor(r).to.equal(400); + expect(r, 'response').to.have.validJsonBody(); + expect(r.json(), 'response json').to.have.property("errors"); + expect(r.json().errors["'"], 'errors').with.lengthOf(1); + }) + describe('List with process', () => { + let r = getSO('dialogs/?CreatedAfter=' + createdAfter + '&process=' + processToSeachFor); + expectStatusFor(r).to.equal(200); + expect(r, 'response').to.have.validJsonBody(); + expect(r.json(), 'response json').to.have.property("items").with.lengthOf(1); + // expect(r.json().process).to.equal(processToSeachFor); + expect(r.json().items[0], 'process').to.have.property("process").that.equals(processToSeachFor); + }) describe("Cleanup", () => { dialogIds.forEach((d) => { let r = purgeSO("dialogs/" + d); From 643aeef0f9152aab19b9031a61fb91714d09083c Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Fri, 6 Sep 2024 12:20:13 +0200 Subject: [PATCH 05/30] =?UTF-8?q?Process=20og=20PrecedingProcess=20i=20dat?= =?UTF-8?q?a=20p=C3=A5=20evnets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DialogActivityEventToAltinnForwarder.cs | 8 ++++++ .../Events/DialogEventToAltinnForwarder.cs | 26 ++++++++++++++++--- .../Entities/Activities/DialogActivity.cs | 2 +- .../DialogActivityCreatedDomainEvent.cs | 2 ++ .../Events/DialogCreatedDomainEvent.cs | 2 +- .../Events/DialogDeletedDomainEvent.cs | 3 +-- .../Dialogs/Events/DialogDomainEventBase.cs | 7 +++++ .../Dialogs/Events/DialogSeenDomainEvent.cs | 2 +- .../Events/DialogUpdatedDomainEvent.cs | 2 +- 9 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDomainEventBase.cs diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogActivityEventToAltinnForwarder.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogActivityEventToAltinnForwarder.cs index 30d117822..d2573e4eb 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogActivityEventToAltinnForwarder.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogActivityEventToAltinnForwarder.cs @@ -45,6 +45,14 @@ private static Dictionary GetCloudEventData(DialogActivityCreate data["relatedActivityId"] = domainEvent.RelatedActivityId.ToString()!; } + if (domainEvent.Process is not null) + { + data["process"] = domainEvent.Process; + } + if (domainEvent.PrecedingProcess is not null) + { + data["precedingProcess"] = domainEvent.PrecedingProcess; + } return data; } } diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogEventToAltinnForwarder.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogEventToAltinnForwarder.cs index e1c640daf..fda303d38 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogEventToAltinnForwarder.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogEventToAltinnForwarder.cs @@ -24,7 +24,8 @@ public async Task Handle(DialogCreatedDomainEvent domainEvent, CancellationToken Resource = domainEvent.ServiceResource, ResourceInstance = domainEvent.DialogId.ToString(), Subject = domainEvent.Party, - Source = $"{SourceBaseUrl()}{domainEvent.DialogId}" + Source = $"{SourceBaseUrl()}{domainEvent.DialogId}", + Data = GetCloudEventData(domainEvent) }; await CloudEventBus.Publish(cloudEvent, cancellationToken); } @@ -39,7 +40,8 @@ public async Task Handle(DialogUpdatedDomainEvent domainEvent, CancellationToken Resource = domainEvent.ServiceResource, ResourceInstance = domainEvent.DialogId.ToString(), Subject = domainEvent.Party, - Source = $"{SourceBaseUrl()}{domainEvent.DialogId}" + Source = $"{SourceBaseUrl()}{domainEvent.DialogId}", + Data = GetCloudEventData(domainEvent) }; await CloudEventBus.Publish(cloudEvent, cancellationToken); @@ -55,7 +57,8 @@ public async Task Handle(DialogSeenDomainEvent domainEvent, CancellationToken ca Resource = domainEvent.ServiceResource, ResourceInstance = domainEvent.DialogId.ToString(), Subject = domainEvent.Party, - Source = $"{SourceBaseUrl()}{domainEvent.DialogId}" + Source = $"{SourceBaseUrl()}{domainEvent.DialogId}", + Data = GetCloudEventData(domainEvent) }; await CloudEventBus.Publish(cloudEvent, cancellationToken); @@ -71,9 +74,24 @@ public async Task Handle(DialogDeletedDomainEvent domainEvent, CancellationToken Resource = domainEvent.ServiceResource, ResourceInstance = domainEvent.DialogId.ToString(), Subject = domainEvent.Party, - Source = $"{SourceBaseUrl()}{domainEvent.DialogId}" + Source = $"{SourceBaseUrl()}{domainEvent.DialogId}", + Data = GetCloudEventData(domainEvent) }; await CloudEventBus.Publish(cloudEvent, cancellationToken); } + + private static Dictionary? GetCloudEventData(DialogDomainEventBase domainEvent) + { + var data = new Dictionary(); + if (domainEvent.Process is not null) + { + data["process"] = domainEvent.Process; + } + if (domainEvent.PrecedingProcess is not null) + { + data["precedingProcess"] = domainEvent.PrecedingProcess; + } + return data; + } } diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Activities/DialogActivity.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Activities/DialogActivity.cs index b8cf688d6..1f045e314 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Activities/DialogActivity.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Activities/DialogActivity.cs @@ -40,7 +40,7 @@ public void OnCreate(AggregateNode self, DateTimeOffset utcNow) { _domainEvents.Add(new DialogActivityCreatedDomainEvent( DialogId, Id, TypeId, Dialog.Party, - Dialog.ServiceResource, ExtendedType, + Dialog.ServiceResource, Dialog.Process, Dialog.PrecedingProcess, ExtendedType, RelatedActivityId)); } diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/Activities/DialogActivityCreatedDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/Activities/DialogActivityCreatedDomainEvent.cs index 359fc2050..97eee2b81 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/Activities/DialogActivityCreatedDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/Activities/DialogActivityCreatedDomainEvent.cs @@ -9,5 +9,7 @@ public sealed record DialogActivityCreatedDomainEvent( DialogActivityType.Values TypeId, string Party, string ServiceResource, + string? Process, + string? PrecedingProcess, Uri? ExtendedType, Guid? RelatedActivityId) : DomainEvent; diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs index 4b4682625..033b68009 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs @@ -2,4 +2,4 @@ namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; -public sealed record DialogCreatedDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DomainEvent; +public sealed record DialogCreatedDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DialogDomainEventBase(Process, PrecedingProcess); diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs index f67ae54ac..960a18b3c 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs @@ -7,5 +7,4 @@ public sealed record DialogDeletedDomainEvent( string ServiceResource, string Party, string? Process, - string? PrecedingProcess) : - DomainEvent; + string? PrecedingProcess) : DialogDomainEventBase(Process, PrecedingProcess); diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDomainEventBase.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDomainEventBase.cs new file mode 100644 index 000000000..f65fd5084 --- /dev/null +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDomainEventBase.cs @@ -0,0 +1,7 @@ +using Digdir.Domain.Dialogporten.Domain.Common; + +namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; + +public record DialogDomainEventBase( + string? Process, + string? PrecedingProcess) : DomainEvent; diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogSeenDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogSeenDomainEvent.cs index 440543be3..6568e2fa3 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogSeenDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogSeenDomainEvent.cs @@ -2,4 +2,4 @@ namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; -public sealed record DialogSeenDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DomainEvent; +public sealed record DialogSeenDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DialogDomainEventBase(Process, PrecedingProcess); diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogUpdatedDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogUpdatedDomainEvent.cs index 9cafa157b..fc6a77fdb 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogUpdatedDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogUpdatedDomainEvent.cs @@ -2,4 +2,4 @@ namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; -public sealed record DialogUpdatedDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DomainEvent; +public sealed record DialogUpdatedDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DialogDomainEventBase(Process, PrecedingProcess); From 854c8be1ab46efa28b89d5b6025cabd4c808c48c Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Fri, 6 Sep 2024 14:37:48 +0200 Subject: [PATCH 06/30] Added process to DialogGenerator --- .../Events/DialogEventToAltinnForwarder.cs | 2 +- .../DialogGenerator.cs | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogEventToAltinnForwarder.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogEventToAltinnForwarder.cs index fda303d38..4612591be 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogEventToAltinnForwarder.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogEventToAltinnForwarder.cs @@ -92,6 +92,6 @@ public async Task Handle(DialogDeletedDomainEvent domainEvent, CancellationToken { data["precedingProcess"] = domainEvent.PrecedingProcess; } - return data; + return data.Count == 0 ? null : data; } } diff --git a/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs b/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs index a1b8f3d7e..6e52f552b 100644 --- a/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs +++ b/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs @@ -28,6 +28,7 @@ public static CreateDialogCommand GenerateFakeDialog( DateTimeOffset? updatedAt = null, DateTimeOffset? dueAt = null, DateTimeOffset? expiresAt = null, + string? process = null, DialogStatus.Values? status = null, CreateDialogContentDto? content = null, List? searchTags = null, @@ -49,6 +50,7 @@ public static CreateDialogCommand GenerateFakeDialog( updatedAt, dueAt, expiresAt, + process, status, content, searchTags, @@ -72,6 +74,7 @@ public static List GenerateFakeDialogs( DateTimeOffset? updatedAt = null, DateTimeOffset? dueAt = null, DateTimeOffset? expiresAt = null, + string? process = null, DialogStatus.Values? status = null, CreateDialogContentDto? content = null, List? searchTags = null, @@ -99,6 +102,7 @@ public static List GenerateFakeDialogs( .RuleFor(o => o.GuiActions, _ => guiActions ?? GenerateFakeDialogGuiActions()) .RuleFor(o => o.ApiActions, _ => apiActions ?? GenerateFakeDialogApiActions()) .RuleFor(o => o.Activities, _ => activities ?? GenerateFakeDialogActivities()) + .RuleFor(o => o.Process, f => process ?? GenerateFakeProcessUri()) .Generate(count); } @@ -224,7 +228,11 @@ public static List GenerateFakeDialogActivities(i .RuleFor(o => o.CreatedAt, f => f.Date.Past()) .RuleFor(o => o.ExtendedType, f => new Uri(f.Internet.UrlWithPath())) .RuleFor(o => o.Type, f => type ?? f.PickRandom()) - .RuleFor(o => o.PerformedBy, f => new CreateDialogDialogActivityPerformedByActorDto { ActorType = ActorType.Values.PartyRepresentative, ActorName = f.Name.FullName() }) + .RuleFor(o => o.PerformedBy, f => new CreateDialogDialogActivityPerformedByActorDto + { + 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)); } @@ -250,6 +258,10 @@ public static List GenerateFakeDialogApi .Generate(new Randomizer().Number(min: 1, 4)); } + public static string GenerateFakeProcessUri() + { + return new Faker().Internet.UrlWithPath(); + } public static List GenerateFakeDialogGuiActions() { var hasPrimary = false; @@ -288,7 +300,8 @@ public static List GenerateFakeDialogAttachment .Generate(count ?? new Randomizer().Number(1, 6)); } - private static readonly string[] MediaTypes = [ + private static readonly string[] MediaTypes = + [ "application/json", "application/xml", "text/html", From 7983a14287098e238bdefcfc4e313b32090d84cc Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Fri, 6 Sep 2024 14:58:40 +0200 Subject: [PATCH 07/30] Added summary to dtos --- .../V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs | 6 ++++++ .../Dialogs/Queries/Search/SearchDialogDtoBase.cs | 6 ++++++ .../Commands/Create/CreateDialogCommandValidator.cs | 2 ++ .../Dialogs/Commands/Create/CreateDialogDto.cs | 8 ++++++++ .../Commands/Update/UpdateDialogCommandValidator.cs | 3 +++ .../Dialogs/Commands/Update/UpdateDialogDto.cs | 9 ++++++++- .../V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs | 6 ++++++ .../Dialogs/Queries/Search/SearchDialogDtoBase.cs | 6 ++++++ 8 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs index a509ec6ca..0d24847f9 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs @@ -57,8 +57,14 @@ public sealed class GetDialogDto /// public int? Progress { get; set; } + /// + /// Optional process identifier used to indicate a business process this dialog belongs to + /// public string? Process { get; set; } + /// + /// Optional preceding process identifier to indicate the business process that preceded the process indicated in the "Process" field. Cannot be set without also "Process" being set. + /// public string? PrecedingProcess { get; set; } /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs index 65e285a37..b236174bc 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs @@ -46,8 +46,14 @@ public class SearchDialogDtoBase /// public int? Progress { get; set; } + /// + /// Optional process identifier used to indicate a business process this dialog belongs to + /// public string? Process { get; set; } + /// + /// Optional preceding process identifier to indicate the business process that preceded the process indicated in the "Process" field. Cannot be set without also "Process" being set. + /// public string? PrecedingProcess { get; set; } /// 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 43d8065af..f90198bfa 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 @@ -122,6 +122,8 @@ public CreateDialogCommandValidator( RuleFor(x => x) .Must(x => x.Process is null || Uri.IsWellFormedUriString(x.Process, UriKind.Absolute)).WithMessage("Process must be a valid absolute URI."); + RuleFor(x => x) + .Must(x => x.PrecedingProcess is null || (x.Process is not null && Uri.IsWellFormedUriString(x.Process, UriKind.Absolute))).WithMessage("Process must be a valid absolute URI."); } } 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 51c2736bb..0aaaf1312 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 @@ -64,7 +64,15 @@ public class CreateDialogDto /// /// 2022-12-31T23:59:59Z public DateTimeOffset? DueAt { get; set; } + + /// + /// Optional process identifier used to indicate a business process this dialog belongs to + /// public string? Process { get; set; } + /// + /// Optional preceding process identifier to indicate the business process that preceded the process indicated in the "Process" field. Cannot be set without also "Process" being set. + /// + public string? PrecedingProcess { get; set; } /// /// The expiration date for the dialog. This is the last date when the dialog is available for the end user. 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 38ae320e3..bcc75bb01 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 @@ -107,6 +107,9 @@ public UpdateDialogDtoValidator( RuleFor(x => x) .Must(x => x.Process is null || Uri.IsWellFormedUriString(x.Process, UriKind.Absolute)).WithMessage("Process must be a valid absolute URI."); + + RuleFor(x => x) + .Must(x => x.PrecedingProcess is null || (x.Process is not null && Uri.IsWellFormedUriString(x.Process, UriKind.Absolute))).WithMessage("Process must be a valid absolute URI."); } } 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 3d3ec3a68..32ea17936 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 @@ -42,8 +42,15 @@ public sealed class UpdateDialogDto /// 2022-12-31T23:59:59Z public DateTimeOffset? DueAt { get; set; } - + /// + /// Optional process identifier used to indicate a business process this dialog belongs to + /// public string? Process { get; set; } + + /// + /// Optional preceding process identifier to indicate the business process that preceded the process indicated in the "Process" field. Cannot be set without also "Process" being set. + /// + public string? PrecedingProcess { get; set; } /// /// The expiration date for the dialog. This is the last date when the dialog is available for the end user. /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs index 42c168262..462129a65 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs @@ -57,8 +57,14 @@ public sealed class GetDialogDto /// public int? Progress { get; set; } + /// + /// Optional process identifier used to indicate a business process this dialog belongs to + /// public string? Process { get; set; } + /// + /// Optional preceding process identifier to indicate the business process that preceded the process indicated in the "Process" field. Cannot be set without also "Process" being set. + /// public string? PrecedingProcess { get; set; } /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs index 4a19634bd..38c0fa4cb 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs @@ -46,8 +46,14 @@ public class SearchDialogDtoBase /// public int? Progress { get; set; } + /// + /// Optional process identifier used to indicate a business process this dialog belongs to + /// public string? Process { get; set; } + /// + /// Optional preceding process identifier to indicate the business process that preceded the process indicated in the "Process" field. Cannot be set without also "Process" being set. + /// public string? PrecedingProcess { get; set; } /// From 2cd279f04914e2df36cb465badf25803bc42c5e9 Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Fri, 6 Sep 2024 17:24:36 +0200 Subject: [PATCH 08/30] e2e complete --- tests/k6/tests/enduser/dialogSearch.js | 8 -------- tests/k6/tests/serviceowner/all-tests.js | 2 ++ .../dialogCreateInvalidActionCount.js | 2 ++ .../serviceowner/dialogCreateInvalidProcess.js | 15 +++++++++++++++ tests/k6/tests/serviceowner/dialogSearch.js | 2 -- .../serviceowner/testdata/01-create-dialog.js | 1 + 6 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 tests/k6/tests/serviceowner/dialogCreateInvalidProcess.js diff --git a/tests/k6/tests/enduser/dialogSearch.js b/tests/k6/tests/enduser/dialogSearch.js index b5b7b96e9..7351fc152 100644 --- a/tests/k6/tests/enduser/dialogSearch.js +++ b/tests/k6/tests/enduser/dialogSearch.js @@ -48,16 +48,12 @@ export default function () { let auxOrg = "ttd"; describe('Arrange: Create some dialogs to test against', () => { - console.log(setProcess.name); for (let i = 0; i < 15; i++) { let d = dialogToInsert(); setTitle(d, "e2e-test-dialog eu #" + (i + 1), "nn_NO"); - setProcess(d, ("urn:test:process:" + (i + 1))); setParty(d, defaultParty); setVisibleFrom(d, null); - console.log("Process skal vare her!"); - console.log(d.process); dialogs.push(d); } @@ -210,12 +206,8 @@ export default function () { describe('List with process filter', () => { let r = getEU('dialogs/' + defaultFilter + '&process=' + processToSearchFor); - // let r = getEU('dialogs/' + defaultFilter ); expectStatusFor(r).to.equal(200); expect(r, 'response').to.have.validJsonBody(); - console.log(r.json()); - console.log(dialogs.length) - console.log("FREDIK"); expect(r.json(), 'response json').to.have.property("items").with.lengthOf(1); expect(r.json().items[0], 'process').to.have.property("process").that.equals(processToSearchFor); }) diff --git a/tests/k6/tests/serviceowner/all-tests.js b/tests/k6/tests/serviceowner/all-tests.js index 54d955943..df5c1d0b6 100644 --- a/tests/k6/tests/serviceowner/all-tests.js +++ b/tests/k6/tests/serviceowner/all-tests.js @@ -4,6 +4,7 @@ import { default as authorization } from './authorization.js'; import { default as concurrency } from './concurrency.js'; import { default as dialogCreateExternalResource } from './dialogCreateExternalResource.js'; import { default as dialogCreateInvalidActionCount } from './dialogCreateInvalidActionCount.js'; +import { default as dialogCreateInvalidProcess } from './dialogCreateInvalidProcess.js'; import { default as dialogCreatePatchDelete } from './dialogCreatePatchDelete.js'; import { default as dialogSearch } from './dialogSearch.js'; @@ -13,6 +14,7 @@ export default function() { concurrency(); dialogCreateExternalResource(); dialogCreateInvalidActionCount(); + dialogCreateInvalidProcess(); dialogCreatePatchDelete(); dialogSearch(); } diff --git a/tests/k6/tests/serviceowner/dialogCreateInvalidActionCount.js b/tests/k6/tests/serviceowner/dialogCreateInvalidActionCount.js index 5bf9217f8..e18ae24a6 100644 --- a/tests/k6/tests/serviceowner/dialogCreateInvalidActionCount.js +++ b/tests/k6/tests/serviceowner/dialogCreateInvalidActionCount.js @@ -23,6 +23,8 @@ export default function () { return dialog; }; + + describe('Attempt dialog create with two primary actions', () => { expectGuiActionErrorResponseForDialog(createDialogWithGuiActions(2, "primary")); diff --git a/tests/k6/tests/serviceowner/dialogCreateInvalidProcess.js b/tests/k6/tests/serviceowner/dialogCreateInvalidProcess.js new file mode 100644 index 000000000..bbf9f8598 --- /dev/null +++ b/tests/k6/tests/serviceowner/dialogCreateInvalidProcess.js @@ -0,0 +1,15 @@ +import { describe, expect, expectStatusFor, postSO } from '../../common/testimports.js' +import { default as dialogToInsert } from './testdata/01-create-dialog.js'; + + +export default function (){ + + describe ('Attempt to create dialog with invalid URI', () => { + let dialog = dialogToInsert(); + dialog.process = '.,.'; + let r = postSO('dialogs', dialog) + expectStatusFor(r).to.equal(400); + expect(r, 'response').to.have.validJsonBody(); + expect(r.json(), 'response body').to.have.property('errors'); + }) +} diff --git a/tests/k6/tests/serviceowner/dialogSearch.js b/tests/k6/tests/serviceowner/dialogSearch.js index 40e4e7da0..a1ba1f581 100644 --- a/tests/k6/tests/serviceowner/dialogSearch.js +++ b/tests/k6/tests/serviceowner/dialogSearch.js @@ -182,7 +182,6 @@ export default function () { expectStatusFor(r).to.equal(400); expect(r, 'response').to.have.validJsonBody(); expect(r.json(), 'response json').to.have.property("errors"); - expect(r.json().errors["'"], 'errors').with.lengthOf(1); }) describe('List with process', () => { @@ -190,7 +189,6 @@ export default function () { expectStatusFor(r).to.equal(200); expect(r, 'response').to.have.validJsonBody(); expect(r.json(), 'response json').to.have.property("items").with.lengthOf(1); - // expect(r.json().process).to.equal(processToSeachFor); expect(r.json().items[0], 'process').to.have.property("process").that.equals(processToSeachFor); }) describe("Cleanup", () => { diff --git a/tests/k6/tests/serviceowner/testdata/01-create-dialog.js b/tests/k6/tests/serviceowner/testdata/01-create-dialog.js index 72b0a96da..1c53a127e 100644 --- a/tests/k6/tests/serviceowner/testdata/01-create-dialog.js +++ b/tests/k6/tests/serviceowner/testdata/01-create-dialog.js @@ -10,6 +10,7 @@ export default function () { "dueAt": "2033-11-25T06:37:54.2920190Z", // must be UTC "expiresAt": "2053-11-25T06:37:54.2920190Z", // must be UTC "visibleFrom": "2032-11-25T06:37:54.2920190Z", // must be UTC + "process": "urn:test:process:1" "searchTags": [ { "value": "something searchable" }, { "value": "something else searchable" } From 0d60085e86f58f00768f5255dd6d4cc4da280ac4 Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Fri, 6 Sep 2024 18:57:18 +0200 Subject: [PATCH 09/30] Cleanup --- .../Dialogs/Entities/DialogEntity.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs index d86ad7ab4..f75195e28 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs @@ -1,5 +1,4 @@ -using System.Diagnostics; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Domain.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities; From 9977007b7d5bebecc89a983e63ca20af9d702e90 Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Fri, 6 Sep 2024 20:40:34 +0200 Subject: [PATCH 10/30] Fixed? --- docs/schema/V1/schema.verified.graphql | 4 ++++ docs/schema/V1/swagger.verified.json | 12 +++++++++++- .../Migrations/DialogDbContextModelSnapshot.cs | 12 +++++++++++- .../tests/serviceowner/testdata/01-create-dialog.js | 2 +- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/docs/schema/V1/schema.verified.graphql b/docs/schema/V1/schema.verified.graphql index 03547f70c..322994c9b 100644 --- a/docs/schema/V1/schema.verified.graphql +++ b/docs/schema/V1/schema.verified.graphql @@ -94,6 +94,8 @@ type Dialog { serviceResourceType: String! party: String! progress: Int + process: String + precedingProcess: String extendedStatus: String externalReference: String visibleFrom: DateTime @@ -167,6 +169,8 @@ type SearchDialog { serviceResourceType: String! party: String! progress: Int + process: String + precedingProcess: String guiAttachmentCount: Int extendedStatus: String createdAt: DateTime! diff --git a/docs/schema/V1/swagger.verified.json b/docs/schema/V1/swagger.verified.json index a0a17f9f0..094e6644d 100644 --- a/docs/schema/V1/swagger.verified.json +++ b/docs/schema/V1/swagger.verified.json @@ -225,6 +225,16 @@ "example": "urn:altinn:person:identifier-no:01125512345\nurn:altinn:organization:identifier-no:912345678", "type": "string" }, + "precedingProcess": { + "description": "Optional preceding process identifier to indicate the business process that preceded the process indicated in the \u0022Process\u0022 field. Cannot be set without also \u0022Process\u0022 being set.", + "nullable": true, + "type": "string" + }, + "process": { + "description": "Optional process identifier used to indicate a business process this dialog belongs to ", + "nullable": true, + "type": "string" + }, "progress": { "description": "Advisory indicator of progress, represented as 1-100 percentage value. 100% representing a dialog that has come\nto a natural completion (successful or not).", "format": "int32", @@ -6107,4 +6117,4 @@ "url": "https://altinn-dev-api.azure-api.net/dialogporten" } ] -} \ No newline at end of file +} diff --git a/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs index 5ae79c320..46f3807d8 100644 --- a/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs +++ b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs @@ -627,6 +627,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(255)") .UseCollation("C"); + b.Property("PrecedingProcess") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Process") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + b.Property("Progress") .HasColumnType("integer"); @@ -668,6 +676,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("Party"); + b.HasIndex("Process"); + b.HasIndex("ServiceResource"); b.HasIndex("StatusId"); @@ -1197,7 +1207,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("Resource", "Subject") .IsUnique(); - b.ToTable("SubjectResource", (string)null); + b.ToTable("SubjectResource"); }); modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities.DialogActivityPerformedByActor", b => diff --git a/tests/k6/tests/serviceowner/testdata/01-create-dialog.js b/tests/k6/tests/serviceowner/testdata/01-create-dialog.js index 1c53a127e..dffaad574 100644 --- a/tests/k6/tests/serviceowner/testdata/01-create-dialog.js +++ b/tests/k6/tests/serviceowner/testdata/01-create-dialog.js @@ -10,7 +10,7 @@ export default function () { "dueAt": "2033-11-25T06:37:54.2920190Z", // must be UTC "expiresAt": "2053-11-25T06:37:54.2920190Z", // must be UTC "visibleFrom": "2032-11-25T06:37:54.2920190Z", // must be UTC - "process": "urn:test:process:1" + "process": "urn:test:process:1", "searchTags": [ { "value": "something searchable" }, { "value": "something else searchable" } From 25b7dd94e673524dce8e606c88f55441c0964c5c Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Fri, 6 Sep 2024 20:44:16 +0200 Subject: [PATCH 11/30] Fixed swagger schema, maybe --- docs/schema/V1/swagger.verified.json | 69 ++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/docs/schema/V1/swagger.verified.json b/docs/schema/V1/swagger.verified.json index 094e6644d..efb3c63e4 100644 --- a/docs/schema/V1/swagger.verified.json +++ b/docs/schema/V1/swagger.verified.json @@ -2045,6 +2045,16 @@ "example": "urn:altinn:person:identifier-no:01125512345\nurn:altinn:organization:identifier-no:912345678", "type": "string" }, + "precedingProcess": { + "description": "Optional preceding process identifier to indicate the business process that preceded the process indicated in the \u0022Process\u0022 field. Cannot be set without also \u0022Process\u0022 being set.", + "nullable": true, + "type": "string" + }, + "process": { + "description": "Optional process identifier used to indicate a business process this dialog belongs to", + "nullable": true, + "type": "string" + }, "progress": { "description": "Advisory indicator of progress, represented as 1-100 percentage value. 100% representing a dialog that has come\nto a natural completion (successful or not).", "format": "int32", @@ -2188,6 +2198,16 @@ "example": "urn:altinn:person:identifier-no:01125512345\nurn:altinn:organization:identifier-no:912345678", "type": "string" }, + "precedingProcess": { + "description": "Optional preceding process identifier to indicate the business process that preceded the process indicated in the \u0022Process\u0022 field. Cannot be set without also \u0022Process\u0022 being set. ", + "nullable": true, + "type": "string" + }, + "process": { + "description": "Optional process identifier used to indicate a business process this dialog belongs to ", + "nullable": true, + "type": "string" + }, "progress": { "description": "Advisory indicator of progress, represented as 1-100 percentage value. 100% representing a dialog that has come\nto a natural completion (successful or not).", "format": "int32", @@ -3118,6 +3138,16 @@ "example": "urn:altinn:person:identifier-no:01125512345\nurn:altinn:organization:identifier-no:912345678", "type": "string" }, + "precedingProcess": { + "description": "Optional preceding process identifier to indicate the business process that preceded the process indicated in the \u0022Process\u0022 field. Cannot be set without also \u0022Process\u0022 being set. ", + "nullable": true, + "type": "string" + }, + "process": { + "description": "Optional process identifier used to indicate a business process this dialog belongs to ", + "nullable": true, + "type": "string" + }, "progress": { "description": "Advisory indicator of progress, represented as 1-100 percentage value. 100% representing a dialog that has come\nto a natural completion (successful or not).", "format": "int32", @@ -3217,6 +3247,16 @@ "example": "urn:altinn:person:identifier-no:01125512345\nurn:altinn:organization:identifier-no:912345678", "type": "string" }, + "precedingProcess": { + "description": "Optional preceding process identifier to indicate the business process that preceded the process indicated in the \u0022Process\u0022 field. Cannot be set without also \u0022Process\u0022 being set.", + "nullable": true, + "type": "string" + }, + "process": { + "description": "Optional process identifier used to indicate a business process this dialog belongs to", + "nullable": true, + "type": "string" + }, "progress": { "description": "Advisory indicator of progress, represented as 1-100 percentage value. 100% representing a dialog that has come\nto a natural completion (successful or not).", "format": "int32", @@ -3874,6 +3914,16 @@ }, "type": "array" }, + "precedingProcess": { + "description": "Optional preceding process identifier to indicate the business process that preceded the process indicated in the \u0022Process\u0022 field. Cannot be set without also \u0022Process\u0022 being set.", + "nullable": true, + "type": "string" + }, + "process": { + "description": "Optional process identifier used to indicate a business process this dialog belongs to", + "nullable": true, + "type": "string" + }, "progress": { "description": "Advisory indicator of progress, represented as 1-100 percentage value. 100% representing a dialog that has come\nto a natural completion (successful or not).", "format": "int32", @@ -4180,6 +4230,14 @@ "type": "string" } }, + { + "in": "query", + "name": "process", + "schema": { + "nullable": true, + "type": "string" + } + }, { "description": "Search string for free text search. Will attempt to fuzzily match in all free text fields in the aggregate", "in": "query", @@ -4831,6 +4889,15 @@ "type": "string" } }, + { + "description": "Filter by process", + "in": "query", + "name": "process", + "schema": { + "nullable": true, + "type": "string" + } + }, { "description": "Search string for free text search. Will attempt to fuzzily match in all free text fields in the aggregate", "in": "query", @@ -5353,6 +5420,8 @@ "Url": "https://example.com/some-url" } ], + "PrecedingProcess": null, + "Process": null, "Progress": 42, "SearchTags": [ { From a5a50c102b7b080d5f19fd36ed3a14cb997e4492 Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Sun, 8 Sep 2024 11:04:22 +0200 Subject: [PATCH 12/30] default settings --- .../appsettings.Development.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Digdir.Domain.Dialogporten.WebApi/appsettings.Development.json b/src/Digdir.Domain.Dialogporten.WebApi/appsettings.Development.json index c5d6961db..da6ce2e5e 100644 --- a/src/Digdir.Domain.Dialogporten.WebApi/appsettings.Development.json +++ b/src/Digdir.Domain.Dialogporten.WebApi/appsettings.Development.json @@ -67,15 +67,15 @@ } }, "LocalDevelopment": { - "UseLocalDevelopmentUser": false, - "UseLocalDevelopmentResourceRegister": false, - "UseLocalDevelopmentOrganizationRegister": false, - "UseLocalDevelopmentNameRegister": false, - "UseLocalDevelopmentAltinnAuthorization": false, + "UseLocalDevelopmentUser": true, + "UseLocalDevelopmentResourceRegister": true, + "UseLocalDevelopmentOrganizationRegister": true, + "UseLocalDevelopmentNameRegister": true, + "UseLocalDevelopmentAltinnAuthorization": true, "UseLocalDevelopmentCloudEventBus": true, - "UseLocalDevelopmentCompactJwsGenerator": false, + "UseLocalDevelopmentCompactJwsGenerator": true, "DisableShortCircuitOutboxDispatcher": true, - "DisableCache": false, - "DisableAuth": false + "DisableCache": true, + "DisableAuth": true } } From 0937f040e8c3cac05d9ca406eae1e7b8a86ba179 Mon Sep 17 00:00:00 2001 From: Amund Date: Sun, 8 Sep 2024 11:07:44 +0200 Subject: [PATCH 13/30] Update tests/k6/common/dialog.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ole Jørgen Skogstad --- tests/k6/common/dialog.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/k6/common/dialog.js b/tests/k6/common/dialog.js index 53c72fab2..8652044c7 100644 --- a/tests/k6/common/dialog.js +++ b/tests/k6/common/dialog.js @@ -87,7 +87,6 @@ export function setProcess(dialog, process) { if (!isValidURI(process)) { throw new Error("Invalid process provided. " + process); } - // setContent(dialog, "Process", process); dialog.process = process; } export function setDueAt(dialog, dueAt) { From f1d1cb821fd2a729a7607bb1872b1efdf934de10 Mon Sep 17 00:00:00 2001 From: Amund Date: Sun, 8 Sep 2024 11:08:07 +0200 Subject: [PATCH 14/30] Update src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ole Jørgen Skogstad --- src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs b/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs index 570d0f4d7..2951cda66 100644 --- a/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs +++ b/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs @@ -268,6 +268,7 @@ public static string GenerateFakeProcessUri() { return new Faker().Internet.UrlWithPath(); } + public static List GenerateFakeDialogGuiActions() { var hasPrimary = false; From 86e9372e64b25d6ab56bf3ad8b910cd566643a85 Mon Sep 17 00:00:00 2001 From: Amund Date: Sun, 8 Sep 2024 11:08:29 +0200 Subject: [PATCH 15/30] Update src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQueryValidator.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ole Jørgen Skogstad --- .../Dialogs/Queries/Search/SearchDialogQueryValidator.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQueryValidator.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQueryValidator.cs index 4720f726f..5d1fb11fb 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQueryValidator.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQueryValidator.cs @@ -52,8 +52,9 @@ public SearchDialogQueryValidator() RuleForEach(x => x.Status).IsInEnum(); - RuleFor(x => x) - .Must(x => x.Process is null || Uri.IsWellFormedUriString(x.Process, UriKind.Absolute)) - .WithMessage($"{nameof(SearchDialogQuery.Process)} must be a valid URI"); + RuleFor(x => x.Process) + .Must(x => Uri.IsWellFormedUriString(x, UriKind.Absolute)) + .WithMessage("{PropertyName} must be a valid URI") + .When(x => x.Process is not null); } } From 21c42170ce4774776eab88167c5eb096fd684d19 Mon Sep 17 00:00:00 2001 From: Amund Date: Sun, 8 Sep 2024 11:10:57 +0200 Subject: [PATCH 16/30] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ole Jørgen Skogstad --- .../Dialogs/Queries/Search/SearchDialogQuery.cs | 4 +++- .../Search/SearchDialogQueryValidator.cs | 7 ++++--- .../Create/CreateDialogCommandValidator.cs | 16 ++++++++++++---- .../Update/UpdateDialogCommandValidator.cs | 17 +++++++++++++---- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs index d181542d0..191f60c50 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs @@ -81,9 +81,11 @@ public sealed class SearchDialogQuery : SortablePaginationParameter public DateTimeOffset? DueBefore { get; init; } + /// + /// Filter by process + /// public string? Process { get; init; } - /// /// Search string for free text search. Will attempt to fuzzily match in all free text fields in the aggregate /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQueryValidator.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQueryValidator.cs index f8e1ae26b..a1ca2800d 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQueryValidator.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQueryValidator.cs @@ -44,9 +44,10 @@ public SearchDialogQueryValidator() .LessThanOrEqualTo(20) .When(x => x.ExtendedStatus is not null); - RuleFor(x => x) - .Must(x => x.Process is null || Uri.IsWellFormedUriString(x.Process, UriKind.Absolute)) - .WithMessage($"{nameof(SearchDialogQuery.Process)} must be a valid URI"); + RuleFor(x => x.Process) + .Must(x => Uri.IsWellFormedUriString(x, UriKind.Absolute)) + .WithMessage("{PropertyName} must be a valid URI") + .When(x => x.Process is not null); RuleForEach(x => x.Status).IsInEnum(); } 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 7294677e4..1182391af 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 @@ -119,12 +119,20 @@ public CreateDialogCommandValidator( dependentKeySelector: activity => activity.RelatedActivityId, principalKeySelector: activity => activity.Id) .SetValidator(activityValidator); + RuleFor(x => x.Process) + .Must(x => Uri.IsWellFormedUriString(x, UriKind.Absolute)) + .WithMessage("{PropertyName} must be a valid absolute URI.") + .When(x => x.Process is not null); + RuleFor(x => x.Process) + .NotEmpty() + .WithMessage(dto => $"{{PropertyName}} must not be empty when {nameof(dto.PrecedingProcess)} is set.") + .When(x => x.PrecedingProcess is not null); - RuleFor(x => x) - .Must(x => x.Process is null || Uri.IsWellFormedUriString(x.Process, UriKind.Absolute)).WithMessage("Process must be a valid absolute URI."); - RuleFor(x => x) - .Must(x => x.PrecedingProcess is null || (x.Process is not null && Uri.IsWellFormedUriString(x.Process, UriKind.Absolute))).WithMessage("Process must be a valid absolute URI."); + RuleFor(x => x.PrecedingProcess) + .Must(x => Uri.IsWellFormedUriString(x, UriKind.Absolute)) + .WithMessage("{PropertyName} must be a valid absolute URI.") + .When(x => x.PrecedingProcess is not null); } } 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 01f4bf9ad..13660f498 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 @@ -106,11 +106,20 @@ public UpdateDialogDtoValidator( RuleForEach(x => x.Activities) .SetValidator(activityValidator); - RuleFor(x => x) - .Must(x => x.Process is null || Uri.IsWellFormedUriString(x.Process, UriKind.Absolute)).WithMessage("Process must be a valid absolute URI."); + RuleFor(x => x.Process) + .Must(x => Uri.IsWellFormedUriString(x, UriKind.Absolute)) + .WithMessage("{PropertyName} must be a valid absolute URI.") + .When(x => x.Process is not null); - RuleFor(x => x) - .Must(x => x.PrecedingProcess is null || (x.Process is not null && Uri.IsWellFormedUriString(x.Process, UriKind.Absolute))).WithMessage("Process must be a valid absolute URI."); + RuleFor(x => x.Process) + .NotEmpty() + .WithMessage(dto => $"{{PropertyName}} must not be empty when {nameof(dto.PrecedingProcess)} is set.") + .When(x => x.PrecedingProcess is not null); + + RuleFor(x => x.PrecedingProcess) + .Must(x => Uri.IsWellFormedUriString(x, UriKind.Absolute)) + .WithMessage("{PropertyName} must be a valid absolute URI.") + .When(x => x.PrecedingProcess is not null); } } From be818f9a7ffabfa218b472877da340d271b1b62b Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Sun, 8 Sep 2024 11:13:34 +0200 Subject: [PATCH 17/30] Cleanup --- .../Dialogs/Commands/Create/CreateDialogCommandValidator.cs | 3 +-- .../Dialogs/Commands/Update/UpdateDialogCommand.cs | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) 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 1182391af..5acc0124d 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 @@ -1,5 +1,4 @@ -using System.Diagnostics; -using System.Reflection; +using System.Reflection; using Digdir.Domain.Dialogporten.Application.Common.Extensions.Enumerables; using Digdir.Domain.Dialogporten.Application.Common.Extensions.FluentValidation; using Digdir.Domain.Dialogporten.Application.Externals.Presentation; diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs index f95ddf07a..7ac9ca025 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs @@ -89,7 +89,6 @@ public async Task Handle(UpdateDialogCommand request, Cancel } // Update primitive properties - // Alle? inc string? _mapper.Map(request.Dto, dialog); ValidateTimeFields(dialog); From e69d2d1c7521d1f356904a12746f195787fa4b24 Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Sun, 8 Sep 2024 11:19:16 +0200 Subject: [PATCH 18/30] Swagger fixed again? --- docs/schema/V1/swagger.verified.json | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/schema/V1/swagger.verified.json b/docs/schema/V1/swagger.verified.json index efb3c63e4..4146271ac 100644 --- a/docs/schema/V1/swagger.verified.json +++ b/docs/schema/V1/swagger.verified.json @@ -4231,6 +4231,7 @@ } }, { + "description": "Filter by process", "in": "query", "name": "process", "schema": { From e20dbc5530433e9106a370094755f4f949308031 Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Mon, 9 Sep 2024 12:36:59 +0200 Subject: [PATCH 19/30] Fixed test --- tests/k6/tests/enduser/dialogSearch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/k6/tests/enduser/dialogSearch.js b/tests/k6/tests/enduser/dialogSearch.js index 7351fc152..c6b68b7d9 100644 --- a/tests/k6/tests/enduser/dialogSearch.js +++ b/tests/k6/tests/enduser/dialogSearch.js @@ -201,7 +201,7 @@ export default function () { expectStatusFor(r).to.equal(400); expect(r, 'response').to.have.validJsonBody(); expect(r.json(), 'response json').to.have.property("errors"); - expect(r.json().errors[""], 'errors').with.lengthOf(1); + expect(r.json().errors, 'errors').to.have.property("Process").with.lengthOf(1); }) describe('List with process filter', () => { From 2b17effd1f35623ab25e1a7efec229075651013c Mon Sep 17 00:00:00 2001 From: Amund Date: Mon, 9 Sep 2024 14:19:21 +0200 Subject: [PATCH 20/30] Apply suggestions from code review Co-authored-by: Magnus Sandgren <5285192+MagnusSandgren@users.noreply.github.com> --- .../Dialogs/Commands/Create/CreateDialogCommandValidator.cs | 2 +- .../Dialogs/Commands/Update/UpdateDialogCommandValidator.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 5acc0124d..ca76bf84f 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 @@ -125,7 +125,7 @@ public CreateDialogCommandValidator( RuleFor(x => x.Process) .NotEmpty() - .WithMessage(dto => $"{{PropertyName}} must not be empty when {nameof(dto.PrecedingProcess)} is set.") + .WithMessage($"{{PropertyName}} must not be empty when {nameof(CreateDialogCommand.PrecedingProcess)} is set.") .When(x => x.PrecedingProcess is not null); RuleFor(x => x.PrecedingProcess) 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 13660f498..9a0896525 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 @@ -113,7 +113,7 @@ public UpdateDialogDtoValidator( RuleFor(x => x.Process) .NotEmpty() - .WithMessage(dto => $"{{PropertyName}} must not be empty when {nameof(dto.PrecedingProcess)} is set.") + .WithMessage($"{{PropertyName}} must not be empty when {nameof(UpdateDialogCommand.PrecedingProcess)} is set.") .When(x => x.PrecedingProcess is not null); RuleFor(x => x.PrecedingProcess) From bf19212e66c758a300c4bff5ff746c550cb8d19b Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Mon, 9 Sep 2024 14:27:49 +0200 Subject: [PATCH 21/30] process search made case insensetive moved process and precedingProcess fields into interface for events --- .../V1/Common/Events/DialogEventToAltinnForwarder.cs | 2 +- .../V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs | 4 ++-- .../Dialogs/Queries/Search/SearchDialogQuery.cs | 2 +- .../Dialogs/Events/DialogCreatedDomainEvent.cs | 3 ++- .../Dialogs/Events/DialogDeletedDomainEvent.cs | 3 ++- .../Dialogs/Events/DialogDomainEventBase.cs | 7 ------- .../Dialogs/Events/DialogSeenDomainEvent.cs | 2 +- .../Dialogs/Events/DialogUpdatedDomainEvent.cs | 2 +- .../Dialogs/Events/IProcessEvent.cs | 7 +++++++ 9 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDomainEventBase.cs create mode 100644 src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/IProcessEvent.cs diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogEventToAltinnForwarder.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogEventToAltinnForwarder.cs index 4612591be..1843a3c69 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogEventToAltinnForwarder.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/DialogEventToAltinnForwarder.cs @@ -81,7 +81,7 @@ public async Task Handle(DialogDeletedDomainEvent domainEvent, CancellationToken await CloudEventBus.Publish(cloudEvent, cancellationToken); } - private static Dictionary? GetCloudEventData(DialogDomainEventBase domainEvent) + private static Dictionary? GetCloudEventData(IProcessEvent domainEvent) { var data = new Dictionary(); if (domainEvent.Process is not null) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs index 191f60c50..963c6b304 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs @@ -156,7 +156,7 @@ public async Task Handle(SearchDialogQuery request, Cancella .AsSingleQuery() .AsNoTracking() .Include(x => x.Content) - .ThenInclude(x => x.Value.Localizations) + .ThenInclude(x => x.Value.Localizations) .WhereIf(!request.Org.IsNullOrEmpty(), x => request.Org!.Contains(x.Org)) .WhereIf(!request.ServiceResource.IsNullOrEmpty(), x => request.ServiceResource!.Contains(x.ServiceResource)) .WhereIf(!request.Party.IsNullOrEmpty(), x => request.Party!.Contains(x.Party)) @@ -170,7 +170,7 @@ public async Task Handle(SearchDialogQuery request, Cancella .WhereIf(request.UpdatedBefore.HasValue, x => x.UpdatedAt <= request.UpdatedBefore) .WhereIf(request.DueAfter.HasValue, x => request.DueAfter <= x.DueAt) .WhereIf(request.DueBefore.HasValue, x => x.DueAt <= request.DueBefore) - .WhereIf(request.Process is not null, x => x.Process == request.Process) + .WhereIf(request.Process is not null, x => x.Process != null && EF.Functions.ILike(x.Process, request.Process!)) .WhereIf(request.Search is not null, x => x.Content.Any(x => x.Value.Localizations.AsQueryable().Any(searchExpression)) || x.SearchTags.Any(x => EF.Functions.ILike(x.Value, request.Search!)) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs index ba24629e5..a26146668 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs @@ -177,7 +177,7 @@ public async Task Handle(SearchDialogQuery request, Cancella .WhereIf(request.UpdatedBefore.HasValue, x => x.UpdatedAt <= request.UpdatedBefore) .WhereIf(request.DueAfter.HasValue, x => request.DueAfter <= x.DueAt) .WhereIf(request.DueBefore.HasValue, x => x.DueAt <= request.DueBefore) - .WhereIf(request.Process is not null, x => x.Process == request.Process) + .WhereIf(request.Process is not null, x => x.Process != null && EF.Functions.ILike(x.Process, request.Process!)) .WhereIf(request.VisibleAfter.HasValue, x => request.VisibleAfter <= x.VisibleFrom) .WhereIf(request.VisibleBefore.HasValue, x => x.VisibleFrom <= request.VisibleBefore) .WhereIf(request.Search is not null, x => diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs index 033b68009..7389bb821 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs @@ -1,5 +1,6 @@ using Digdir.Domain.Dialogporten.Domain.Common; +using Digdir.Library.Entity.Abstractions.Features.EventPublisher; namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; -public sealed record DialogCreatedDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DialogDomainEventBase(Process, PrecedingProcess); +public sealed record DialogCreatedDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DomainEvent, IProcessEvent; diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs index 960a18b3c..f08e95f50 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs @@ -1,4 +1,5 @@ using Digdir.Domain.Dialogporten.Domain.Common; +using Digdir.Library.Entity.Abstractions.Features.EventPublisher; namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; @@ -7,4 +8,4 @@ public sealed record DialogDeletedDomainEvent( string ServiceResource, string Party, string? Process, - string? PrecedingProcess) : DialogDomainEventBase(Process, PrecedingProcess); + string? PrecedingProcess) : DomainEvent, IProcessEvent; diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDomainEventBase.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDomainEventBase.cs deleted file mode 100644 index f65fd5084..000000000 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDomainEventBase.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Digdir.Domain.Dialogporten.Domain.Common; - -namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; - -public record DialogDomainEventBase( - string? Process, - string? PrecedingProcess) : DomainEvent; diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogSeenDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogSeenDomainEvent.cs index 6568e2fa3..10407e15f 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogSeenDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogSeenDomainEvent.cs @@ -2,4 +2,4 @@ namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; -public sealed record DialogSeenDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DialogDomainEventBase(Process, PrecedingProcess); +public sealed record DialogSeenDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DomainEvent, IProcessEvent; diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogUpdatedDomainEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogUpdatedDomainEvent.cs index fc6a77fdb..04447ab55 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogUpdatedDomainEvent.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogUpdatedDomainEvent.cs @@ -2,4 +2,4 @@ namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; -public sealed record DialogUpdatedDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DialogDomainEventBase(Process, PrecedingProcess); +public sealed record DialogUpdatedDomainEvent(Guid DialogId, string ServiceResource, string Party, string? Process, string? PrecedingProcess) : DomainEvent, IProcessEvent; diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/IProcessEvent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/IProcessEvent.cs new file mode 100644 index 000000000..70f74ae15 --- /dev/null +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/IProcessEvent.cs @@ -0,0 +1,7 @@ +namespace Digdir.Domain.Dialogporten.Domain.Dialogs.Events; + +public interface IProcessEvent +{ + string? Process { get; } + string? PrecedingProcess { get; } +} From c72fa3a367071ab6f4bae69a0d13d750c3a0bb9a Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Mon, 9 Sep 2024 14:33:50 +0200 Subject: [PATCH 22/30] fix --- .../Dialogs/Commands/Update/UpdateDialogCommandValidator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9a0896525..a8b5d4624 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 @@ -113,7 +113,7 @@ public UpdateDialogDtoValidator( RuleFor(x => x.Process) .NotEmpty() - .WithMessage($"{{PropertyName}} must not be empty when {nameof(UpdateDialogCommand.PrecedingProcess)} is set.") + .WithMessage($"{{PropertyName}} must not be empty when {nameof(UpdateDialogDto.PrecedingProcess)} is set.") .When(x => x.PrecedingProcess is not null); RuleFor(x => x.PrecedingProcess) From fba74d3bb181b3145883296277a681252758ba4d Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Mon, 9 Sep 2024 15:01:27 +0200 Subject: [PATCH 23/30] Update test? --- tests/k6/common/dialog.js | 2 +- tests/k6/tests/enduser/dialogSearch.js | 2 +- tests/k6/tests/serviceowner/dialogSearch.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/k6/common/dialog.js b/tests/k6/common/dialog.js index 8652044c7..c3f7b5c17 100644 --- a/tests/k6/common/dialog.js +++ b/tests/k6/common/dialog.js @@ -48,7 +48,7 @@ export function setSenderName(dialog, senderName, language = "nb") { } export function setStatus(dialog, status) { - const validStatuses = ["unspecified", "inprogress", "waiting", "signing", "cancelled", "completed"]; + const validStatuses = ["unspecified", "inprogress", "new", "draft", "sent", "requiresAttention", "append"]; if (!validStatuses.includes(status)) { throw new Error("Invalid status provided."); diff --git a/tests/k6/tests/enduser/dialogSearch.js b/tests/k6/tests/enduser/dialogSearch.js index c6b68b7d9..8c5ddddba 100644 --- a/tests/k6/tests/enduser/dialogSearch.js +++ b/tests/k6/tests/enduser/dialogSearch.js @@ -61,7 +61,7 @@ export default function () { setTitle(dialogs[++d], titleToSearchFor); setAdditionalInfo(dialogs[++d], additionalInfoToSearchFor); setSearchTags(dialogs[++d], searchTagsToSearchFor); - setStatus(dialogs[++d], "signing"); + setStatus(dialogs[++d], "draft"); setExtendedStatus(dialogs[++d], extendedStatusToSearchFor); setSenderName(dialogs[++d], senderNameToSearchFor); diff --git a/tests/k6/tests/serviceowner/dialogSearch.js b/tests/k6/tests/serviceowner/dialogSearch.js index a1ba1f581..fa1a1c9a2 100644 --- a/tests/k6/tests/serviceowner/dialogSearch.js +++ b/tests/k6/tests/serviceowner/dialogSearch.js @@ -57,7 +57,7 @@ export default function () { setTitle(dialogs[++d], titleToSearchFor); setAdditionalInfo(dialogs[++d], additionalInfoToSearchFor); setSearchTags(dialogs[++d], searchTagsToSearchFor); - setStatus(dialogs[++d], "signing"); + setStatus(dialogs[++d], "draft"); setExtendedStatus(dialogs[++d], extendedStatusToSearchFor); setSenderName(dialogs[++d], senderNameToSearchFor); From 49029fb63fb8c335ef16368d4417b001351ecacd Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Thu, 5 Sep 2024 16:09:30 +0200 Subject: [PATCH 24/30] Bigus commitus --- .../Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs | 4 ++++ .../V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs | 4 ++++ .../ServiceOwner/Dialogs/Commands/Create/CreateDialogDto.cs | 1 + .../Dialogs/Commands/Update/UpdateDialogCommand.cs | 1 + .../ServiceOwner/Dialogs/Commands/Update/UpdateDialogDto.cs | 2 ++ .../V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs | 4 ++++ .../Dialogs/Queries/Search/SearchDialogDtoBase.cs | 4 ++++ .../Dialogs/Entities/DialogEntity.cs | 3 ++- 8 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs index 0d24847f9..3c9c247c5 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs @@ -57,6 +57,10 @@ public sealed class GetDialogDto /// public int? Progress { get; set; } + public string? Process { get; set; } + + public string? PrecedingProcess { get; set; } + /// /// Optional process identifier used to indicate a business process this dialog belongs to /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs index b236174bc..030ce1d6b 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs @@ -46,6 +46,10 @@ public class SearchDialogDtoBase /// public int? Progress { get; set; } + public string? Process { get; set; } + + public string? PrecedingProcess { get; set; } + /// /// Optional process identifier used to indicate a business process this dialog belongs to /// 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 0aaaf1312..1f72fe892 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 @@ -64,6 +64,7 @@ public class CreateDialogDto /// /// 2022-12-31T23:59:59Z public DateTimeOffset? DueAt { get; set; } + public string? Process { get; set; } /// /// Optional process identifier used to indicate a business process this dialog belongs to diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs index 5d7430510..1e3f6ab8b 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs @@ -89,6 +89,7 @@ public async Task Handle(UpdateDialogCommand request, Cancel } // Update primitive properties + // Alle? inc string? _mapper.Map(request.Dto, dialog); ValidateTimeFields(dialog); 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 32ea17936..5d1619a18 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 @@ -42,6 +42,8 @@ public sealed class UpdateDialogDto /// 2022-12-31T23:59:59Z public DateTimeOffset? DueAt { get; set; } + + public string? Process { get; set; } /// /// Optional process identifier used to indicate a business process this dialog belongs to /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs index 462129a65..50b66fb73 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs @@ -57,6 +57,10 @@ public sealed class GetDialogDto /// public int? Progress { get; set; } + public string? Process { get; set; } + + public string? PrecedingProcess { get; set; } + /// /// Optional process identifier used to indicate a business process this dialog belongs to /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs index 38c0fa4cb..328eeea39 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs @@ -46,6 +46,10 @@ public class SearchDialogDtoBase /// public int? Progress { get; set; } + public string? Process { get; set; } + + public string? PrecedingProcess { get; set; } + /// /// Optional process identifier used to indicate a business process this dialog belongs to /// diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs index f75195e28..d86ad7ab4 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs @@ -1,4 +1,5 @@ -using Digdir.Domain.Dialogporten.Domain.Actors; +using System.Diagnostics; +using Digdir.Domain.Dialogporten.Domain.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities; From 249636985350baeb832c81c8671ed3aea6fdf488 Mon Sep 17 00:00:00 2001 From: Amund Date: Mon, 9 Sep 2024 16:22:03 +0200 Subject: [PATCH 25/30] Apply suggestions from code review Co-authored-by: Magnus Sandgren <5285192+MagnusSandgren@users.noreply.github.com> --- .../V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs | 2 +- .../V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs index 963c6b304..a7034de7d 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogQuery.cs @@ -170,7 +170,7 @@ public async Task Handle(SearchDialogQuery request, Cancella .WhereIf(request.UpdatedBefore.HasValue, x => x.UpdatedAt <= request.UpdatedBefore) .WhereIf(request.DueAfter.HasValue, x => request.DueAfter <= x.DueAt) .WhereIf(request.DueBefore.HasValue, x => x.DueAt <= request.DueBefore) - .WhereIf(request.Process is not null, x => x.Process != null && EF.Functions.ILike(x.Process, request.Process!)) + .WhereIf(request.Process is not null, x => EF.Functions.ILike(x.Process!, request.Process!)) .WhereIf(request.Search is not null, x => x.Content.Any(x => x.Value.Localizations.AsQueryable().Any(searchExpression)) || x.SearchTags.Any(x => EF.Functions.ILike(x.Value, request.Search!)) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs index a26146668..857cac2ff 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogQuery.cs @@ -177,7 +177,7 @@ public async Task Handle(SearchDialogQuery request, Cancella .WhereIf(request.UpdatedBefore.HasValue, x => x.UpdatedAt <= request.UpdatedBefore) .WhereIf(request.DueAfter.HasValue, x => request.DueAfter <= x.DueAt) .WhereIf(request.DueBefore.HasValue, x => x.DueAt <= request.DueBefore) - .WhereIf(request.Process is not null, x => x.Process != null && EF.Functions.ILike(x.Process, request.Process!)) + .WhereIf(request.Process is not null, x => EF.Functions.ILike(x.Process!, request.Process!)) .WhereIf(request.VisibleAfter.HasValue, x => request.VisibleAfter <= x.VisibleFrom) .WhereIf(request.VisibleBefore.HasValue, x => x.VisibleFrom <= request.VisibleBefore) .WhereIf(request.Search is not null, x => From 5521ef2e79a7e2565e6f9e0541252e13b3fc9711 Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Mon, 9 Sep 2024 16:24:07 +0200 Subject: [PATCH 26/30] ?? --- .../Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs index 3c9c247c5..0d24847f9 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/GetDialogDto.cs @@ -57,10 +57,6 @@ public sealed class GetDialogDto /// public int? Progress { get; set; } - public string? Process { get; set; } - - public string? PrecedingProcess { get; set; } - /// /// Optional process identifier used to indicate a business process this dialog belongs to /// From 88ed1c410935e593dc4115b135b06a990dcb3894 Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Mon, 9 Sep 2024 17:35:47 +0200 Subject: [PATCH 27/30] removed dupes?? --- .../V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs | 4 ---- .../ServiceOwner/Dialogs/Commands/Create/CreateDialogDto.cs | 1 - .../ServiceOwner/Dialogs/Commands/Update/UpdateDialogDto.cs | 1 - .../V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs | 4 ---- .../Dialogs/Queries/Search/SearchDialogDtoBase.cs | 4 ---- 5 files changed, 14 deletions(-) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs index 030ce1d6b..b236174bc 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/SearchDialogDtoBase.cs @@ -46,10 +46,6 @@ public class SearchDialogDtoBase /// public int? Progress { get; set; } - public string? Process { get; set; } - - public string? PrecedingProcess { get; set; } - /// /// Optional process identifier used to indicate a business process this dialog belongs to /// 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 1f72fe892..0aaaf1312 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 @@ -64,7 +64,6 @@ public class CreateDialogDto /// /// 2022-12-31T23:59:59Z public DateTimeOffset? DueAt { get; set; } - public string? Process { get; set; } /// /// Optional process identifier used to indicate a business process this dialog belongs to 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 5d1619a18..753441612 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 @@ -43,7 +43,6 @@ public sealed class UpdateDialogDto public DateTimeOffset? DueAt { get; set; } - public string? Process { get; set; } /// /// Optional process identifier used to indicate a business process this dialog belongs to /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs index 50b66fb73..462129a65 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/GetDialogDto.cs @@ -57,10 +57,6 @@ public sealed class GetDialogDto /// public int? Progress { get; set; } - public string? Process { get; set; } - - public string? PrecedingProcess { get; set; } - /// /// Optional process identifier used to indicate a business process this dialog belongs to /// diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs index 328eeea39..38c0fa4cb 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/SearchDialogDtoBase.cs @@ -46,10 +46,6 @@ public class SearchDialogDtoBase /// public int? Progress { get; set; } - public string? Process { get; set; } - - public string? PrecedingProcess { get; set; } - /// /// Optional process identifier used to indicate a business process this dialog belongs to /// From 5918f9279d89ae5e0acfc4dd56790df48dd0824a Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Mon, 9 Sep 2024 19:58:40 +0200 Subject: [PATCH 28/30] removed precedingProcess from update --- docs/schema/V1/swagger.verified.json | 6 ------ .../Commands/Update/UpdateDialogCommandValidator.cs | 9 --------- .../Dialogs/Commands/Update/UpdateDialogDto.cs | 4 ---- 3 files changed, 19 deletions(-) diff --git a/docs/schema/V1/swagger.verified.json b/docs/schema/V1/swagger.verified.json index 465ea95c0..cf6b7f577 100644 --- a/docs/schema/V1/swagger.verified.json +++ b/docs/schema/V1/swagger.verified.json @@ -3914,11 +3914,6 @@ }, "type": "array" }, - "precedingProcess": { - "description": "Optional preceding process identifier to indicate the business process that preceded the process indicated in the \u0022Process\u0022 field. Cannot be set without also \u0022Process\u0022 being set.", - "nullable": true, - "type": "string" - }, "process": { "description": "Optional process identifier used to indicate a business process this dialog belongs to", "nullable": true, @@ -5421,7 +5416,6 @@ "Url": "https://example.com/some-url" } ], - "PrecedingProcess": null, "Process": null, "Progress": 42, "SearchTags": [ 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 a8b5d4624..10f1dac2e 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 @@ -111,15 +111,6 @@ public UpdateDialogDtoValidator( .WithMessage("{PropertyName} must be a valid absolute URI.") .When(x => x.Process is not null); - RuleFor(x => x.Process) - .NotEmpty() - .WithMessage($"{{PropertyName}} must not be empty when {nameof(UpdateDialogDto.PrecedingProcess)} is set.") - .When(x => x.PrecedingProcess is not null); - - RuleFor(x => x.PrecedingProcess) - .Must(x => Uri.IsWellFormedUriString(x, UriKind.Absolute)) - .WithMessage("{PropertyName} must be a valid absolute URI.") - .When(x => x.PrecedingProcess 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 753441612..aa1ba8c0f 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 @@ -48,10 +48,6 @@ public sealed class UpdateDialogDto /// public string? Process { get; set; } - /// - /// Optional preceding process identifier to indicate the business process that preceded the process indicated in the "Process" field. Cannot be set without also "Process" being set. - /// - public string? PrecedingProcess { get; set; } /// /// The expiration date for the dialog. This is the last date when the dialog is available for the end user. /// From 07192d6ffb46df3ee7b0f31b0137d7b3040d002c Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Mon, 9 Sep 2024 20:04:11 +0200 Subject: [PATCH 29/30] Removed process from update --- docs/schema/V1/swagger.verified.json | 6 ------ .../Dialogs/Commands/Update/UpdateDialogCommandValidator.cs | 6 ------ .../ServiceOwner/Dialogs/Commands/Update/UpdateDialogDto.cs | 6 ------ 3 files changed, 18 deletions(-) diff --git a/docs/schema/V1/swagger.verified.json b/docs/schema/V1/swagger.verified.json index cf6b7f577..edd6ed88a 100644 --- a/docs/schema/V1/swagger.verified.json +++ b/docs/schema/V1/swagger.verified.json @@ -3914,11 +3914,6 @@ }, "type": "array" }, - "process": { - "description": "Optional process identifier used to indicate a business process this dialog belongs to", - "nullable": true, - "type": "string" - }, "progress": { "description": "Advisory indicator of progress, represented as 1-100 percentage value. 100% representing a dialog that has come\nto a natural completion (successful or not).", "format": "int32", @@ -5416,7 +5411,6 @@ "Url": "https://example.com/some-url" } ], - "Process": null, "Progress": 42, "SearchTags": [ { 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 10f1dac2e..a764cf0a4 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 @@ -105,12 +105,6 @@ public UpdateDialogDtoValidator( .UniqueBy(x => x.Id); RuleForEach(x => x.Activities) .SetValidator(activityValidator); - - RuleFor(x => x.Process) - .Must(x => Uri.IsWellFormedUriString(x, UriKind.Absolute)) - .WithMessage("{PropertyName} must be a valid absolute URI.") - .When(x => x.Process 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 aa1ba8c0f..3172d59e2 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 @@ -42,12 +42,6 @@ public sealed class UpdateDialogDto /// 2022-12-31T23:59:59Z public DateTimeOffset? DueAt { get; set; } - - /// - /// Optional process identifier used to indicate a business process this dialog belongs to - /// - public string? Process { get; set; } - /// /// The expiration date for the dialog. This is the last date when the dialog is available for the end user. /// From 97a1fde9b249cd81442c7e9c9936ad98350d5538 Mon Sep 17 00:00:00 2001 From: Amund Myrbostad Date: Tue, 10 Sep 2024 08:11:49 +0200 Subject: [PATCH 30/30] Cleanup --- .../Dialogs/Commands/Update/UpdateDialogCommand.cs | 1 - .../Dialogs/Entities/DialogEntity.cs | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs index 1e3f6ab8b..5d7430510 100644 --- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs +++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogCommand.cs @@ -89,7 +89,6 @@ public async Task Handle(UpdateDialogCommand request, Cancel } // Update primitive properties - // Alle? inc string? _mapper.Map(request.Dto, dialog); ValidateTimeFields(dialog); diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs index d86ad7ab4..f75195e28 100644 --- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs +++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/DialogEntity.cs @@ -1,5 +1,4 @@ -using System.Diagnostics; -using Digdir.Domain.Dialogporten.Domain.Actors; +using Digdir.Domain.Dialogporten.Domain.Actors; using Digdir.Domain.Dialogporten.Domain.Attachments; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions; using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities;