From 63bdc52f7b865f181f427b90b25e9bacdef8e192 Mon Sep 17 00:00:00 2001 From: CelineTrammi Date: Tue, 29 Oct 2024 15:23:14 +0100 Subject: [PATCH] Remove RestrictionName from AttachmentEntity --- ...st_initialize_and_upload_correspondence.js | 1 - .../CorrespondenceControllerTests.cs | 1 - .../Factories/AttachmentBuilder.cs | 1 - .../Factories/CorrespondenceBuilder.cs | 1 - .../Helpers/AttachmentHelper.cs | 1 - altinn-correspondence-postman-collection.json | 16 +- .../Mappers/AttachmentDetailsMapper.cs | 1 - .../Mappers/AttachmentOverviewMapper.cs | 1 - .../Mappers/CorrespondenceAttachmentMapper.cs | 1 - .../Mappers/InitializeAttachmentMapper.cs | 1 - ...nitializeCorrespondenceAttachmentMapper.cs | 1 - .../Models/BaseAttachmentExt.cs | 10 - .../GetAttachmentDetailsHandler.cs | 1 - .../GetAttachmentDetailsResponse.cs | 2 - .../GetAttachmentOverviewHandler.cs | 1 - .../GetAttachmentOverviewResponse.cs | 2 - .../Models/Entities/AttachmentEntity.cs | 2 - ...ictionNameFromAttachmentEntity.Designer.cs | 507 ++++++++++++++++++ ...ove_RestrictionNameFromAttachmentEntity.cs | 30 ++ .../ApplicationDbContextModelSnapshot.cs | 3 - 20 files changed, 545 insertions(+), 39 deletions(-) create mode 100644 src/Altinn.Correspondence.Persistence/Migrations/20241029141456_Remove_RestrictionNameFromAttachmentEntity.Designer.cs create mode 100644 src/Altinn.Correspondence.Persistence/Migrations/20241029141456_Remove_RestrictionNameFromAttachmentEntity.cs diff --git a/Test/Altinn.Correspondence.LoadTests/test_initialize_and_upload_correspondence.js b/Test/Altinn.Correspondence.LoadTests/test_initialize_and_upload_correspondence.js index 4d4319f9..1f549484 100644 --- a/Test/Altinn.Correspondence.LoadTests/test_initialize_and_upload_correspondence.js +++ b/Test/Altinn.Correspondence.LoadTests/test_initialize_and_upload_correspondence.js @@ -37,7 +37,6 @@ formData.append('Correspondence.content.messageBody', "Test"); formData.append('Correspondence.content.attachments[0].DataLocationType', "ExisitingExternalStorage"); formData.append('Correspondence.content.attachments[0].DataType', "1"); formData.append('Correspondence.content.attachments[0].Name', "testfile.txt"); -formData.append('Correspondence.content.attachments[0].RestrictionName', "testfile.txt"); formData.append('Correspondence.content.attachments[0].Sender', sender); formData.append('Correspondence.content.attachments[0].SendersReference', "1234"); formData.append('Correspondence.content.attachments[0].FileName', "testfile.txt"); diff --git a/Test/Altinn.Correspondence.Tests/CorrespondenceControllerTests.cs b/Test/Altinn.Correspondence.Tests/CorrespondenceControllerTests.cs index 68d96aef..a165df07 100644 --- a/Test/Altinn.Correspondence.Tests/CorrespondenceControllerTests.cs +++ b/Test/Altinn.Correspondence.Tests/CorrespondenceControllerTests.cs @@ -1727,7 +1727,6 @@ private MultipartFormDataContent CorrespondenceToFormData(BaseCorrespondenceExt new { Key = $"correspondence.content.Attachments[{index}].DataType", Value = attachment.DataType }, new { Key = $"correspondence.content.Attachments[{index}].Name", Value = attachment.Name }, new { Key = $"correspondence.content.Attachments[{index}].FileName", Value = attachment.FileName ?? "" }, - new { Key = $"correspondence.content.Attachments[{index}].RestrictionName", Value = attachment.RestrictionName }, new { Key = $"correspondence.content.Attachments[{index}].SendersReference", Value = attachment.SendersReference }, new { Key = $"correspondence.content.Attachments[{index}].IsEncrypted", Value = attachment.IsEncrypted.ToString() } }).SelectMany(x => x).ToList() diff --git a/Test/Altinn.Correspondence.Tests/Factories/AttachmentBuilder.cs b/Test/Altinn.Correspondence.Tests/Factories/AttachmentBuilder.cs index 51f25acf..81a4826d 100644 --- a/Test/Altinn.Correspondence.Tests/Factories/AttachmentBuilder.cs +++ b/Test/Altinn.Correspondence.Tests/Factories/AttachmentBuilder.cs @@ -18,7 +18,6 @@ public AttachmentBuilder CreateAttachment() ResourceId = "1", DataType = "html", Name = "Test file logical name", - RestrictionName = "Test file restriction name", Sender = "0192:986252932", SendersReference = "1234", FileName = "test-file", diff --git a/Test/Altinn.Correspondence.Tests/Factories/CorrespondenceBuilder.cs b/Test/Altinn.Correspondence.Tests/Factories/CorrespondenceBuilder.cs index fe0a09d4..53c2584a 100644 --- a/Test/Altinn.Correspondence.Tests/Factories/CorrespondenceBuilder.cs +++ b/Test/Altinn.Correspondence.Tests/Factories/CorrespondenceBuilder.cs @@ -81,7 +81,6 @@ public CorrespondenceBuilder WithAttachments() { DataType = "html", Name = "2", - RestrictionName = "testFile2", SendersReference = "1234", FileName = "test-fil2e", IsEncrypted = false, diff --git a/Test/Altinn.Correspondence.Tests/Helpers/AttachmentHelper.cs b/Test/Altinn.Correspondence.Tests/Helpers/AttachmentHelper.cs index 7b26e893..69e7996a 100644 --- a/Test/Altinn.Correspondence.Tests/Helpers/AttachmentHelper.cs +++ b/Test/Altinn.Correspondence.Tests/Helpers/AttachmentHelper.cs @@ -16,7 +16,6 @@ public static InitializeCorrespondenceAttachmentExt GetAttachmentMetaData(string { DataType = existingAttachmentData?.DataType ?? "txt", Name = existingAttachmentData?.Name ?? fileName, - RestrictionName = existingAttachmentData?.RestrictionName ?? "testFile3", SendersReference = existingAttachmentData?.SendersReference ?? "1234", FileName = existingAttachmentData?.FileName ?? fileName, IsEncrypted = existingAttachmentData?.IsEncrypted ?? false, diff --git a/altinn-correspondence-postman-collection.json b/altinn-correspondence-postman-collection.json index 2e4b3272..5e436915 100644 --- a/altinn-correspondence-postman-collection.json +++ b/altinn-correspondence-postman-collection.json @@ -1510,7 +1510,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"dataType\": \"html\",\n \"expirationTime\": \"2024-12-12\",\n \"resourceId\": \"{{resource_id}}\",\n \"name\": \"testFile\",\n \"restrictionName\": \"testFile\",\n \"sender\": \"0192:{{senderOrgNo}}\",\n \"sendersReference\": \"1234\",\n \"fileName\": \"test-file\",\n \"isEncrypted\": false\n}", + "raw": "{\n \"dataType\": \"html\",\n \"expirationTime\": \"2024-12-12\",\n \"resourceId\": \"{{resource_id}}\",\n \"name\": \"testFile\",\n \"sender\": \"0192:{{senderOrgNo}}\",\n \"sendersReference\": \"1234\",\n \"fileName\": \"test-file\",\n \"isEncrypted\": false\n}", "options": { "raw": { "headerFamily": "json", @@ -1548,7 +1548,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"restrictionName\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"HumanReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\"\n}", + "raw": "{\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"HumanReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\"\n}", "options": { "raw": { "headerFamily": "json", @@ -1579,7 +1579,7 @@ } ], "cookie": [], - "body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"restrictionName\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\",\n \"attachmentId\": \"\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n}" + "body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\",\n \"attachmentId\": \"\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n}" } ] }, @@ -1670,7 +1670,7 @@ } ], "cookie": [], - "body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"restrictionName\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\",\n \"attachmentId\": \"\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n}" + "body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\",\n \"attachmentId\": \"\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n}" } ] }, @@ -1762,7 +1762,7 @@ } ], "cookie": [], - "body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"restrictionName\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\",\n \"attachmentId\": \"\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n}" + "body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\",\n \"attachmentId\": \"\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n}" } ] }, @@ -1840,7 +1840,7 @@ } ], "cookie": [], - "body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"restrictionName\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\",\n \"attachmentId\": \"\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n}" + "body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\",\n \"attachmentId\": \"\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n}" } ] }, @@ -1920,7 +1920,7 @@ } ], "cookie": [], - "body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"restrictionName\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\",\n \"attachmentId\": \"\",\n \"status\": \"Deleted\",\n \"statusText\": \"\",\n \"statusChanged\": \"\",\n \"statusHistory\": [\n {\n \"status\": \"Failed\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n },\n {\n \"status\": \"Deleted\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n }\n ]\n}" + "body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\",\n \"attachmentId\": \"\",\n \"status\": \"Deleted\",\n \"statusText\": \"\",\n \"statusChanged\": \"\",\n \"statusHistory\": [\n {\n \"status\": \"Failed\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n },\n {\n \"status\": \"Deleted\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n }\n ]\n}" } ] }, @@ -1998,7 +1998,7 @@ } ], "cookie": [], - "body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"restrictionName\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\",\n \"attachmentId\": \"\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n}" + "body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"\",\n \"expirationTime\": \"\",\n \"name\": \"\",\n \"sendersReference\": \"\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"\",\n \"isEncrypted\": \"\",\n \"checksum\": \"\",\n \"attachmentId\": \"\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"\",\n \"statusChanged\": \"\"\n}" } ] } diff --git a/src/Altinn.Correspondence.API/Mappers/AttachmentDetailsMapper.cs b/src/Altinn.Correspondence.API/Mappers/AttachmentDetailsMapper.cs index 213e7c7f..0f01eeae 100644 --- a/src/Altinn.Correspondence.API/Mappers/AttachmentDetailsMapper.cs +++ b/src/Altinn.Correspondence.API/Mappers/AttachmentDetailsMapper.cs @@ -18,7 +18,6 @@ internal static AttachmentDetailsExt MapToExternal(GetAttachmentDetailsResponse FileName = AttachmentDetails.FileName, Name = AttachmentDetails.Name, Sender = AttachmentDetails.Sender, - RestrictionName = AttachmentDetails.RestrictionName, StatusText = AttachmentDetails.StatusText, StatusChanged = AttachmentDetails.StatusChanged, DataType = AttachmentDetails.DataType, diff --git a/src/Altinn.Correspondence.API/Mappers/AttachmentOverviewMapper.cs b/src/Altinn.Correspondence.API/Mappers/AttachmentOverviewMapper.cs index 653f4f89..67595693 100644 --- a/src/Altinn.Correspondence.API/Mappers/AttachmentOverviewMapper.cs +++ b/src/Altinn.Correspondence.API/Mappers/AttachmentOverviewMapper.cs @@ -15,7 +15,6 @@ internal static AttachmentOverviewExt MapToExternal(GetAttachmentOverviewRespons Sender = attachmentOverview.Sender, Name = attachmentOverview.Name, FileName = attachmentOverview.FileName, - RestrictionName = attachmentOverview.RestrictionName, Status = (AttachmentStatusExt)attachmentOverview.Status, StatusText = attachmentOverview.StatusText, Checksum = attachmentOverview.Checksum, diff --git a/src/Altinn.Correspondence.API/Mappers/CorrespondenceAttachmentMapper.cs b/src/Altinn.Correspondence.API/Mappers/CorrespondenceAttachmentMapper.cs index b9856588..55b824c6 100644 --- a/src/Altinn.Correspondence.API/Mappers/CorrespondenceAttachmentMapper.cs +++ b/src/Altinn.Correspondence.API/Mappers/CorrespondenceAttachmentMapper.cs @@ -19,7 +19,6 @@ internal static CorrespondenceAttachmentExt MapToExternal(CorrespondenceAttachme SendersReference = attachment.Attachment.SendersReference, Checksum = attachment.Attachment.Checksum, DataLocationType = (AttachmentDataLocationTypeExt)attachment.Attachment.DataLocationType, - RestrictionName = attachment.Attachment.RestrictionName, Status = (AttachmentStatusExt)attachment.Attachment.GetLatestStatus()!.Status, StatusText = attachment.Attachment.GetLatestStatus()!.StatusText, StatusChanged = attachment.Attachment.GetLatestStatus()!.StatusChanged, diff --git a/src/Altinn.Correspondence.API/Mappers/InitializeAttachmentMapper.cs b/src/Altinn.Correspondence.API/Mappers/InitializeAttachmentMapper.cs index e75c0c49..af6ca536 100644 --- a/src/Altinn.Correspondence.API/Mappers/InitializeAttachmentMapper.cs +++ b/src/Altinn.Correspondence.API/Mappers/InitializeAttachmentMapper.cs @@ -14,7 +14,6 @@ internal static InitializeAttachmentRequest MapToRequest(InitializeAttachmentExt ResourceId = initializeAttachmentExt.ResourceId, FileName = initializeAttachmentExt.FileName, Name = initializeAttachmentExt.Name, - RestrictionName = initializeAttachmentExt.RestrictionName, Sender = initializeAttachmentExt.Sender, SendersReference = initializeAttachmentExt.SendersReference, DataType = initializeAttachmentExt.DataType, diff --git a/src/Altinn.Correspondence.API/Mappers/InitializeCorrespondenceAttachmentMapper.cs b/src/Altinn.Correspondence.API/Mappers/InitializeCorrespondenceAttachmentMapper.cs index 38e37980..200ee593 100644 --- a/src/Altinn.Correspondence.API/Mappers/InitializeCorrespondenceAttachmentMapper.cs +++ b/src/Altinn.Correspondence.API/Mappers/InitializeCorrespondenceAttachmentMapper.cs @@ -17,7 +17,6 @@ internal static CorrespondenceAttachmentEntity MapToEntity(InitializeCorresponde Created = DateTimeOffset.UtcNow, FileName = initializeAttachmentExt.FileName, Name = initializeAttachmentExt.Name, - RestrictionName = initializeAttachmentExt.RestrictionName, ResourceId = resourceId, Sender = sender, SendersReference = initializeAttachmentExt.SendersReference, diff --git a/src/Altinn.Correspondence.API/Models/BaseAttachmentExt.cs b/src/Altinn.Correspondence.API/Models/BaseAttachmentExt.cs index a4fca50b..f41bd4be 100644 --- a/src/Altinn.Correspondence.API/Models/BaseAttachmentExt.cs +++ b/src/Altinn.Correspondence.API/Models/BaseAttachmentExt.cs @@ -20,16 +20,6 @@ public class BaseAttachmentExt [Required] public required string Name { get; set; } - /// - /// The name of the Restriction Policy restricting access to this element - /// - /// - /// An empty value indicates no restriction above the ones governing the correspondence referencing this attachment - /// - [JsonPropertyName("restrictionName")] - [Required] - public string RestrictionName { get; set; } = string.Empty; - /// /// A value indicating whether the attachment is encrypted or not. /// diff --git a/src/Altinn.Correspondence.Application/GetAttachmentDetails/GetAttachmentDetailsHandler.cs b/src/Altinn.Correspondence.Application/GetAttachmentDetails/GetAttachmentDetailsHandler.cs index 3cb685af..5a1348cb 100644 --- a/src/Altinn.Correspondence.Application/GetAttachmentDetails/GetAttachmentDetailsHandler.cs +++ b/src/Altinn.Correspondence.Application/GetAttachmentDetails/GetAttachmentDetailsHandler.cs @@ -48,7 +48,6 @@ public async Task> Process(Guid attac CorrespondenceIds = correspondenceIds, FileName = attachment.FileName, Sender = attachment.Sender, - RestrictionName = attachment.RestrictionName, IsEncrypted = attachment.IsEncrypted, Checksum = attachment.Checksum, }; diff --git a/src/Altinn.Correspondence.Application/GetAttachmentDetails/GetAttachmentDetailsResponse.cs b/src/Altinn.Correspondence.Application/GetAttachmentDetails/GetAttachmentDetailsResponse.cs index fb490a57..d87c28fd 100644 --- a/src/Altinn.Correspondence.Application/GetAttachmentDetails/GetAttachmentDetailsResponse.cs +++ b/src/Altinn.Correspondence.Application/GetAttachmentDetails/GetAttachmentDetailsResponse.cs @@ -27,8 +27,6 @@ public class GetAttachmentDetailsResponse public string DataType { get; set; } = string.Empty; - public string RestrictionName { get; set; } = string.Empty; - public bool IsEncrypted { get; set; } public string Checksum { get; set; } = string.Empty; diff --git a/src/Altinn.Correspondence.Application/GetAttachmentOverview/GetAttachmentOverviewHandler.cs b/src/Altinn.Correspondence.Application/GetAttachmentOverview/GetAttachmentOverviewHandler.cs index 0ccaee0a..f17171ba 100644 --- a/src/Altinn.Correspondence.Application/GetAttachmentOverview/GetAttachmentOverviewHandler.cs +++ b/src/Altinn.Correspondence.Application/GetAttachmentOverview/GetAttachmentOverviewHandler.cs @@ -50,7 +50,6 @@ public async Task> Process(Guid atta CorrespondenceIds = correspondenceIds, FileName = attachment.FileName, Sender = attachment.Sender, - RestrictionName = attachment.RestrictionName, }; return response; } diff --git a/src/Altinn.Correspondence.Application/GetAttachmentOverview/GetAttachmentOverviewResponse.cs b/src/Altinn.Correspondence.Application/GetAttachmentOverview/GetAttachmentOverviewResponse.cs index 722c0069..91458593 100644 --- a/src/Altinn.Correspondence.Application/GetAttachmentOverview/GetAttachmentOverviewResponse.cs +++ b/src/Altinn.Correspondence.Application/GetAttachmentOverview/GetAttachmentOverviewResponse.cs @@ -27,7 +27,5 @@ public class GetAttachmentOverviewResponse public string DataType { get; set; } = string.Empty; - public string RestrictionName { get; set; } = string.Empty; - public List CorrespondenceIds { get; set; } = new List(); } diff --git a/src/Altinn.Correspondence.Core/Models/Entities/AttachmentEntity.cs b/src/Altinn.Correspondence.Core/Models/Entities/AttachmentEntity.cs index cad71cdc..4da1e205 100644 --- a/src/Altinn.Correspondence.Core/Models/Entities/AttachmentEntity.cs +++ b/src/Altinn.Correspondence.Core/Models/Entities/AttachmentEntity.cs @@ -18,8 +18,6 @@ public class AttachmentEntity [MaxLength(255)] public string Name { get; set; } - public string? RestrictionName { get; set; } - public bool IsEncrypted { get; set; } public string? Checksum { get; set; } = string.Empty; diff --git a/src/Altinn.Correspondence.Persistence/Migrations/20241029141456_Remove_RestrictionNameFromAttachmentEntity.Designer.cs b/src/Altinn.Correspondence.Persistence/Migrations/20241029141456_Remove_RestrictionNameFromAttachmentEntity.Designer.cs new file mode 100644 index 00000000..94ee564a --- /dev/null +++ b/src/Altinn.Correspondence.Persistence/Migrations/20241029141456_Remove_RestrictionNameFromAttachmentEntity.Designer.cs @@ -0,0 +1,507 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Altinn.Correspondence.Persistence.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20241029141456_Remove_RestrictionNameFromAttachmentEntity")] + partial class Remove_RestrictionNameFromAttachmentEntity + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("correspondence") + .HasAnnotation("ProductVersion", "8.0.6") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "hstore"); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.AttachmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Checksum") + .HasColumnType("text"); + + b.Property("Created") + .HasColumnType("timestamp with time zone"); + + b.Property("DataLocationType") + .HasColumnType("integer"); + + b.Property("DataLocationUrl") + .HasColumnType("text"); + + b.Property("DataType") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("IsEncrypted") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("ResourceId") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Sender") + .IsRequired() + .HasColumnType("text"); + + b.Property("SendersReference") + .IsRequired() + .HasMaxLength(4096) + .HasColumnType("character varying(4096)"); + + b.HasKey("Id"); + + b.ToTable("Attachments", "correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.AttachmentStatusEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AttachmentId") + .HasColumnType("uuid"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("StatusChanged") + .HasColumnType("timestamp with time zone"); + + b.Property("StatusText") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AttachmentId"); + + b.ToTable("AttachmentStatuses", "correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceAttachmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AttachmentId") + .HasColumnType("uuid"); + + b.Property("CorrespondenceContentId") + .HasColumnType("uuid"); + + b.Property("Created") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpirationTime") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AttachmentId"); + + b.HasIndex("CorrespondenceContentId"); + + b.ToTable("CorrespondenceAttachments", "correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceContentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CorrespondenceId") + .HasColumnType("uuid"); + + b.Property("Language") + .IsRequired() + .HasColumnType("text"); + + b.Property("MessageBody") + .IsRequired() + .HasColumnType("text"); + + b.Property("MessageSummary") + .IsRequired() + .HasColumnType("text"); + + b.Property("MessageTitle") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CorrespondenceId") + .IsUnique(); + + b.ToTable("CorrespondenceContents", "correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AllowSystemDeleteAfter") + .HasColumnType("timestamp with time zone"); + + b.Property("Altinn2CorrespondenceId") + .HasColumnType("integer"); + + b.Property("Created") + .HasColumnType("timestamp with time zone"); + + b.Property("DueDateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("IgnoreReservation") + .HasColumnType("boolean"); + + b.Property("IsConfirmationNeeded") + .HasColumnType("boolean"); + + b.Property("MarkedUnread") + .HasColumnType("boolean"); + + b.Property("MessageSender") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property>("PropertyList") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("hstore"); + + b.Property("Published") + .HasColumnType("timestamp with time zone"); + + b.Property("Recipient") + .IsRequired() + .HasColumnType("text"); + + b.Property("RequestedPublishTime") + .HasColumnType("timestamp with time zone"); + + b.Property("ResourceId") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Sender") + .IsRequired() + .HasColumnType("text"); + + b.Property("SendersReference") + .IsRequired() + .HasMaxLength(4096) + .HasColumnType("character varying(4096)"); + + b.HasKey("Id"); + + b.ToTable("Correspondences", "correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceNotificationEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Altinn2NotificationId") + .HasColumnType("integer"); + + b.Property("CorrespondenceId") + .HasColumnType("uuid"); + + b.Property("Created") + .HasColumnType("timestamp with time zone"); + + b.Property("IsReminder") + .HasColumnType("boolean"); + + b.Property("NotificationAddress") + .HasColumnType("text"); + + b.Property("NotificationChannel") + .HasColumnType("integer"); + + b.Property("NotificationOrderId") + .HasColumnType("uuid"); + + b.Property("NotificationSent") + .HasColumnType("timestamp with time zone"); + + b.Property("NotificationTemplate") + .HasColumnType("integer"); + + b.Property("RequestedSendTime") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CorrespondenceId"); + + b.ToTable("CorrespondenceNotifications", "correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceReplyOptionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CorrespondenceId") + .HasColumnType("uuid"); + + b.Property("LinkText") + .HasColumnType("text"); + + b.Property("LinkURL") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CorrespondenceId"); + + b.ToTable("CorrespondenceReplyOptions", "correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceStatusEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CorrespondenceId") + .HasColumnType("uuid"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("StatusChanged") + .HasColumnType("timestamp with time zone"); + + b.Property("StatusText") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CorrespondenceId"); + + b.ToTable("CorrespondenceStatuses", "correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.ExternalReferenceEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CorrespondenceId") + .HasColumnType("uuid"); + + b.Property("ReferenceType") + .HasColumnType("integer"); + + b.Property("ReferenceValue") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CorrespondenceId"); + + b.ToTable("ExternalReferences", "correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.NotificationTemplateEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EmailBody") + .IsRequired() + .HasColumnType("text"); + + b.Property("EmailSubject") + .IsRequired() + .HasColumnType("text"); + + b.Property("Language") + .HasColumnType("text"); + + b.Property("RecipientType") + .HasColumnType("integer"); + + b.Property("ReminderEmailBody") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReminderEmailSubject") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReminderSmsBody") + .IsRequired() + .HasColumnType("text"); + + b.Property("SmsBody") + .IsRequired() + .HasColumnType("text"); + + b.Property("Template") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("NotificationTemplates", "correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.AttachmentStatusEntity", b => + { + b.HasOne("Altinn.Correspondence.Core.Models.Entities.AttachmentEntity", "Attachment") + .WithMany("Statuses") + .HasForeignKey("AttachmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Attachment"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceAttachmentEntity", b => + { + b.HasOne("Altinn.Correspondence.Core.Models.Entities.AttachmentEntity", "Attachment") + .WithMany("CorrespondenceAttachments") + .HasForeignKey("AttachmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Altinn.Correspondence.Core.Models.Entities.CorrespondenceContentEntity", "CorrespondenceContent") + .WithMany("Attachments") + .HasForeignKey("CorrespondenceContentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Attachment"); + + b.Navigation("CorrespondenceContent"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceContentEntity", b => + { + b.HasOne("Altinn.Correspondence.Core.Models.Entities.CorrespondenceEntity", "Correspondence") + .WithOne("Content") + .HasForeignKey("Altinn.Correspondence.Core.Models.Entities.CorrespondenceContentEntity", "CorrespondenceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceNotificationEntity", b => + { + b.HasOne("Altinn.Correspondence.Core.Models.Entities.CorrespondenceEntity", "Correspondence") + .WithMany("Notifications") + .HasForeignKey("CorrespondenceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceReplyOptionEntity", b => + { + b.HasOne("Altinn.Correspondence.Core.Models.Entities.CorrespondenceEntity", "Correspondence") + .WithMany("ReplyOptions") + .HasForeignKey("CorrespondenceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceStatusEntity", b => + { + b.HasOne("Altinn.Correspondence.Core.Models.Entities.CorrespondenceEntity", "Correspondence") + .WithMany("Statuses") + .HasForeignKey("CorrespondenceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.ExternalReferenceEntity", b => + { + b.HasOne("Altinn.Correspondence.Core.Models.Entities.CorrespondenceEntity", "Correspondence") + .WithMany("ExternalReferences") + .HasForeignKey("CorrespondenceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Correspondence"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.AttachmentEntity", b => + { + b.Navigation("CorrespondenceAttachments"); + + b.Navigation("Statuses"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceContentEntity", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Altinn.Correspondence.Core.Models.Entities.CorrespondenceEntity", b => + { + b.Navigation("Content"); + + b.Navigation("ExternalReferences"); + + b.Navigation("Notifications"); + + b.Navigation("ReplyOptions"); + + b.Navigation("Statuses"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Altinn.Correspondence.Persistence/Migrations/20241029141456_Remove_RestrictionNameFromAttachmentEntity.cs b/src/Altinn.Correspondence.Persistence/Migrations/20241029141456_Remove_RestrictionNameFromAttachmentEntity.cs new file mode 100644 index 00000000..993bba9d --- /dev/null +++ b/src/Altinn.Correspondence.Persistence/Migrations/20241029141456_Remove_RestrictionNameFromAttachmentEntity.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Altinn.Correspondence.Persistence.Migrations +{ + /// + public partial class Remove_RestrictionNameFromAttachmentEntity : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "RestrictionName", + schema: "correspondence", + table: "Attachments"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "RestrictionName", + schema: "correspondence", + table: "Attachments", + type: "text", + nullable: true); + } + } +} diff --git a/src/Altinn.Correspondence.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Altinn.Correspondence.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs index d5c59840..726b5b03 100644 --- a/src/Altinn.Correspondence.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Altinn.Correspondence.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs @@ -63,9 +63,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(255) .HasColumnType("character varying(255)"); - b.Property("RestrictionName") - .HasColumnType("text"); - b.Property("Sender") .IsRequired() .HasColumnType("text");