-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Use data from events, not from db (#455)
- Loading branch information
Showing
14 changed files
with
159 additions
and
141 deletions.
There are no files selected for viewing
49 changes: 18 additions & 31 deletions
49
...ialogporten.Application/Features/V1/Common/Events/DialogActivityEventToAltinnForwarder.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
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
20 changes: 3 additions & 17 deletions
20
...in.Dialogporten.Application/Features/V1/Common/Events/DomainEventToAltinnForwarderBase.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 |
---|---|---|
@@ -1,33 +1,19 @@ | ||
using Digdir.Domain.Dialogporten.Application.Externals; | ||
using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace Digdir.Domain.Dialogporten.Application.Features.V1.Common.Events; | ||
|
||
internal class DomainEventToAltinnForwarderBase | ||
{ | ||
protected readonly ICloudEventBus CloudEventBus; | ||
protected readonly IDialogDbContext Db; | ||
private readonly DialogportenSettings _dialogportenSettings; | ||
|
||
protected DomainEventToAltinnForwarderBase(ICloudEventBus cloudEventBus, IDialogDbContext db, IOptions<ApplicationSettings> settings) | ||
protected DomainEventToAltinnForwarderBase(ICloudEventBus cloudEventBus, IOptions<ApplicationSettings> settings) | ||
{ | ||
CloudEventBus = cloudEventBus ?? throw new ArgumentNullException(nameof(cloudEventBus)); | ||
Db = db ?? throw new ArgumentNullException(nameof(db)); | ||
_dialogportenSettings = settings.Value.Dialogporten ?? throw new ArgumentNullException(nameof(settings)); | ||
} | ||
|
||
protected string DialogportenBaseUrl() => _dialogportenSettings.BaseUri.ToString(); | ||
|
||
protected async Task<DialogEntity> GetDialog(Guid dialogId, CancellationToken cancellationToken) | ||
{ | ||
var dialog = await Db.Dialogs | ||
.IgnoreQueryFilters() | ||
.AsNoTracking() | ||
.FirstOrDefaultAsync(x => x.Id == dialogId, cancellationToken) | ||
?? throw new KeyNotFoundException($"Dialog with id {dialogId} not found"); | ||
|
||
return dialog; | ||
} | ||
internal string SourceBaseUrl() => | ||
$"{_dialogportenSettings.BaseUri}/api/v1/enduser/dialogs/"; | ||
} |
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
Oops, something went wrong.