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

Or 2638 duplicatebug #1044

Merged
merged 4 commits into from
Jan 15, 2025
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 @@ -4,14 +4,15 @@
using Hosts.Configuration.ConfigurationBindings;
using Nest;
using Schema.Search;
using System.Text;

public static class ElasticSearchExtensions
{
public static IServiceCollection AddElasticSearch(
this IServiceCollection services,
ElasticSearchOptionsSection elasticSearchOptions)
ElasticSearchOptionsSection elasticSearchOptions, ILogger<IElasticClient> logger)
{
var elasticClient = CreateElasticClient(elasticSearchOptions);
var elasticClient = CreateElasticClient(elasticSearchOptions, logger);

EnsureIndexExists(elasticClient,
elasticSearchOptions.Indices!.Verenigingen!,
Expand All @@ -35,7 +36,7 @@ public static void EnsureIndexExists(
elasticClient.Indices.CreateDuplicateDetectionIndex(duplicateDetectionIndexName);
}

private static ElasticClient CreateElasticClient(ElasticSearchOptionsSection elasticSearchOptions)
public static ElasticClient CreateElasticClient(ElasticSearchOptionsSection elasticSearchOptions, ILogger logger)
{
var settings = new ConnectionSettings(new Uri(elasticSearchOptions.Uri!))
.BasicAuthentication(
Expand All @@ -45,6 +46,23 @@ private static ElasticClient CreateElasticClient(ElasticSearchOptionsSection ela
.MapVerenigingDocument(elasticSearchOptions.Indices!.Verenigingen!)
.MapDuplicateDetectionDocument(elasticSearchOptions.Indices!.DuplicateDetection!);

if (elasticSearchOptions.EnableDevelopmentLogs)
settings = settings.DisableDirectStreaming()
.PrettyJson()
.OnRequestCompleted(apiCallDetails =>
{
if (apiCallDetails.RequestBodyInBytes != null)
logger.LogDebug(
message: "{HttpMethod} {Uri} \n {RequestBody}",
apiCallDetails.HttpMethod,
apiCallDetails.Uri,
Encoding.UTF8.GetString(apiCallDetails.RequestBodyInBytes));

if (apiCallDetails.ResponseBodyInBytes != null)
logger.LogDebug(message: "Response: {ResponseBody}",
Encoding.UTF8.GetString(apiCallDetails.ResponseBodyInBytes));
});

var elasticClient = new ElasticClient(settings);

return elasticClient;
Expand All @@ -61,8 +79,11 @@ public static ConnectionSettings MapVerenigingDocument(this ConnectionSettings s
public static ConnectionSettings MapDuplicateDetectionDocument(this ConnectionSettings settings, string indexName)
{
return settings.DefaultMappingFor(
typeof(DuplicateDetectionDocument),
selector: descriptor => descriptor.IndexName(indexName)
.IdProperty(nameof(DuplicateDetectionDocument.VCode)));
typeof(DuplicateDetectionDocument),
selector: descriptor => descriptor.IndexName(indexName)
.IdProperty(nameof(DuplicateDetectionDocument.VCode)))
.DefaultMappingFor(typeof(DuplicateDetectionUpdateDocument),
selector: descriptor => descriptor.IndexName(indexName)
.IdProperty(nameof(DuplicateDetectionDocument.VCode)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,15 @@ public static IServiceCollection ConfigureElasticSearch(
this IServiceCollection services,
ElasticSearchOptionsSection elasticSearchOptions)
{
var elasticClient = CreateElasticClient(elasticSearchOptions);

ElasticSearchExtensions.EnsureIndexExists(elasticClient,
elasticSearchOptions.Indices!.Verenigingen!,
elasticSearchOptions.Indices!.DuplicateDetection!);
var elasticClient = (IServiceProvider serviceProvider)
=> ElasticSearchExtensions.CreateElasticClient(elasticSearchOptions, serviceProvider.GetRequiredService<ILogger<ElasticClient>>());

services.AddSingleton(elasticSearchOptions);

services.AddSingleton(_ => elasticClient);
services.AddSingleton<IElasticClient>(_ => elasticClient);
services.AddSingleton(sp => elasticClient(sp));

return services;
}
services.AddSingleton<IElasticClient>(sp => sp.GetRequiredService<ElasticClient>());

private static ElasticClient CreateElasticClient(ElasticSearchOptionsSection elasticSearchOptions)
{
var settings = new ConnectionSettings(new Uri(elasticSearchOptions.Uri!))
.BasicAuthentication(
elasticSearchOptions.Username,
elasticSearchOptions.Password)
.MapVerenigingDocument(elasticSearchOptions.Indices!.Verenigingen!)
.MapDuplicateDetectionDocument(elasticSearchOptions.Indices.DuplicateDetection!);

var elasticClient = new ElasticClient(settings);

return elasticClient;
return services;
}
}
5 changes: 5 additions & 0 deletions src/AssociationRegistry.Admin.ProjectionHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace AssociationRegistry.Admin.ProjectionHost;
using Asp.Versioning.ApplicationModels;
using Extensions;
using Infrastructure.ConfigurationBindings;
using Infrastructure.Extensions;
using Infrastructure.Json;
using Infrastructure.Metrics;
using Infrastructure.Program;
Expand Down Expand Up @@ -78,6 +79,10 @@ public static async Task Main(string[] args)

var app = builder.Build();

ElasticSearchExtensions.EnsureIndexExists(app.Services.GetRequiredService<IElasticClient>(),
elasticSearchOptions.Indices!.Verenigingen!,
elasticSearchOptions.Indices!.DuplicateDetection!);

app.AddProjectionEndpoints(
app.Configuration.GetSection(RebuildConfigurationSection.SectionName).Get<RebuildConfigurationSection>()!);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task Handle(EventEnvelope<VerenigingMetRechtspersoonlijkheidWerdGer
public async Task Handle(EventEnvelope<NaamWerdGewijzigd> message)
=> await _elasticRepository.UpdateAsync(
message.Data.VCode,
new DuplicateDetectionDocument
new DuplicateDetectionUpdateDocument
{
Naam = message.Data.Naam,
}
Expand All @@ -58,7 +58,7 @@ public async Task Handle(EventEnvelope<NaamWerdGewijzigd> message)
public async Task Handle(EventEnvelope<RechtsvormWerdGewijzigdInKBO> message)
=> await _elasticRepository.UpdateAsync(
message.VCode,
new DuplicateDetectionDocument
new DuplicateDetectionUpdateDocument
{
VerenigingsTypeCode = Verenigingstype.Parse(message.Data.Rechtsvorm).Code,
}
Expand All @@ -67,7 +67,7 @@ public async Task Handle(EventEnvelope<RechtsvormWerdGewijzigdInKBO> message)
public async Task Handle(EventEnvelope<KorteNaamWerdGewijzigd> message)
=> await _elasticRepository.UpdateAsync(
message.Data.VCode,
new DuplicateDetectionDocument
new DuplicateDetectionUpdateDocument
{
KorteNaam = message.Data.KorteNaam,
}
Expand All @@ -76,7 +76,7 @@ public async Task Handle(EventEnvelope<KorteNaamWerdGewijzigd> message)
public async Task Handle(EventEnvelope<HoofdactiviteitenVerenigingsloketWerdenGewijzigd> message)
=> await _elasticRepository.UpdateAsync(
message.VCode,
new DuplicateDetectionDocument
new DuplicateDetectionUpdateDocument
{
HoofdactiviteitVerenigingsloket = MapHoofdactiviteitVerenigingsloket(message.Data.HoofdactiviteitenVerenigingsloket),
}
Expand All @@ -94,7 +94,7 @@ public async Task Handle(EventEnvelope<LocatieWerdVerwijderd> message)
public async Task Handle(EventEnvelope<VerenigingWerdGestopt> message)
=> await _elasticRepository.UpdateAsync(
message.VCode,
new DuplicateDetectionDocument
new DuplicateDetectionUpdateDocument
{
IsGestopt = true,
}
Expand All @@ -103,7 +103,7 @@ public async Task Handle(EventEnvelope<VerenigingWerdGestopt> message)
public async Task Handle(EventEnvelope<VerenigingWerdGestoptInKBO> message)
=> await _elasticRepository.UpdateAsync(
message.VCode,
new DuplicateDetectionDocument
new DuplicateDetectionUpdateDocument
{
IsGestopt = true,
}
Expand All @@ -112,7 +112,7 @@ public async Task Handle(EventEnvelope<VerenigingWerdGestoptInKBO> message)
public async Task Handle(EventEnvelope<VerenigingWerdVerwijderd> message)
=> await _elasticRepository.UpdateAsync(
message.VCode,
new DuplicateDetectionDocument
new DuplicateDetectionUpdateDocument
{
IsVerwijderd = true,
}
Expand Down Expand Up @@ -142,7 +142,7 @@ private static DuplicateDetectionDocument.Locatie Map(Registratiedata.Locatie lo
public async Task Handle(EventEnvelope<NaamWerdGewijzigdInKbo> message)
=> await _elasticRepository.UpdateAsync(
message.VCode,
new DuplicateDetectionDocument
new DuplicateDetectionUpdateDocument
{
Naam = message.Data.Naam,
}
Expand All @@ -151,7 +151,7 @@ public async Task Handle(EventEnvelope<NaamWerdGewijzigdInKbo> message)
public async Task Handle(EventEnvelope<KorteNaamWerdGewijzigdInKbo> message)
=> await _elasticRepository.UpdateAsync(
message.VCode,
new DuplicateDetectionDocument
new DuplicateDetectionUpdateDocument
{
KorteNaam = message.Data.KorteNaam,
}
Expand Down Expand Up @@ -187,7 +187,7 @@ public async Task Handle(EventEnvelope<LocatieDuplicaatWerdVerwijderdNaAdresMatc
public async Task Handle(EventEnvelope<VerenigingWerdGemarkeerdAlsDubbelVan> message)
=> await _elasticRepository.UpdateAsync(
message.VCode,
new DuplicateDetectionDocument
new DuplicateDetectionUpdateDocument
{
IsDubbel = true,
}
Expand All @@ -196,7 +196,7 @@ public async Task Handle(EventEnvelope<VerenigingWerdGemarkeerdAlsDubbelVan> mes
public async Task Handle(EventEnvelope<WeigeringDubbelDoorAuthentiekeVerenigingWerdVerwerkt> message)
=> await _elasticRepository.UpdateAsync(
message.VCode,
new DuplicateDetectionDocument
new DuplicateDetectionUpdateDocument
{
IsDubbel = false,
}
Expand All @@ -205,7 +205,7 @@ public async Task Handle(EventEnvelope<WeigeringDubbelDoorAuthentiekeVerenigingW
public async Task Handle(EventEnvelope<MarkeringDubbeleVerengingWerdGecorrigeerd> message)
=> await _elasticRepository.UpdateAsync(
message.VCode,
new DuplicateDetectionDocument
new DuplicateDetectionUpdateDocument
{
IsDubbel = false,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ Task IndexAsync<TDocument>(TDocument document)
Task UpdateAdres<TDocument>(string id, int locatieId, string adresVoorstelling, string postcode, string gemeente) where TDocument : class;
Task AppendCorresponderendeVCodes<TDocument>(string id, string vCodeDubbeleVereniging) where TDocument : class;
Task RemoveCorresponderendeVCode<TDocument>(string id, string vCodeDubbeleVereniging) where TDocument : class;

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
namespace AssociationRegistry.Admin.Schema.Search;

// Use this for updates when properties are not nullable so it does not get overwritten on an updatepublic
public record DuplicateDetectionUpdateDocument
{
public string VCode { get; set; } = null!;
public string Naam { get; set; } = null!;
public Locatie[] Locaties { get; set; } = null!;
public string VerenigingsTypeCode { get; set; } = null!;
public string KorteNaam { get; set; } = null!;
public string[] HoofdactiviteitVerenigingsloket { get; set; } = null!;
public bool? IsGestopt { get; set; } = null!;
public bool? IsVerwijderd { get; set; } = null!;
public bool? IsDubbel { get; set; } = null!;

public record Locatie : ILocatie
{
public int LocatieId { get; init; }
public string Locatietype { get; init; } = null!;
public string? Naam { get; init; }
public string Adresvoorstelling { get; init; } = null!;
public bool? IsPrimair { get; init; } = null!;
public string Postcode { get; init; } = null!;
public string Gemeente { get; init; } = null!;
}
}

public record DuplicateDetectionDocument
{
public string VCode { get; set; } = null!;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
namespace AssociationRegistry.Public.ProjectionHost.Extensions;

using Hosts.Configuration.ConfigurationBindings;
using Infrastructure.ConfigurationBindings;
using Infrastructure.Extensions;
using Marten;
using Marten.Events.Daemon;
using Nest;
using Projections;
using Projections.Detail;
using Projections.Sequence;

public static class ProjectionEndpointsExtensions
{
Expand All @@ -26,7 +24,7 @@
await StartRebuild(ProjectionNames.PubliekDetail, store, shardTimeout, logger);
await StartRebuild(ProjectionNames.PubliekZoek, store, shardTimeout, logger, async () =>
{
await elasticClient.Indices.DeleteAsync(options.Indices.Verenigingen, ct: CancellationToken.None);

Check warning on line 27 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.PowerBi.ExportHost)

Dereference of a possibly null reference.

Check warning on line 27 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Acm.Api)

Dereference of a possibly null reference.

Check warning on line 27 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test)

Dereference of a possibly null reference.

Check warning on line 27 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Public.Api)

Dereference of a possibly null reference.

Check warning on line 27 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Admin.Api)

Dereference of a possibly null reference.
await elasticClient.Indices.CreateVerenigingIndexAsync(options.Indices.Verenigingen);
});

Expand Down Expand Up @@ -55,7 +53,7 @@

await StartRebuild(ProjectionNames.PubliekZoek, store, shardTimeout, logger, async () =>
{
await elasticClient.Indices.DeleteAsync(options.Indices.Verenigingen, ct: CancellationToken.None);

Check warning on line 56 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.PowerBi.ExportHost)

Dereference of a possibly null reference.

Check warning on line 56 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Acm.Api)

Dereference of a possibly null reference.

Check warning on line 56 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test)

Dereference of a possibly null reference.

Check warning on line 56 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Public.Api)

Dereference of a possibly null reference.

Check warning on line 56 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Admin.Api)

Dereference of a possibly null reference.
await elasticClient.Indices.CreateVerenigingIndexAsync(options.Indices.Verenigingen);
});

Expand All @@ -76,12 +74,12 @@
=> store.Advanced.AllProjectionProgress(token: cancellationToken));
}

private static async Task StartRebuild(

Check warning on line 77 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Public.Api)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 77 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Admin.Api)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
string projectionName,
IDocumentStore store,
TimeSpan shardTimeout,
ILogger logger,
Func<Task> beforeRebuild = null)

Check warning on line 82 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.PowerBi.ExportHost)

Cannot convert null literal to non-nullable reference type.

Check warning on line 82 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Admin.AddressSync)

Cannot convert null literal to non-nullable reference type.

Check warning on line 82 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Acm.Api)

Cannot convert null literal to non-nullable reference type.

Check warning on line 82 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Projections)

Cannot convert null literal to non-nullable reference type.

Check warning on line 82 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test)

Cannot convert null literal to non-nullable reference type.

Check warning on line 82 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Public.Api)

Cannot convert null literal to non-nullable reference type.

Check warning on line 82 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Admin.Api)

Cannot convert null literal to non-nullable reference type.

Check warning on line 82 in src/AssociationRegistry.Public.ProjectionHost/Extensions/ProjectionEndpointsExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.E2E)

Cannot convert null literal to non-nullable reference type.
{
_ = Task.Run(async () =>
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace AssociationRegistry.Public.ProjectionHost.Infrastructure.Program;

using ConfigurationBindings;
using AssociationRegistry.Hosts.Configuration.ConfigurationBindings;
using Framework;

public static class ConfigHelpers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace AssociationRegistry.Public.ProjectionHost.Infrastructure.Program.WebApplication;

using ConfigurationBindings;
using Extensions;
using Hosts;
using Hosts.Configuration.ConfigurationBindings;
using Nest;
using Program = ProjectionHost.Program;
using WebApplication = Microsoft.AspNetCore.Builder.WebApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
namespace AssociationRegistry.Public.ProjectionHost.Infrastructure.Program.WebApplicationBuilder;

using ConfigurationBindings;
using Hosts.Configuration.ConfigurationBindings;

public static class ConfigurationExtensions
{
public static PostgreSqlOptionsSection GetValidPostgreSqlOptionsOrThrow(this ConfigurationManager source)
{
var postgreSqlOptions = source.GetSection(PostgreSqlOptionsSection.Name)
var postgreSqlOptions = source.GetSection(PostgreSqlOptionsSection.SectionName)
.Get<PostgreSqlOptionsSection>();

ConfigHelpers.ThrowIfInvalidPostgreSqlOptions(postgreSqlOptions);

Check warning on line 12 in src/AssociationRegistry.Public.ProjectionHost/Infrastructure/Program/WebApplicationBuilder/ConfigurationExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.PowerBi.ExportHost)

Possible null reference argument for parameter 'postgreSqlOptions' in 'void ConfigHelpers.ThrowIfInvalidPostgreSqlOptions(PostgreSqlOptionsSection postgreSqlOptions)'.

Check warning on line 12 in src/AssociationRegistry.Public.ProjectionHost/Infrastructure/Program/WebApplicationBuilder/ConfigurationExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Acm.Api)

Possible null reference argument for parameter 'postgreSqlOptions' in 'void ConfigHelpers.ThrowIfInvalidPostgreSqlOptions(PostgreSqlOptionsSection postgreSqlOptions)'.

Check warning on line 12 in src/AssociationRegistry.Public.ProjectionHost/Infrastructure/Program/WebApplicationBuilder/ConfigurationExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.E2E)

Possible null reference argument for parameter 'postgreSqlOptions' in 'void ConfigHelpers.ThrowIfInvalidPostgreSqlOptions(PostgreSqlOptionsSection postgreSqlOptions)'.

return postgreSqlOptions;
}
Expand All @@ -19,7 +19,7 @@
var elasticSearchOptionsSection = source.GetSection("ElasticClientOptions")
.Get<ElasticSearchOptionsSection>();

ConfigHelpers.ThrowIfInvalidElasticOptions(elasticSearchOptionsSection);

Check warning on line 22 in src/AssociationRegistry.Public.ProjectionHost/Infrastructure/Program/WebApplicationBuilder/ConfigurationExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.PowerBi.ExportHost)

Possible null reference argument for parameter 'elasticSearchOptions' in 'void ConfigHelpers.ThrowIfInvalidElasticOptions(ElasticSearchOptionsSection elasticSearchOptions)'.

Check warning on line 22 in src/AssociationRegistry.Public.ProjectionHost/Infrastructure/Program/WebApplicationBuilder/ConfigurationExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.Acm.Api)

Possible null reference argument for parameter 'elasticSearchOptions' in 'void ConfigHelpers.ThrowIfInvalidElasticOptions(ElasticSearchOptionsSection elasticSearchOptions)'.

Check warning on line 22 in src/AssociationRegistry.Public.ProjectionHost/Infrastructure/Program/WebApplicationBuilder/ConfigurationExtensions.cs

View workflow job for this annotation

GitHub Actions / Run Tests (test/AssociationRegistry.Test.E2E)

Possible null reference argument for parameter 'elasticSearchOptions' in 'void ConfigHelpers.ThrowIfInvalidElasticOptions(ElasticSearchOptionsSection elasticSearchOptions)'.

return elasticSearchOptionsSection;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace AssociationRegistry.Public.ProjectionHost.Infrastructure.Program.WebApplicationBuilder;

using ConfigurationBindings;
using Hosts.Configuration.ConfigurationBindings;
using Nest;
using Schema;

Expand All @@ -20,7 +20,7 @@ public static IServiceCollection ConfigureElasticSearch(
return services;
}

private static ElasticClient CreateElasticClient(ElasticSearchOptionsSection elasticSearchOptions)
public static ElasticClient CreateElasticClient(ElasticSearchOptionsSection elasticSearchOptions)
{
var settings = new ConnectionSettings(new Uri(elasticSearchOptions.Uri!))
.BasicAuthentication(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace AssociationRegistry.DecentraalBeheer.Dubbelbeheer.AanvaardDubbel;

using AssociationRegistry.Vereniging;
using Vereniging;

public record AanvaardDubbeleVerenigingCommand(VCode VCode, VCode VCodeDubbeleVereniging);
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
namespace AssociationRegistry.DecentraalBeheer.Dubbelbeheer.AanvaardDubbel;

using AssociationRegistry.EventStore;
using AssociationRegistry.Framework;
using AssociationRegistry.Messages;
using AssociationRegistry.Vereniging;
using EventStore;
using Framework;
using Messages;
using Vereniging;
using Be.Vlaanderen.Basisregisters.AggregateSource;
using NodaTime;
using Wolverine;

Expand All @@ -26,7 +27,11 @@ await repository.Save(
Guid.NewGuid()),
cancellationToken);
}
catch (Exception)
catch (AggregateNotFoundException)
{
await bus.SendAsync(new VerwerkWeigeringDubbelDoorAuthentiekeVerenigingMessage(command.VCodeDubbeleVereniging, command.VCode));
}
catch (DomainException)
{
await bus.SendAsync(new VerwerkWeigeringDubbelDoorAuthentiekeVerenigingMessage(command.VCodeDubbeleVereniging, command.VCode));
}
Expand Down
2 changes: 1 addition & 1 deletion src/AssociationRegistry/Vereniging/VerenigingStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public record StatusDubbel(VCode VCodeAuthentiekeVereniging, VerenigingStatus Vo
public static VerenigingStatus Actief => new StatusActief();
public static VerenigingStatus Gestopt => new StatusGestopt();

public VerenigingStatus ParseVorigeStatus(string vorigeStatus)
public static VerenigingStatus ParseVorigeStatus(string vorigeStatus)
{
switch (vorigeStatus)
{
Expand Down
Loading
Loading