Updates configuration and refactors code structure

Migrates connection strings to new database host
Removes unnecessary code and improves configuration handling
Enhances test coverage and adds random word generation
Updates telemetry and command handling patterns
This commit is contained in:
Janus C. H. Knudsen 2026-01-08 21:51:43 +01:00
parent dc98178095
commit a991dcdb97
18 changed files with 481 additions and 63 deletions

View file

@ -11,34 +11,33 @@ public class CommandHandlerDecorator<TCommand>(
{
public async Task<CommandResponse> Handle(TCommand command)
{
using (var operation =
command.TransactionId = Guid.NewGuid();
using var operation =
telemetryClient.StartOperation<RequestTelemetry>($"Handle {decoratedHandler.GetType().FullName}",
command.CorrelationId.ToString()))
{
try
{
operation.Telemetry.Properties["CorrelationId"] = command.CorrelationId.ToString();
operation.Telemetry.Properties["TransactionId"] = command.TransactionId.ToString();
var result = await decoratedHandler.Handle(command);
operation.Telemetry.Properties["RequestId"] = result.RequestId.ToString();
operation.Telemetry.Success = true;
return result;
}
catch (Exception ex)
{
operation.Telemetry.Success = false;
telemetryClient.TrackException(ex, new Dictionary<string, string>
{
["CorrelationId"] = command.CorrelationId.ToString(),
["Command"] = command.GetType().Name,
["CommandHandler"] = decoratedHandler.GetType().FullName
});
throw;
}
command.CorrelationId.ToString());
try
{
operation.Telemetry.Properties["CorrelationId"] = command.CorrelationId.ToString();
operation.Telemetry.Properties["TransactionId"] = command.TransactionId.ToString();
var result = await decoratedHandler.Handle(command);
operation.Telemetry.Properties["RequestId"] = result.RequestId.ToString();
operation.Telemetry.Success = true;
return result;
}
catch (Exception ex)
{
operation.Telemetry.Success = false;
telemetryClient.TrackException(ex, new Dictionary<string, string>
{
["CorrelationId"] = command.CorrelationId.ToString(),
["Command"] = command.GetType().Name,
["CommandHandler"] = decoratedHandler.GetType().FullName
});
throw;
}
}
}

View file

@ -14,6 +14,8 @@ namespace PlanTempus.Components.Users.Create
{
public async Task<CommandResponse> Handle(CreateUserCommand command)
{
command.TransactionId = Guid.NewGuid();
using var db = databaseOperations.CreateScope(nameof(CreateUserHandler));
try
{