Commit 4710f62a authored by Eric Dieckman's avatar Eric Dieckman
Browse files

Remove CQRS

parent 50a4695a
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -34,10 +34,7 @@

  <ItemGroup>
    <PackageReference Include="Cals.Authentication.Identity" Version="1.0.0" />
    <PackageReference Include="Cals.Caching" Version="2.0.3" />
    <PackageReference Include="Cals.Cqrs" Version="2.1.0" />
    <PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.4.0" />
    <PackageReference Include="Hellang.Middleware.ProblemDetails" Version="6.5.1" />
    <PackageReference Include="MailKit" Version="4.14.1" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.21" />
    <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.21" />
+1 −3
Original line number Diff line number Diff line
using Cals.Cqrs;
using Cals.Visor.Application.Identity;
using Cals.Visor.Identity;
using Microsoft.Extensions.Options;

@@ -37,7 +35,7 @@ public class IdentityMiddleware
    /// <param name="context"></param>
    /// <param name="requestProcessor"></param>
    /// <returns></returns>
    public async Task Invoke(HttpContext context, IRequestProcessor requestProcessor)
    public async Task Invoke(HttpContext context)
    {
        if (context.User.Identity == null || !context.User.Identity.IsAuthenticated)
        {
+0 −35
Original line number Diff line number Diff line
@@ -3,17 +3,11 @@ using System.Security.Claims;
using System.Security.Cryptography.X509Certificates;
using Azure.Core;
using Azure.Identity;
using Cals.Authentication;
using Cals.Caching;
using Cals.Cqrs;
using Cals.Visor.Api.Authorization;
using Cals.Visor.Api.Identity;
using Cals.Visor.Api.SeedWork;
using Cals.Visor.Application;
using Cals.Visor.Application.Identity;
using Cals.Visor.Infrastructure;
using Hellang.Middleware.ProblemDetails;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.IdentityModel.Protocols;
@@ -107,12 +101,6 @@ builder.Services.AddSwaggerGen(options =>
//// ############# AUTHORIZATION ################
//builder.Services.AddAuthorization(appConfig.Groups);

builder.Services.AddProblemDetails(x =>
{
    x.Map<InvalidCommandException>(ex => new InvalidCommandProblemDetails(ex));
    x.Map<BusinessRuleValidationException>(ex => new BusinessRuleValidationExceptionProblemDetails(ex));
});

// using for getting concrete types of IDomainNotifications in DomainEventsDispatcher
builder.Services.AddTransient(o => builder.Services);

@@ -145,9 +133,6 @@ app.UseAuthorization();

app.MapControllers();

//// register service locator - used in CommandsExecutor
ServiceActivator.Configure(app.Services);

app.Run();

// Configures the Azure Key Vault for this app
@@ -182,28 +167,8 @@ static void ConfigureAzureKeyVault(WebApplicationBuilder builder)
        builder.Configuration.AddAzureKeyVault(
            new Uri(azKeyVaultEndpoint!),
            credentials);

    }
}

// Add the background service platform Quartz for internal commands and outbox
static void ConfigureQuartz(IServiceCollection services)
{
    services.AddQuartz(q =>
    {
        // outbox trigger
        q.ScheduleJob<ProcessOutboxJob>(trigger => trigger
            .StartNow()
            .WithCronSchedule("0/15 * * ? * *"));

        // outbox trigger
        q.ScheduleJob<ProcessInternalCommandsJob>(trigger => trigger
            .StartNow()
            .WithCronSchedule("0/15 * * ? * *"));
    });

    services.AddQuartzHostedService(
            q => q.WaitForJobsToComplete = true);
}
#pragma warning restore SA1005
#pragma warning restore SA1512 // Single-line comments should not be followed by blank line
+0 −14
Original line number Diff line number Diff line
using Cals.Cqrs;

namespace Cals.Visor.Api.SeedWork;

public class BusinessRuleValidationExceptionProblemDetails : Microsoft.AspNetCore.Mvc.ProblemDetails
{
    public BusinessRuleValidationExceptionProblemDetails(BusinessRuleValidationException exception)
    {
        Title = "Business rule validation error";
        Status = StatusCodes.Status409Conflict;
        Detail = exception.Details;
        Type = "https://cals.wisc.edu/business-rule-validation-error";
    }
}
+0 −14
Original line number Diff line number Diff line
using Cals.Cqrs;

namespace Cals.Visor.Api.SeedWork;

public class InvalidCommandProblemDetails : Microsoft.AspNetCore.Mvc.ProblemDetails
{
    public InvalidCommandProblemDetails(InvalidCommandException exception)
    {
        Title = exception.Message;
        Status = StatusCodes.Status400BadRequest;
        Detail = exception.Details;
        Type = "https://cals.wisc.edu/validation-error";
    }
}
Loading