Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove RestrictionName from AttachmentEntity #414

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public CorrespondenceBuilder WithAttachments()
{
DataType = "html",
Name = "2",
RestrictionName = "testFile2",
SendersReference = "1234",
FileName = "test-fil2e",
IsEncrypted = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions altinn-correspondence-postman-collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -1548,7 +1548,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"restrictionName\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"HumanReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\"\n}",
"raw": "{\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"HumanReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\"\n}",
"options": {
"raw": {
"headerFamily": "json",
Expand Down Expand Up @@ -1579,7 +1579,7 @@
}
],
"cookie": [],
"body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"restrictionName\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\",\n \"attachmentId\": \"<uuid>\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n}"
"body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\",\n \"attachmentId\": \"<uuid>\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n}"
}
]
},
Expand Down Expand Up @@ -1670,7 +1670,7 @@
}
],
"cookie": [],
"body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"restrictionName\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\",\n \"attachmentId\": \"<uuid>\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n}"
"body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\",\n \"attachmentId\": \"<uuid>\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n}"
}
]
},
Expand Down Expand Up @@ -1762,7 +1762,7 @@
}
],
"cookie": [],
"body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"restrictionName\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\",\n \"attachmentId\": \"<uuid>\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n}"
"body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\",\n \"attachmentId\": \"<uuid>\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n}"
}
]
},
Expand Down Expand Up @@ -1840,7 +1840,7 @@
}
],
"cookie": [],
"body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"restrictionName\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\",\n \"attachmentId\": \"<uuid>\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n}"
"body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\",\n \"attachmentId\": \"<uuid>\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n}"
}
]
},
Expand Down Expand Up @@ -1920,7 +1920,7 @@
}
],
"cookie": [],
"body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"restrictionName\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\",\n \"attachmentId\": \"<uuid>\",\n \"status\": \"Deleted\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\",\n \"statusHistory\": [\n {\n \"status\": \"Failed\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n },\n {\n \"status\": \"Deleted\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n }\n ]\n}"
"body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\",\n \"attachmentId\": \"<uuid>\",\n \"status\": \"Deleted\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\",\n \"statusHistory\": [\n {\n \"status\": \"Failed\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n },\n {\n \"status\": \"Deleted\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n }\n ]\n}"
}
]
},
Expand Down Expand Up @@ -1998,7 +1998,7 @@
}
],
"cookie": [],
"body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"restrictionName\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\",\n \"attachmentId\": \"<uuid>\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n}"
"body": "{\n \"dataLocationUrl\": \"ExternalStorage\",\n \"dataType\": \"<string>\",\n \"expirationTime\": \"<dateTime>\",\n \"name\": \"<string>\",\n \"sendersReference\": \"<string>\",\n \"usageType\": \"MachineReadable\",\n \"fileName\": \"<string>\",\n \"isEncrypted\": \"<boolean>\",\n \"checksum\": \"<string>\",\n \"attachmentId\": \"<uuid>\",\n \"status\": \"UploadProcessing\",\n \"statusText\": \"<string>\",\n \"statusChanged\": \"<dateTime>\"\n}"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 0 additions & 10 deletions src/Altinn.Correspondence.API/Models/BaseAttachmentExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ public class BaseAttachmentExt
[Required]
public required string Name { get; set; }

/// <summary>
/// The name of the Restriction Policy restricting access to this element
/// </summary>
/// <remarks>
/// An empty value indicates no restriction above the ones governing the correspondence referencing this attachment
/// </remarks>
[JsonPropertyName("restrictionName")]
[Required]
public string RestrictionName { get; set; } = string.Empty;

/// <summary>
/// A value indicating whether the attachment is encrypted or not.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public async Task<OneOf<GetAttachmentDetailsResponse, Error>> Process(Guid attac
CorrespondenceIds = correspondenceIds,
FileName = attachment.FileName,
Sender = attachment.Sender,
RestrictionName = attachment.RestrictionName,
IsEncrypted = attachment.IsEncrypted,
Checksum = attachment.Checksum,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public async Task<OneOf<GetAttachmentOverviewResponse, Error>> Process(Guid atta
CorrespondenceIds = correspondenceIds,
FileName = attachment.FileName,
Sender = attachment.Sender,
RestrictionName = attachment.RestrictionName,
};
return response;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,5 @@ public class GetAttachmentOverviewResponse

public string DataType { get; set; } = string.Empty;

public string RestrictionName { get; set; } = string.Empty;

public List<Guid> CorrespondenceIds { get; set; } = new List<Guid>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
public string? FileName { get; set; }

[MaxLength(255)]
public string Name { get; set; }

Check warning on line 19 in src/Altinn.Correspondence.Core/Models/Entities/AttachmentEntity.cs

View workflow job for this annotation

GitHub Actions / Test application

Non-nullable property 'Name' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public string? RestrictionName { get; set; }

public bool IsEncrypted { get; set; }

public string? Checksum { get; set; } = string.Empty;
Expand Down
Loading
Loading