Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add process and precedingProcess to dialog as optional fields #1092

Merged
merged 39 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e9d05ca
Bigus commitus
Fargekritt Sep 5, 2024
159f3fb
setProcess va broken, i fix
Fargekritt Sep 6, 2024
490d351
endUser e2e complete?
Fargekritt Sep 6, 2024
df982ca
serviceowner search process, Query param added.
Fargekritt Sep 6, 2024
643aeef
Process og PrecedingProcess i data på evnets
Fargekritt Sep 6, 2024
854c8be
Added process to DialogGenerator
Fargekritt Sep 6, 2024
7983a14
Added summary to dtos
Fargekritt Sep 6, 2024
2cd279f
e2e complete
Fargekritt Sep 6, 2024
0d60085
Cleanup
Fargekritt Sep 6, 2024
7ba3ef5
Merge branch 'main' into feature/Correlation-mechanism
Fargekritt Sep 6, 2024
9977007
Fixed?
Fargekritt Sep 6, 2024
25b7dd9
Fixed swagger schema, maybe
Fargekritt Sep 6, 2024
a5a50c1
default settings
Fargekritt Sep 8, 2024
0937f04
Update tests/k6/common/dialog.js
Fargekritt Sep 8, 2024
f1d1cb8
Update src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs
Fargekritt Sep 8, 2024
86e9372
Update src/Digdir.Domain.Dialogporten.Application/Features/V1/Service…
Fargekritt Sep 8, 2024
21c4217
Apply suggestions from code review
Fargekritt Sep 8, 2024
ce4dd09
Merge remote-tracking branch 'origin/feature/Correlation-mechanism' i…
Fargekritt Sep 8, 2024
be818f9
Cleanup
Fargekritt Sep 8, 2024
e69d2d1
Swagger fixed again?
Fargekritt Sep 8, 2024
ea794dc
Merge branch 'main' into feature/Correlation-mechanism
Fargekritt Sep 9, 2024
cd550e2
Merge branch 'main' into feature/Correlation-mechanism
Fargekritt Sep 9, 2024
e20dbc5
Fixed test
Fargekritt Sep 9, 2024
2b17eff
Apply suggestions from code review
Fargekritt Sep 9, 2024
bf19212
process search made case insensetive
Fargekritt Sep 9, 2024
71b05d6
Merge remote-tracking branch 'origin/feature/Correlation-mechanism' i…
Fargekritt Sep 9, 2024
c72fa3a
fix
Fargekritt Sep 9, 2024
ded9b89
Merge branch 'main' into feature/Correlation-mechanism
Fargekritt Sep 9, 2024
fba74d3
Update test?
Fargekritt Sep 9, 2024
49029fb
Bigus commitus
Fargekritt Sep 5, 2024
2496369
Apply suggestions from code review
Fargekritt Sep 9, 2024
5521ef2
??
Fargekritt Sep 9, 2024
88ed1c4
removed dupes??
Fargekritt Sep 9, 2024
8d18288
Merge branch 'main' into feature/Correlation-mechanism
Fargekritt Sep 9, 2024
b846b82
Merge branch 'main' into feature/Correlation-mechanism
Fargekritt Sep 9, 2024
5918f92
removed precedingProcess from update
Fargekritt Sep 9, 2024
07192d6
Removed process from update
Fargekritt Sep 9, 2024
97a1fde
Cleanup
Fargekritt Sep 10, 2024
5af288e
Merge branch 'main' into feature/Correlation-mechanism
Fargekritt Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/schema/V1/schema.verified.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ type Dialog {
serviceResourceType: String!
party: String!
progress: Int
process: String
precedingProcess: String
extendedStatus: String
externalReference: String
visibleFrom: DateTime
Expand Down Expand Up @@ -167,6 +169,8 @@ type SearchDialog {
serviceResourceType: String!
party: String!
progress: Int
process: String
precedingProcess: String
guiAttachmentCount: Int
extendedStatus: String
createdAt: DateTime!
Expand Down
82 changes: 81 additions & 1 deletion docs/schema/V1/swagger.verified.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -2035,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",
Expand Down Expand Up @@ -2178,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",
Expand Down Expand Up @@ -3108,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",
Expand Down Expand Up @@ -3207,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",
Expand Down Expand Up @@ -3864,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",
Expand Down Expand Up @@ -4170,6 +4230,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",
Expand Down Expand Up @@ -4821,6 +4890,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",
Expand Down Expand Up @@ -5343,6 +5421,8 @@
"Url": "https://example.com/some-url"
}
],
"PrecedingProcess": null,
"Process": null,
"Progress": 42,
"SearchTags": [
{
Expand Down Expand Up @@ -6107,4 +6187,4 @@
"url": "https://altinn-dev-api.azure-api.net/dialogporten"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ private static Dictionary<string, object> 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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<string, object>? GetCloudEventData(DialogDomainEventBase domainEvent)
{
var data = new Dictionary<string, object>();
if (domainEvent.Process is not null)
{
data["process"] = domainEvent.Process;
}
if (domainEvent.PrecedingProcess is not null)
{
data["precedingProcess"] = domainEvent.PrecedingProcess;
}
return data.Count == 0 ? null : data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ public sealed class GetDialogDto
/// </summary>
public int? Progress { get; set; }

/// <summary>
/// Optional process identifier used to indicate a business process this dialog belongs to
/// </summary>
public string? Process { get; set; }

/// <summary>
/// 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.
/// </summary>
public string? PrecedingProcess { get; set; }

/// <summary>
/// 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ public class SearchDialogDtoBase
/// </summary>
public int? Progress { get; set; }

/// <summary>
/// Optional process identifier used to indicate a business process this dialog belongs to
/// </summary>
public string? Process { get; set; }

/// <summary>
/// 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.
/// </summary>
public string? PrecedingProcess { get; set; }

/// <summary>
/// The number of attachments in the dialog made available for browser-based frontends.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ public sealed class SearchDialogQuery : SortablePaginationParameter<SearchDialog
/// </summary>
public DateTimeOffset? DueBefore { get; init; }

/// <summary>
/// Filter by process
/// </summary>
public string? Process { get; init; }

/// <summary>
/// Search string for free text search. Will attempt to fuzzily match in all free text fields in the aggregate
/// </summary>
Expand Down Expand Up @@ -165,6 +170,7 @@ public async Task<SearchDialogResult> 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)
Fargekritt marked this conversation as resolved.
Show resolved Hide resolved
.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!))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public SearchDialogQueryValidator()
.LessThanOrEqualTo(20)
.When(x => x.ExtendedStatus is not null);

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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,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()
Expand All @@ -56,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();

Expand All @@ -83,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)
Expand All @@ -118,6 +118,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.")
Fargekritt marked this conversation as resolved.
Show resolved Hide resolved
.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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ public class CreateDialogDto
/// <example>2022-12-31T23:59:59Z</example>
public DateTimeOffset? DueAt { get; set; }

/// <summary>
/// Optional process identifier used to indicate a business process this dialog belongs to
/// </summary>
public string? Process { get; set; }
/// <summary>
/// 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.
/// </summary>
public string? PrecedingProcess { get; set; }

/// <summary>
/// The expiration date for the dialog. This is the last date when the dialog is available for the end user.
///
Expand Down
Loading
Loading