Skip to content

Commit

Permalink
--wip-- [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
oskogstad committed Jan 8, 2025
1 parent 8d37af7 commit 797e755
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public static IServiceCollection AddApplication(this IServiceCollection services
// 'CreatedAt', not 'Created At'.
ValidatorOptions.Global.DisplayNameResolver = (_, member, _) => member?.Name;

// AddDomain
// Lag lik extension i domain

services
// Framework
.AddAutoMapper(thisAssembly)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@ internal sealed class ConvertDomainEventsToOutboxMessagesInterceptor : SaveChang
private readonly Lazy<ITopicEventSender> _topicEventSender;
private readonly ILogger<ConvertDomainEventsToOutboxMessagesInterceptor> _logger;
private readonly Lazy<IPublishEndpoint> _publishEndpoint;
private readonly IDomainEventMetadataContext _domainEventContext;

private List<IDomainEvent> _domainEvents = [];

public ConvertDomainEventsToOutboxMessagesInterceptor(
ITransactionTime transactionTime,
Lazy<ITopicEventSender> topicEventSender,
ILogger<ConvertDomainEventsToOutboxMessagesInterceptor> logger,
Lazy<IPublishEndpoint> publishEndpoint)
Lazy<IPublishEndpoint> publishEndpoint,
IDomainEventMetadataContext domainEventContext)
{
_transactionTime = transactionTime ?? throw new ArgumentNullException(nameof(transactionTime));
_topicEventSender = topicEventSender ?? throw new ArgumentNullException(nameof(topicEventSender));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_publishEndpoint = publishEndpoint ?? throw new ArgumentNullException(nameof(publishEndpoint));
_domainEventContext = domainEventContext;
}

public override async ValueTask<InterceptionResult<int>> SavingChangesAsync(
Expand Down
1 change: 1 addition & 0 deletions src/Digdir.Domain.Dialogporten.WebApi/Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ internal static class Constants

internal static class SwaggerSummary
{
internal const string DisableEvents = "Disable events const";
internal const string ReturnedResult = "Successfully returned the dialog {0}.";
internal const string Created = "The UUID of the created dialog {0}. A relative URL to the newly created activity is set in the \"Location\" header.";
internal const string Deleted = "The dialog {0} was deleted successfully.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Commands.Create;
using System.ComponentModel;
using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Commands.Create;
using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Queries.Get;
using Digdir.Domain.Dialogporten.WebApi.Common;
using Digdir.Domain.Dialogporten.WebApi.Common.Authorization;
Expand Down Expand Up @@ -33,7 +34,7 @@ public override void Configure()

public override async Task HandleAsync(CreateDialogRequest req, CancellationToken ct)
{
var command = new CreateDialogCommand { Dto = req.Dto, DisableEvents = req.DisableEvents };
var command = new CreateDialogCommand { Dto = req.Dto, DisableEvents = req.DisableEvents ?? false };
var result = await _sender.Send(command, ct);
await result.Match(
success =>
Expand All @@ -50,7 +51,9 @@ await result.Match(

public sealed class CreateDialogRequest
{
public bool DisableEvents { get; init; }
[QueryParam]
[Description(Constants.SwaggerSummary.DisableEvents)]
public bool? DisableEvents { get; init; }

[FromBody]
public CreateDialogDto Dto { get; set; } = null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public override async Task HandleAsync(UpdateDialogRequest req, CancellationToke
Id = req.DialogId,
IfMatchDialogRevision = req.IfMatchDialogRevision,
Dto = req.Dto,
DisableEvents = req.DisableEvents
DisableEvents = req.DisableEvents ?? false
};

var updateDialogResult = await _sender.Send(command, ct);
Expand Down Expand Up @@ -67,5 +67,6 @@ public sealed class UpdateDialogRequest
[FromHeader(headerName: Constants.IfMatch, isRequired: false, removeFromSchema: true)]
public Guid? IfMatchDialogRevision { get; set; }

public bool DisableEvents { get; init; }
[QueryParam]
public bool? DisableEvents { get; init; }
}

0 comments on commit 797e755

Please sign in to comment.