-
Notifications
You must be signed in to change notification settings - Fork 22
Use streaming endpoints for streams in Correspondence #1423
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
Draft
Ceredron
wants to merge
50
commits into
Altinn:main
Choose a base branch
from
Ceredron:feat/upload-using-json
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+654
−65
Draft
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
28fb6c6
Stream Correspondence attachments to support large file upload
Ceredron c8d5744
Fix build
Ceredron 1d1d245
Fix build
Ceredron 0a37109
Revert "Fix build"
Ceredron 6fc12c1
Revert "Fix build"
Ceredron 6f1e076
Fix tests
Ceredron 29fb277
Typo
Ceredron eb5cb3a
Fix more tests
Ceredron c8d453d
Merge branch 'main' into feat/streamed-correspondence-upload
Ceredron fb8f85a
Formatting
Ceredron 61805b8
Merge branch 'feat/streamed-correspondence-upload' of https://github.…
Ceredron d3a6ad1
Break API
Ceredron 33dcf0b
Expanded interface to include stream implementation
Ceredron 4af8625
Break
Ceredron 2dccc09
Tempfix for testing streaming response
Ceredron ad99a4d
Only stream when necessary
Ceredron 96211e1
"Non-breaking" version
Ceredron 55b8fde
Fix build
Ceredron 4165255
Bang some tests
Ceredron e6a0504
Re-factor to try to break less
Ceredron 460e830
Use ResponseStreamWrapper to ensure correct disposal of response mess…
Ceredron 7c7031d
Xml docs
Ceredron cc5de34
Streams needs to be suffixed with Stream
Ceredron 8821d7b
Small fixes
Ceredron f30c680
More fix
Ceredron 574f29a
Internalize 'ResponseWrapperStream', disposal, extend XML docs for c…
martinothamar dbd86ab
Experiment to use REST instead of Form endpoints
Ceredron 723e980
Formatting etc
Ceredron 527bf2c
API for experiment
Ceredron 351cddd
Revert "API for experiment"
Ceredron dc7485a
Revert "Formatting etc"
Ceredron 351ad4f
Revert "Experiment to use REST instead of Form endpoints"
Ceredron d600d0a
Merge branch 'main' into feat/streamed-correspondence-upload
martinothamar 0379ca8
New experiment
Ceredron f8ae91f
Merge branch 'feat/streamed-correspondence-upload' of https://github.…
Ceredron 2204363
Remove usings
Ceredron 1c3d196
Fix logic and added test
Ceredron b695d8c
Fix formatting
Ceredron e96ee08
Revert test
Ceredron 8a59a16
Added content length forwarding
Ceredron 570c6b6
Added xmldoc
Ceredron c37765b
Chunk encoding
Ceredron 20b0ba2
Fix bug with wrong reference to existingAttachments field
Ceredron a10726a
Revert length in response wrapper
Ceredron b1b78d0
Empty out references to now spun streams
Ceredron b4114d9
ExistingAttachments test fixes
Ceredron 6ead297
Remove old xmldoc
Ceredron 7754775
Simplify httpclient because no longer big individual calls
Ceredron ad0064d
Try to increase timeout for Storage connection
Ceredron a2a4320
Merge branch 'main' into feat/upload-using-json
Ceredron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/Altinn.App.Core/Features/Correspondence/Models/AttachmentPayload.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| namespace Altinn.App.Core.Features.Correspondence.Models; | ||
|
|
||
| /// <summary> | ||
| /// Represents the payload for sending an attachment. | ||
| /// </summary> | ||
| internal class AttachmentPayload | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the Resource Id for the correspondence service. | ||
| /// </summary> | ||
| public required string ResourceId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The name of the attachment file. | ||
| /// </summary> | ||
| public string? FileName { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// A logical name for the file, which will be shown in Altinn Inbox. | ||
| /// </summary> | ||
| public string? DisplayName { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// A value indicating whether the attachment is encrypted or not. | ||
| /// </summary> | ||
| public required bool IsEncrypted { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// A reference value given to the attachment by the creator. | ||
| /// </summary> | ||
| public required string SendersReference { get; set; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/Altinn.App.Core/Features/Correspondence/Models/CorrespondenceAttachmentInMemory.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| namespace Altinn.App.Core.Features.Correspondence.Models; | ||
|
|
||
| /// <summary> | ||
| /// Represents an attachment to a correspondence. | ||
| /// </summary> | ||
| public record CorrespondenceAttachmentInMemory : CorrespondenceAttachment | ||
| { | ||
| /// <summary> | ||
| /// The data content. | ||
| /// </summary> | ||
| public required ReadOnlyMemory<byte> Data { get; init; } | ||
|
|
||
| internal override void Serialise(MultipartFormDataContent content, int index, string? filenameOverride = null) | ||
| { | ||
| const string typePrefix = "Correspondence.Content.Attachments"; | ||
| string prefix = $"{typePrefix}[{index}]"; | ||
| string actualFilename = filenameOverride ?? Filename; | ||
|
|
||
| AddRequired(content, actualFilename, $"{prefix}.Filename"); | ||
| AddRequired(content, SendersReference, $"{prefix}.SendersReference"); | ||
| AddRequired(content, DataLocationType.ToString(), $"{prefix}.DataLocationType"); | ||
| AddRequired(content, Data, "Attachments", actualFilename); | ||
| AddIfNotNull(content, IsEncrypted?.ToString(), $"{prefix}.IsEncrypted"); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Dereferenced variable may be null Warning