-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix: ensure performed by is set for activities #628
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
0bd8cac
fix: ensure performed by is set for activities
arealmaas a6c78a5
fix: ensure performed by is set for activities
arealmaas 14a2c27
fix: ensure performed by is set for activities
arealmaas a08acec
fix: ensure performed by is set for activities
arealmaas 69b8d6e
Merge branch 'main' into fix/ensure-performed-by-is-set
arealmaas ac0df9e
refactore
arealmaas 152669b
clean me up
arealmaas c56f780
Update tests/Digdir.Domain.Dialogporten.Application.Integration.Tests…
arealmaas dfb1410
[skip-ci] Update src/Digdir.Domain.Dialogporten.Application/Features/…
arealmaas c2ec426
[skip-ci] Update src/Digdir.Domain.Dialogporten.Application/Features/…
arealmaas e38ecd5
cleanup
arealmaas a29a834
start doing things
arealmaas 4fdf5ee
ipw
arealmaas d2d48d5
yoyo
arealmaas cf1c449
cleanup
arealmaas f083dc1
Merge branch 'main' into fix/ensure-performed-by-is-set
arealmaas ee10f9c
cleanup
arealmaas df2f5cc
cleanup
arealmaas faa15b9
Merge branch 'main' into fix/ensure-performed-by-is-set
arealmaas 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 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 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
35 changes: 35 additions & 0 deletions
35
src/Digdir.Domain.Dialogporten.Application/Common/Services/DialogActivityService.cs
This file contains 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,35 @@ | ||
using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Activities; | ||
using Digdir.Domain.Dialogporten.Domain.Localizations; | ||
|
||
namespace Digdir.Domain.Dialogporten.Application.Common.Services; | ||
|
||
public interface IDialogActivityService | ||
{ | ||
Task EnsurePerformedByIsSetForActivities(IEnumerable<DialogActivity> activities, CancellationToken cancellationToken); | ||
} | ||
|
||
public class DialogActivityService : IDialogActivityService | ||
{ | ||
private readonly IUserOrganizationRegistry _userOrganizationRegistry; | ||
|
||
public DialogActivityService( | ||
IUserOrganizationRegistry userOrganizationRegistry | ||
) | ||
{ | ||
_userOrganizationRegistry = userOrganizationRegistry; | ||
} | ||
|
||
public async Task EnsurePerformedByIsSetForActivities(IEnumerable<DialogActivity> activities, CancellationToken cancellationToken) | ||
{ | ||
// TODO: if organization cannot be found we need to handle this. Put on a queue to be retried later(?) https://github.com/digdir/dialogporten/issues/639 | ||
foreach (var activity in activities) | ||
{ | ||
var organizationLongNames = await _userOrganizationRegistry.GetCurrentUserOrgLongNames(cancellationToken); | ||
activity.PerformedBy ??= new DialogActivityPerformedBy | ||
{ | ||
Localizations = organizationLongNames?.Select(x => new Localization { Value = x.LongName, CultureCode = x.Language }).ToList() ?? new List<Localization>(), | ||
}; | ||
} | ||
} | ||
} | ||
|
This file contains 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 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 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 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ikke innført i denne PR-en, men jeg synes at bruken av "organization" blir misvisende, siden det er snakk om tjenesteeiere (som vi ellers kaller "service owners") og ikke bare hvilken som helst organisasjon. Har eksperimentert litt i en branch, som jeg mener har en bedre oppdeling mht externals-servicene og "current user"-servicene, som altså er sammenstillingene av IUser og externals-ene (implementasjonen har dog andre problemer som er knyttet til usertype, så den er ikke brukanes pt)