diff --git a/docs/schema/V1/schema.verified.graphql b/docs/schema/V1/schema.verified.graphql
index aada4fd3c..be181777b 100644
--- a/docs/schema/V1/schema.verified.graphql
+++ b/docs/schema/V1/schema.verified.graphql
@@ -57,6 +57,7 @@ type AuthorizedParty {
type Content {
type: ContentType!
value: [Localization!]!
+ mediaType: String
}
type Dialog {
@@ -115,7 +116,6 @@ type Element {
type ElementUrl {
id: UUID!
url: URL!
- mediaType: String
consumerType: ElementUrlConsumer!
}
diff --git a/docs/schema/V1/swagger.verified.json b/docs/schema/V1/swagger.verified.json
index eccdc5927..b0d0650ce 100644
--- a/docs/schema/V1/swagger.verified.json
+++ b/docs/schema/V1/swagger.verified.json
@@ -229,7 +229,8 @@
"Value": "Some Title",
"CultureCode": "en-us"
}
- ]
+ ],
+ "MediaType": null
},
{
"Type": 3,
@@ -238,7 +239,8 @@
"Value": "Some Summary",
"CultureCode": "en-us"
}
- ]
+ ],
+ "MediaType": null
}
],
"SearchTags": [
@@ -252,7 +254,7 @@
"Elements": [
{
"Id": "02a72809-eddd-4192-864d-8f1755d72f4e",
- "Type": "http://example.com/some-type",
+ "Type": "https://example.com/some-type",
"ExternalReference": null,
"AuthorizationAttribute": null,
"RelatedDialogElementId": null,
@@ -265,8 +267,7 @@
"Urls": [
{
"Id": "858177cb-8584-4d10-a086-3a5defa7a6c3",
- "Url": "http://example.com/some-url",
- "MediaType": "application/json",
+ "Url": "https://example.com/some-url",
"ConsumerType": 0
}
]
@@ -2301,6 +2302,10 @@
"items": {
"$ref": "#/components/schemas/LocalizationDto"
}
+ },
+ "mediaType": {
+ "type": "string",
+ "nullable": true
}
}
},
@@ -2312,14 +2317,16 @@
"SenderName",
"Summary",
"AdditionalInfo",
- "ExtendedStatus"
+ "ExtendedStatus",
+ "MainContentReference"
],
"enum": [
"Title",
"SenderName",
"Summary",
"AdditionalInfo",
- "ExtendedStatus"
+ "ExtendedStatus",
+ "MainContentReference"
]
},
"LocalizationDto": {
@@ -2397,10 +2404,6 @@
"type": "string",
"format": "uri"
},
- "mediaType": {
- "type": "string",
- "nullable": true
- },
"consumerType": {
"$ref": "#/components/schemas/DialogElementUrlConsumerType_Values"
}
@@ -2902,6 +2905,10 @@
"items": {
"$ref": "#/components/schemas/LocalizationDto"
}
+ },
+ "mediaType": {
+ "type": "string",
+ "nullable": true
}
}
},
@@ -2962,10 +2969,6 @@
"type": "string",
"format": "uri"
},
- "mediaType": {
- "type": "string",
- "nullable": true
- },
"consumerType": {
"$ref": "#/components/schemas/DialogElementUrlConsumerType_Values"
}
@@ -3250,6 +3253,10 @@
"items": {
"$ref": "#/components/schemas/LocalizationDto"
}
+ },
+ "mediaType": {
+ "type": "string",
+ "nullable": true
}
}
},
@@ -3311,10 +3318,6 @@
"type": "string",
"format": "uri"
},
- "mediaType": {
- "type": "string",
- "nullable": true
- },
"consumerType": {
"$ref": "#/components/schemas/DialogElementUrlConsumerType_Values"
}
@@ -3947,6 +3950,10 @@
"items": {
"$ref": "#/components/schemas/LocalizationDto"
}
+ },
+ "mediaType": {
+ "type": "string",
+ "nullable": true
}
}
},
@@ -4005,10 +4012,6 @@
"type": "string",
"format": "uri"
},
- "mediaType": {
- "type": "string",
- "nullable": true
- },
"consumerType": {
"$ref": "#/components/schemas/DialogElementUrlConsumerType_Values"
}
diff --git a/src/Digdir.Domain.Dialogporten.Application/Common/Extensions/FluentValidation/FluentValidationLocalizationDtoExtensions.cs b/src/Digdir.Domain.Dialogporten.Application/Common/Extensions/FluentValidation/FluentValidationLocalizationDtoExtensions.cs
index 59f77c7a7..ae81bc0ae 100644
--- a/src/Digdir.Domain.Dialogporten.Application/Common/Extensions/FluentValidation/FluentValidationLocalizationDtoExtensions.cs
+++ b/src/Digdir.Domain.Dialogporten.Application/Common/Extensions/FluentValidation/FluentValidationLocalizationDtoExtensions.cs
@@ -1,6 +1,7 @@
using Digdir.Domain.Dialogporten.Application.Features.V1.Common.Localizations;
using FluentValidation;
using HtmlAgilityPack;
+using Markdig;
namespace Digdir.Domain.Dialogporten.Application.Common.Extensions.FluentValidation;
@@ -8,18 +9,27 @@ internal static class FluentValidationLocalizationDtoExtensions
{
private static readonly string[] AllowedTags = ["p", "a", "br", "em", "strong", "ul", "ol", "li"];
private static readonly string ContainsValidHtmlError =
- $"{{PropertyName}} contains unsupported html. The following tags are supported: " +
+ "Value contains unsupported HTML/markdown. The following tags are supported: " +
$"[{string.Join(",", AllowedTags.Select(x => '<' + x + '>'))}]. Tag attributes " +
- $"are not supported except for on '' which must contain a 'href' starting " +
- $"with 'https://'.";
+ "are not supported except for on '' which must contain a 'href' starting " +
+ "with 'https://'.";
- public static IRuleBuilderOptions ContainsValidHtml(this IRuleBuilder ruleBuilder)
+ public static IRuleBuilderOptions ContainsValidHtml(
+ this IRuleBuilder ruleBuilder)
{
return ruleBuilder
.Must(x => x.Value is null || x.Value.HtmlAgilityPackCheck())
.WithMessage(ContainsValidHtmlError);
}
+ public static IRuleBuilderOptions ContainsValidMarkdown(
+ this IRuleBuilder ruleBuilder)
+ {
+ return ruleBuilder
+ .Must(x => x.Value is null || Markdown.ToHtml(x.Value).HtmlAgilityPackCheck())
+ .WithMessage(ContainsValidHtmlError);
+ }
+
private static bool HtmlAgilityPackCheck(this string html)
{
var doc = new HtmlDocument();
@@ -33,8 +43,8 @@ private static bool HtmlAgilityPackCheck(this string html)
{
return false;
}
- // If the node is a hyperlink, it should only have an href attribute
- // and it should start with 'https://'
+ // If the node is a hyperlink, it should only have a href attribute,
+ // and it must start with 'https://'
if (node.IsAnchorTag())
{
if (!node.IsValidAnchorTag())
diff --git a/src/Digdir.Domain.Dialogporten.Application/Digdir.Domain.Dialogporten.Application.csproj b/src/Digdir.Domain.Dialogporten.Application/Digdir.Domain.Dialogporten.Application.csproj
index c4f24968c..e9d0ea74a 100644
--- a/src/Digdir.Domain.Dialogporten.Application/Digdir.Domain.Dialogporten.Application.csproj
+++ b/src/Digdir.Domain.Dialogporten.Application/Digdir.Domain.Dialogporten.Application.csproj
@@ -9,6 +9,7 @@
+
diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogElements/Queries/Get/GetDialogElementDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogElements/Queries/Get/GetDialogElementDto.cs
index 1ea3ce309..8dacf2057 100644
--- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogElements/Queries/Get/GetDialogElementDto.cs
+++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogElements/Queries/Get/GetDialogElementDto.cs
@@ -21,7 +21,6 @@ public sealed class GetDialogElementUrlDto
{
public Guid Id { get; set; }
public Uri Url { get; set; } = null!;
- public string? MediaType { get; set; }
public DialogElementUrlConsumerType.Values ConsumerType { get; set; }
}
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 8a3552376..c6a7d1af5 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
@@ -54,6 +54,7 @@ public sealed class GetDialogContentDto
{
public DialogContentType.Values Type { get; set; }
public List Value { get; set; } = [];
+ public string? MediaType { get; set; }
}
public sealed class GetDialogDialogActivityDto
@@ -130,7 +131,6 @@ public sealed class GetDialogDialogElementUrlDto
{
public Guid Id { get; set; }
public Uri Url { get; set; } = null!;
- public string? MediaType { get; set; }
public DialogElementUrlConsumerType.Values ConsumerType { get; set; }
}
diff --git a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogElements/Queries/Get/GetDialogElementDto.cs b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogElements/Queries/Get/GetDialogElementDto.cs
index b0c476cd3..70b329f9a 100644
--- a/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogElements/Queries/Get/GetDialogElementDto.cs
+++ b/src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogElements/Queries/Get/GetDialogElementDto.cs
@@ -22,7 +22,6 @@ public sealed class GetDialogElementUrlDto
{
public Guid Id { get; set; }
public Uri Url { get; set; } = null!;
- public string? MediaType { get; set; }
public DialogElementUrlConsumerType.Values ConsumerType { 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 84e9e9184..4a2b7b707 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
@@ -128,9 +128,26 @@ public CreateDialogContentDtoValidator()
ClassLevelCascadeMode = CascadeMode.Stop;
RuleFor(x => x.Type)
.IsInEnum();
+ RuleFor(x => x.MediaType)
+ .Must((dto, value) =>
+ {
+ var type = DialogContentType.GetValue(dto.Type);
+ return value is null ? type.AllowedMediaTypes.Length == 0 : type.AllowedMediaTypes.Contains(value);
+ })
+ .WithMessage(x =>
+ $"{{PropertyName}} '{x.MediaType ?? "null"}' is not allowed for content type {DialogContentType.GetValue(x.Type).Name}. " +
+ $"Valid media types are: {(DialogContentType.GetValue(x.Type).AllowedMediaTypes.Length == 0 ? "None" :
+ $"{string.Join(", ", DialogContentType.GetValue(x.Type).AllowedMediaTypes!)}")}");
RuleForEach(x => x.Value)
.ContainsValidHtml()
- .When(x => DialogContentType.GetValue(x.Type).RenderAsHtml);
+ .When(x => x.MediaType is not null && (x.MediaType == MediaTypes.Html));
+ RuleForEach(x => x.Value)
+ .ContainsValidMarkdown()
+ .When(x => x.MediaType is not null && x.MediaType == MediaTypes.Markdown);
+ RuleForEach(x => x.Value)
+ .Must(x => Uri.TryCreate(x.Value, UriKind.Absolute, out var uri) && uri.Scheme == Uri.UriSchemeHttps)
+ .When(x => x.MediaType is not null && x.MediaType.StartsWith(MediaTypes.EmbeddablePrefix, StringComparison.InvariantCultureIgnoreCase))
+ .WithMessage("{PropertyName} must be a valid HTTPS URL for embeddable content types");
RuleFor(x => x.Value)
.NotEmpty()
.SetValidator(x => new LocalizationDtosValidator(DialogContentType.GetValue(x.Type).MaxLength));
@@ -171,13 +188,6 @@ public CreateDialogDialogElementUrlDtoValidator()
.NotNull()
.IsValidUri()
.MaximumLength(Constants.DefaultMaxUriLength);
- RuleFor(x => x.MediaType)
- .MaximumLength(Constants.DefaultMaxStringLength);
- RuleFor(x => x.MediaType)
- .Must(MediaTypes.IsValid!)
- .When(x => x.MediaType != null)
- .WithMessage("Invalid media type, see docs for complete list ");
-
RuleFor(x => x.ConsumerType)
.IsInEnum();
}
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 80dea25c1..a6d0e9a57 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
@@ -35,6 +35,7 @@ public sealed class CreateDialogContentDto
{
public DialogContentType.Values Type { get; set; }
public List Value { get; set; } = [];
+ public string? MediaType { get; set; }
}
public sealed class CreateDialogSearchTagDto
@@ -109,7 +110,6 @@ public sealed class CreateDialogDialogElementDto
public sealed class CreateDialogDialogElementUrlDto
{
public Uri Url { get; set; } = null!;
- public string? MediaType { get; set; }
public DialogElementUrlConsumerType.Values ConsumerType { get; set; }
}
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 a716af801..cf1ea8a92 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
@@ -123,9 +123,26 @@ public UpdateDialogContentDtoValidator()
ClassLevelCascadeMode = CascadeMode.Stop;
RuleFor(x => x.Type)
.IsInEnum();
+ RuleFor(x => x.MediaType)
+ .Must((dto, value) =>
+ {
+ var type = DialogContentType.GetValue(dto.Type);
+ return value is null ? type.AllowedMediaTypes.Length == 0 : type.AllowedMediaTypes.Contains(value);
+ })
+ .WithMessage(x =>
+ $"{{PropertyName}} '{x.MediaType ?? "null"}' is not allowed for content type {DialogContentType.GetValue(x.Type).Name}. " +
+ $"Valid media types are: {(DialogContentType.GetValue(x.Type).AllowedMediaTypes.Length == 0 ? "None" :
+ $"{string.Join(", ", DialogContentType.GetValue(x.Type).AllowedMediaTypes!)}")}");
RuleForEach(x => x.Value)
.ContainsValidHtml()
- .When(x => DialogContentType.GetValue(x.Type).RenderAsHtml);
+ .When(x => x.MediaType is not null && (x.MediaType == MediaTypes.Html));
+ RuleForEach(x => x.Value)
+ .ContainsValidMarkdown()
+ .When(x => x.MediaType is not null && x.MediaType == MediaTypes.Markdown);
+ RuleForEach(x => x.Value)
+ .Must(x => Uri.TryCreate(x.Value, UriKind.Absolute, out var uri) && uri.Scheme == Uri.UriSchemeHttps)
+ .When(x => x.MediaType is not null && x.MediaType.StartsWith(MediaTypes.EmbeddablePrefix, StringComparison.InvariantCultureIgnoreCase))
+ .WithMessage("{PropertyName} must be a valid HTTPS URL for embeddable content types");
RuleFor(x => x.Value)
.NotEmpty()
.SetValidator(x => new LocalizationDtosValidator(DialogContentType.GetValue(x.Type).MaxLength));
@@ -168,12 +185,6 @@ public UpdateDialogDialogElementUrlDtoValidator()
.NotNull()
.IsValidUri()
.MaximumLength(Constants.DefaultMaxUriLength);
- RuleFor(x => x.MediaType)
- .MaximumLength(Constants.DefaultMaxStringLength);
- RuleFor(x => x.MediaType)
- .Must(MediaTypes.IsValid!)
- .When(x => x.MediaType != null)
- .WithMessage("Invalid media type, see docs for complete list ");
RuleFor(x => x.ConsumerType)
.IsInEnum();
}
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 7563694b0..7a4ad116f 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
@@ -33,6 +33,7 @@ public sealed class UpdateDialogContentDto
{
public DialogContentType.Values Type { get; set; }
public List Value { get; set; } = [];
+ public string? MediaType { get; set; }
}
public sealed class UpdateDialogSearchTagDto
@@ -112,7 +113,6 @@ public sealed class UpdateDialogDialogElementUrlDto
{
public Guid? Id { get; set; }
public Uri Url { get; set; } = null!;
- public string? MediaType { get; set; }
public DialogElementUrlConsumerType.Values ConsumerType { get; set; }
}
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 7eea8beef..57ca94799 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
@@ -55,6 +55,7 @@ public sealed class GetDialogContentDto
{
public DialogContentType.Values Type { get; set; }
public List Value { get; set; } = [];
+ public string? MediaType { get; set; }
}
public sealed class GetDialogSearchTagDto
@@ -131,7 +132,6 @@ public sealed class GetDialogDialogElementUrlDto
{
public Guid Id { get; set; }
public Uri Url { get; set; } = null!;
- public string? MediaType { get; set; }
public DialogElementUrlConsumerType.Values ConsumerType { get; set; }
}
diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Content/DialogContent.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Content/DialogContent.cs
index fa5b7eb9f..452397155 100644
--- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Content/DialogContent.cs
+++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Content/DialogContent.cs
@@ -10,6 +10,8 @@ public class DialogContent : IEntity
public DateTimeOffset CreatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }
+ public string? MediaType { get; set; }
+
// === Dependent relationships ===
public Guid DialogId { get; set; }
public DialogEntity Dialog { get; set; } = null!;
diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Content/DialogContentType.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Content/DialogContentType.cs
index 2bf12a710..ff8c057b1 100644
--- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Content/DialogContentType.cs
+++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Content/DialogContentType.cs
@@ -12,50 +12,59 @@ public enum Values
SenderName = 2,
Summary = 3,
AdditionalInfo = 4,
- ExtendedStatus = 5
+ ExtendedStatus = 5,
+ MainContentReference = 6
}
public bool Required { get; private init; }
- public bool RenderAsHtml { get; private init; }
public bool OutputInList { get; private init; }
public int MaxLength { get; private init; }
+ public string[] AllowedMediaTypes { get; init; } = [];
+
public override DialogContentType MapValue(Values id) => id switch
{
Values.Title => new(id)
{
Required = true,
- RenderAsHtml = false,
MaxLength = Constants.DefaultMaxStringLength,
- OutputInList = true
+ OutputInList = true,
+ AllowedMediaTypes = []
},
Values.SenderName => new(id)
{
Required = false,
- RenderAsHtml = false,
MaxLength = Constants.DefaultMaxStringLength,
- OutputInList = true
+ OutputInList = true,
+ AllowedMediaTypes = []
},
Values.Summary => new(id)
{
Required = true,
- RenderAsHtml = false,
MaxLength = Constants.DefaultMaxStringLength,
- OutputInList = true
+ OutputInList = true,
+ AllowedMediaTypes = []
},
Values.AdditionalInfo => new(id)
{
Required = false,
- RenderAsHtml = true,
MaxLength = 1023,
- OutputInList = false
+ OutputInList = false,
+ AllowedMediaTypes = [MediaTypes.Html, MediaTypes.PlainText, MediaTypes.Markdown]
},
Values.ExtendedStatus => new(id)
{
Required = false,
- RenderAsHtml = false,
MaxLength = 20,
- OutputInList = true
+ OutputInList = true,
+ AllowedMediaTypes = []
+ },
+ Values.MainContentReference => new(id)
+ {
+ Required = false,
+ MaxLength = 1023,
+ OutputInList = false,
+ AllowedMediaTypes = [MediaTypes.EmbeddableMarkdown]
},
_ => throw new ArgumentOutOfRangeException(nameof(id), id, null)
};
diff --git a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Elements/DialogElementUrl.cs b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Elements/DialogElementUrl.cs
index dfec7a92b..5884e8012 100644
--- a/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Elements/DialogElementUrl.cs
+++ b/src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Elements/DialogElementUrl.cs
@@ -9,7 +9,6 @@ public class DialogElementUrl : IEntity
public DateTimeOffset UpdatedAt { get; set; }
public Uri Url { get; set; } = null!;
- public string? MediaType { get; set; }
// === Dependent relationships ===
public DialogElementUrlConsumerType.Values ConsumerTypeId { get; set; }
diff --git a/src/Digdir.Domain.Dialogporten.Domain/MediaTypes.cs b/src/Digdir.Domain.Dialogporten.Domain/MediaTypes.cs
index 874818ae2..eaadd6dc2 100644
--- a/src/Digdir.Domain.Dialogporten.Domain/MediaTypes.cs
+++ b/src/Digdir.Domain.Dialogporten.Domain/MediaTypes.cs
@@ -1,45 +1,12 @@
-using System.Net.Mime;
-using System.Reflection;
namespace Digdir.Domain.Dialogporten.Domain;
public static class MediaTypes
{
- // Custom MediaTypes for embedding content in frontend applications
- private static readonly string[] CustomDialogportenMediaTypes =
- [
- "application/vnd.dialogporten.frontchannelembed+json;type=markdown"
- ];
+ public static string EmbeddablePrefix => "application/vnd.dialogporten.frontchannelembed";
+ public static string EmbeddableMarkdown => $"{EmbeddablePrefix}+json;type=markdown";
- private static string[]? _validMediaTypes;
-
- public static bool IsValid(string mediaType) => GetValidMediaTypes().Contains(mediaType);
-
- private static string[] GetValidMediaTypes()
- {
- if (_validMediaTypes != null)
- {
- return _validMediaTypes;
- }
-
- var applicationMediaTypes = GetMediaTypes(typeof(MediaTypeNames.Application));
- var imageMediaTypes = GetMediaTypes(typeof(MediaTypeNames.Image));
- var textMediaTypes = GetMediaTypes(typeof(MediaTypeNames.Text));
-
- _validMediaTypes = applicationMediaTypes
- .Concat(imageMediaTypes)
- .Concat(textMediaTypes)
- .Concat(CustomDialogportenMediaTypes)
- .ToArray();
-
- return _validMediaTypes;
- }
-
- private static IEnumerable GetMediaTypes(Type mediaTypeClass)
- {
- return mediaTypeClass
- .GetFields(BindingFlags.Public | BindingFlags.Static)
- .Where(field => field.FieldType == typeof(string))
- .Select(field => (string)field.GetValue(null)!);
- }
+ public static string Markdown => "text/markdown";
+ public static string PlainText => "text/plain";
+ public static string Html => "text/html";
}
diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs
index 62496b4b4..cb38f1c79 100644
--- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs
+++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs
@@ -19,6 +19,7 @@ public sealed class Content
{
public ContentType Type { get; set; }
public List Value { get; set; } = [];
+ public string? MediaType { get; set; }
}
public sealed class SeenLog
diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs
index 601a21f1e..ec49cad81 100644
--- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs
+++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs
@@ -138,7 +138,6 @@ public sealed class ElementUrl
{
public Guid Id { get; set; }
public Uri Url { get; set; } = null!;
- public string? MediaType { get; set; }
public ElementUrlConsumer ConsumerType { get; set; }
}
diff --git a/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240619091933_MoveFrontChannelEmbedsToContent.Designer.cs b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240619091933_MoveFrontChannelEmbedsToContent.Designer.cs
new file mode 100644
index 000000000..0ca2dc1c4
--- /dev/null
+++ b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240619091933_MoveFrontChannelEmbedsToContent.Designer.cs
@@ -0,0 +1,1376 @@
+//
+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("20240619091933_MoveFrontChannelEmbedsToContent")]
+ partial class MoveFrontChannelEmbedsToContent
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.6")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ 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("DialogElementId")
+ .HasColumnType("uuid");
+
+ 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("DialogElementId");
+
+ 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("DialogElementId")
+ .HasColumnType("uuid");
+
+ b.Property("DialogId")
+ .HasColumnType("uuid");
+
+ b.Property("ExtendedType")
+ .HasMaxLength(1023)
+ .HasColumnType("character varying(1023)");
+
+ b.Property("PerformedBy")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.Property("RelatedActivityId")
+ .HasColumnType("uuid");
+
+ b.Property("TypeId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DialogElementId");
+
+ b.HasIndex("DialogId");
+
+ b.HasIndex("RelatedActivityId");
+
+ 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 = "Submission"
+ },
+ new
+ {
+ Id = 2,
+ Name = "Feedback"
+ },
+ new
+ {
+ Id = 3,
+ Name = "Information"
+ },
+ new
+ {
+ Id = 4,
+ Name = "Error"
+ },
+ new
+ {
+ Id = 5,
+ Name = "Closed"
+ },
+ new
+ {
+ Id = 7,
+ Name = "Forwarded"
+ });
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Content.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")
+ .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.Content.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 string[0],
+ MaxLength = 255,
+ Name = "Title",
+ OutputInList = true,
+ Required = true
+ },
+ new
+ {
+ Id = 2,
+ AllowedMediaTypes = new string[0],
+ MaxLength = 255,
+ Name = "SenderName",
+ OutputInList = true,
+ Required = false
+ },
+ new
+ {
+ Id = 3,
+ AllowedMediaTypes = new string[0],
+ 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 string[0],
+ 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("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("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("EndUserId")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.Property("EndUserName")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.Property("EndUserTypeId")
+ .HasColumnType("integer");
+
+ 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 = "Waiting"
+ },
+ new
+ {
+ Id = 4,
+ Name = "Signing"
+ },
+ new
+ {
+ Id = 5,
+ Name = "Cancelled"
+ },
+ 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.Elements.DialogElement", 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("ExternalReference")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.Property("RelatedDialogElementId")
+ .HasColumnType("uuid");
+
+ b.Property("Type")
+ .HasMaxLength(1023)
+ .HasColumnType("character varying(1023)");
+
+ b.Property("UpdatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("current_timestamp at time zone 'utc'");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DialogId");
+
+ b.HasIndex("RelatedDialogElementId");
+
+ b.ToTable("DialogElement");
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Elements.DialogElementUrl", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasDefaultValueSql("gen_random_uuid()");
+
+ b.Property("ConsumerTypeId")
+ .HasColumnType("integer");
+
+ b.Property("CreatedAt")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("timestamp with time zone")
+ .HasDefaultValueSql("current_timestamp at time zone 'utc'");
+
+ b.Property("DialogElementId")
+ .HasColumnType("uuid");
+
+ 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("ConsumerTypeId");
+
+ b.HasIndex("DialogElementId");
+
+ b.ToTable("DialogElementUrl");
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Elements.DialogElementUrlConsumerType", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("integer");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
+ b.HasKey("Id");
+
+ b.ToTable("DialogElementUrlConsumerType");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Name = "Gui"
+ },
+ new
+ {
+ Id = 2,
+ Name = "Api"
+ });
+ });
+
+ 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("CultureCode")
+ .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", "CultureCode");
+
+ 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("Discriminator").HasValue("LocalizationSet");
+
+ b.UseTphMappingStrategy();
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Outboxes.OutboxMessage", b =>
+ {
+ b.Property("EventId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ 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.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.Content.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.DialogSeenLogVia", b =>
+ {
+ b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Localizations.LocalizationSet");
+
+ b.Property("DialogSeenLogId")
+ .HasColumnType("uuid");
+
+ b.HasIndex("DialogSeenLogId")
+ .IsUnique();
+
+ b.HasDiscriminator().HasValue("DialogSeenLogVia");
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Elements.DialogElementDisplayName", b =>
+ {
+ b.HasBaseType("Digdir.Domain.Dialogporten.Domain.Localizations.LocalizationSet");
+
+ b.Property("ElementId")
+ .HasColumnType("uuid");
+
+ b.HasIndex("ElementId")
+ .IsUnique();
+
+ b.HasDiscriminator().HasValue("DialogElementDisplayName");
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Actions.DialogApiAction", b =>
+ {
+ b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Elements.DialogElement", "DialogElement")
+ .WithMany("ApiActions")
+ .HasForeignKey("DialogElementId")
+ .OnDelete(DeleteBehavior.Restrict);
+
+ b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", "Dialog")
+ .WithMany("ApiActions")
+ .HasForeignKey("DialogId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Dialog");
+
+ b.Navigation("DialogElement");
+ });
+
+ 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.Elements.DialogElement", "DialogElement")
+ .WithMany("Activities")
+ .HasForeignKey("DialogElementId")
+ .OnDelete(DeleteBehavior.SetNull);
+
+ 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.Activities.DialogActivityType", "Type")
+ .WithMany()
+ .HasForeignKey("TypeId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.Navigation("Dialog");
+
+ b.Navigation("DialogElement");
+
+ b.Navigation("RelatedActivity");
+
+ b.Navigation("Type");
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Content.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.Content.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.Elements.DialogElement", b =>
+ {
+ b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", "Dialog")
+ .WithMany("Elements")
+ .HasForeignKey("DialogId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Elements.DialogElement", "RelatedDialogElement")
+ .WithMany("RelatedDialogElements")
+ .HasForeignKey("RelatedDialogElementId")
+ .OnDelete(DeleteBehavior.SetNull);
+
+ b.Navigation("Dialog");
+
+ b.Navigation("RelatedDialogElement");
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Elements.DialogElementUrl", b =>
+ {
+ b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Elements.DialogElementUrlConsumerType", "ConsumerType")
+ .WithMany()
+ .HasForeignKey("ConsumerTypeId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Elements.DialogElement", "DialogElement")
+ .WithMany("Urls")
+ .HasForeignKey("DialogElementId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("ConsumerType");
+
+ b.Navigation("DialogElement");
+ });
+
+ 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.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.Content.DialogContentValue", b =>
+ {
+ b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Content.DialogContent", "DialogContent")
+ .WithOne("Value")
+ .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Content.DialogContentValue", "DialogContentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("DialogContent");
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSeenLogVia", b =>
+ {
+ b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSeenLog", "DialogSeenLog")
+ .WithOne("Via")
+ .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSeenLogVia", "DialogSeenLogId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("DialogSeenLog");
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Elements.DialogElementDisplayName", b =>
+ {
+ b.HasOne("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Elements.DialogElement", "Element")
+ .WithOne("DisplayName")
+ .HasForeignKey("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Elements.DialogElementDisplayName", "ElementId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Element");
+ });
+
+ 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("RelatedActivities");
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Content.DialogContent", b =>
+ {
+ b.Navigation("Value")
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogEntity", b =>
+ {
+ b.Navigation("Activities");
+
+ b.Navigation("ApiActions");
+
+ b.Navigation("Content");
+
+ b.Navigation("Elements");
+
+ b.Navigation("GuiActions");
+
+ b.Navigation("SearchTags");
+
+ b.Navigation("SeenLog");
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.DialogSeenLog", b =>
+ {
+ b.Navigation("Via");
+ });
+
+ modelBuilder.Entity("Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Elements.DialogElement", b =>
+ {
+ b.Navigation("Activities");
+
+ b.Navigation("ApiActions");
+
+ b.Navigation("DisplayName");
+
+ b.Navigation("RelatedDialogElements");
+
+ b.Navigation("Urls");
+ });
+
+ 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/20240619091933_MoveFrontChannelEmbedsToContent.cs b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240619091933_MoveFrontChannelEmbedsToContent.cs
new file mode 100644
index 000000000..a8db6d287
--- /dev/null
+++ b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240619091933_MoveFrontChannelEmbedsToContent.cs
@@ -0,0 +1,142 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Digdir.Domain.Dialogporten.Infrastructure.Persistence.Migrations
+{
+ ///
+ public partial class MoveFrontChannelEmbedsToContent : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "MediaType",
+ table: "DialogElementUrl");
+
+ migrationBuilder.DropColumn(
+ name: "RenderAsHtml",
+ table: "DialogContentType");
+
+ migrationBuilder.AddColumn(
+ name: "AllowedMediaTypes",
+ table: "DialogContentType",
+ type: "text[]",
+ nullable: false,
+ defaultValue: new string[0]);
+
+ migrationBuilder.AddColumn(
+ name: "MediaType",
+ table: "DialogContent",
+ type: "character varying(255)",
+ maxLength: 255,
+ nullable: true);
+
+ migrationBuilder.UpdateData(
+ table: "DialogContentType",
+ keyColumn: "Id",
+ keyValue: 1,
+ column: "AllowedMediaTypes",
+ value: new string[0]);
+
+ migrationBuilder.UpdateData(
+ table: "DialogContentType",
+ keyColumn: "Id",
+ keyValue: 2,
+ column: "AllowedMediaTypes",
+ value: new string[0]);
+
+ migrationBuilder.UpdateData(
+ table: "DialogContentType",
+ keyColumn: "Id",
+ keyValue: 3,
+ column: "AllowedMediaTypes",
+ value: new string[0]);
+
+ migrationBuilder.UpdateData(
+ table: "DialogContentType",
+ keyColumn: "Id",
+ keyValue: 4,
+ column: "AllowedMediaTypes",
+ value: new[] { "text/html", "text/plain", "text/markdown" });
+
+ migrationBuilder.UpdateData(
+ table: "DialogContentType",
+ keyColumn: "Id",
+ keyValue: 5,
+ column: "AllowedMediaTypes",
+ value: new string[0]);
+
+ migrationBuilder.InsertData(
+ table: "DialogContentType",
+ columns: new[] { "Id", "AllowedMediaTypes", "MaxLength", "Name", "OutputInList", "Required" },
+ values: new object[] { 6, new[] { "application/vnd.dialogporten.frontchannelembed+json;type=markdown" }, 1023, "MainContentReference", false, false });
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DeleteData(
+ table: "DialogContentType",
+ keyColumn: "Id",
+ keyValue: 6);
+
+ migrationBuilder.DropColumn(
+ name: "AllowedMediaTypes",
+ table: "DialogContentType");
+
+ migrationBuilder.DropColumn(
+ name: "MediaType",
+ table: "DialogContent");
+
+ migrationBuilder.AddColumn(
+ name: "MediaType",
+ table: "DialogElementUrl",
+ type: "character varying(255)",
+ maxLength: 255,
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "RenderAsHtml",
+ table: "DialogContentType",
+ type: "boolean",
+ nullable: false,
+ defaultValue: false);
+
+ migrationBuilder.UpdateData(
+ table: "DialogContentType",
+ keyColumn: "Id",
+ keyValue: 1,
+ column: "RenderAsHtml",
+ value: false);
+
+ migrationBuilder.UpdateData(
+ table: "DialogContentType",
+ keyColumn: "Id",
+ keyValue: 2,
+ column: "RenderAsHtml",
+ value: false);
+
+ migrationBuilder.UpdateData(
+ table: "DialogContentType",
+ keyColumn: "Id",
+ keyValue: 3,
+ column: "RenderAsHtml",
+ value: false);
+
+ migrationBuilder.UpdateData(
+ table: "DialogContentType",
+ keyColumn: "Id",
+ keyValue: 4,
+ column: "RenderAsHtml",
+ value: true);
+
+ migrationBuilder.UpdateData(
+ table: "DialogContentType",
+ keyColumn: "Id",
+ keyValue: 5,
+ column: "RenderAsHtml",
+ value: false);
+ }
+ }
+}
diff --git a/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs
index cc8462ca0..2ced35a75 100644
--- a/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs
+++ b/src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs
@@ -315,6 +315,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property("DialogId")
.HasColumnType("uuid");
+ b.Property("MediaType")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property("TypeId")
.HasColumnType("integer");
@@ -338,6 +342,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property("Id")
.HasColumnType("integer");
+ b.Property("AllowedMediaTypes")
+ .IsRequired()
+ .HasColumnType("text[]");
+
b.Property("MaxLength")
.HasColumnType("integer");
@@ -349,9 +357,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property("OutputInList")
.HasColumnType("boolean");
- b.Property("RenderAsHtml")
- .HasColumnType("boolean");
-
b.Property("Required")
.HasColumnType("boolean");
@@ -363,46 +368,55 @@ protected override void BuildModel(ModelBuilder modelBuilder)
new
{
Id = 1,
+ AllowedMediaTypes = new string[0],
MaxLength = 255,
Name = "Title",
OutputInList = true,
- RenderAsHtml = false,
Required = true
},
new
{
Id = 2,
+ AllowedMediaTypes = new string[0],
MaxLength = 255,
Name = "SenderName",
OutputInList = true,
- RenderAsHtml = false,
Required = false
},
new
{
Id = 3,
+ AllowedMediaTypes = new string[0],
MaxLength = 255,
Name = "Summary",
OutputInList = true,
- RenderAsHtml = false,
Required = true
},
new
{
Id = 4,
+ AllowedMediaTypes = new[] { "text/html", "text/plain", "text/markdown" },
MaxLength = 1023,
Name = "AdditionalInfo",
OutputInList = false,
- RenderAsHtml = true,
Required = false
},
new
{
Id = 5,
+ AllowedMediaTypes = new string[0],
MaxLength = 20,
Name = "ExtendedStatus",
OutputInList = true,
- RenderAsHtml = false,
+ Required = false
+ },
+ new
+ {
+ Id = 6,
+ AllowedMediaTypes = new[] { "application/vnd.dialogporten.frontchannelembed+json;type=markdown" },
+ MaxLength = 1023,
+ Name = "MainContentReference",
+ OutputInList = false,
Required = false
});
});
@@ -721,10 +735,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property("DialogElementId")
.HasColumnType("uuid");
- b.Property("MediaType")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
b.Property("UpdatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
diff --git a/src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/ServiceOwner/Dialogs/Update/UpdateDialogSwaggerConfig.cs b/src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/ServiceOwner/Dialogs/Update/UpdateDialogSwaggerConfig.cs
index a7e32bd5e..f4fc381ab 100644
--- a/src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/ServiceOwner/Dialogs/Update/UpdateDialogSwaggerConfig.cs
+++ b/src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/ServiceOwner/Dialogs/Update/UpdateDialogSwaggerConfig.cs
@@ -83,7 +83,7 @@ public static RouteHandlerBuilder SetDescription(RouteHandlerBuilder builder) =>
new UpdateDialogDialogElementDto
{
Id = Guid.Parse("02a72809-eddd-4192-864d-8f1755d72f4e"),
- Type = new Uri("http://example.com/some-type"),
+ Type = new Uri("https://example.com/some-type"),
DisplayName =
[
new LocalizationDto
@@ -97,8 +97,7 @@ public static RouteHandlerBuilder SetDescription(RouteHandlerBuilder builder) =>
new UpdateDialogDialogElementUrlDto
{
Id = Guid.Parse("858177cb-8584-4d10-a086-3a5defa7a6c3"),
- MediaType = "application/json",
- Url = new Uri("http://example.com/some-url")
+ Url = new Uri("https://example.com/some-url")
}
]
}
diff --git a/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs b/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs
index 4bfab224d..0c264b4b1 100644
--- a/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs
+++ b/src/Digdir.Tool.Dialogporten.GenerateFakeData/DialogGenerator.cs
@@ -293,7 +293,6 @@ public static List GenerateFakeDialogElementUrl
return new Faker()
.RuleFor(o => o.Url, f => new Uri(f.Internet.UrlWithPath()))
.RuleFor(o => o.ConsumerType, f => f.PickRandom())
- .RuleFor(o => o.MediaType, f => f.PickRandom(MediaTypes))
.Generate(new Randomizer().Number(1, 3));
}
@@ -338,6 +337,7 @@ public static List GenerateFakeDialogContent()
content.Add(
new()
{
+ MediaType = Domain.Dialogporten.Domain.MediaTypes.PlainText,
Type = DialogContentType.Values.AdditionalInfo,
Value = GenerateFakeLocalizations(r.Number(10, 20))
}