Skip to content

Commit

Permalink
Fixed the Helpdesk Api projections configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed Sep 3, 2024
1 parent 43fed2c commit ac97000
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"launchUrl": "swagger/index.html",
"applicationUrl": "http://localhost:5248",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Test"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Sample/Helpdesk/Helpdesk.Api/Helpdesk.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Core.WebApi\Core.WebApi.csproj" />
</ItemGroup>
<!-- <ItemGroup>-->
<!-- <ProjectReference Include="..\..\..\Core.WebApi\Core.WebApi.csproj" />-->
<!-- </ItemGroup>-->
</Project>
19 changes: 10 additions & 9 deletions Sample/Helpdesk/Helpdesk.Api/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Text.Json.Serialization;
using Core.WebApi.Middlewares.ExceptionHandling;
using Helpdesk.Api.Core.Http;
using Helpdesk.Api.Core.Kafka;
using Helpdesk.Api.Core.Marten;
Expand All @@ -14,6 +13,7 @@
using Marten.AspNetCore;
using Marten.Events;
using Marten.Events.Daemon.Resiliency;
using Marten.Events.Projections;
using Marten.Pagination;
using Marten.Schema.Identity;
using Marten.Storage;
Expand All @@ -34,8 +34,8 @@
builder.Services
.AddEndpointsApiExplorer()
.AddSwaggerGen()
.AddDefaultExceptionHandler()
.AddMarten(sp =>
//.AddDefaultExceptionHandler()
.AddMarten(_ =>
{
var options = new StoreOptions();

Expand All @@ -60,11 +60,11 @@
options.Projections.Errors.SkipSerializationErrors = false;
options.Projections.Errors.SkipUnknownEvents = false;

// options.Projections.LiveStreamAggregation<Incident>();
// options.Projections.Add<IncidentHistoryTransformation>(ProjectionLifecycle.Inline);
// options.Projections.Add<IncidentDetailsProjection>(ProjectionLifecycle.Inline);
// options.Projections.Add<IncidentShortInfoProjection>(ProjectionLifecycle.Inline);
// options.Projections.Add<CustomerIncidentsSummaryProjection>(ProjectionLifecycle.Async);
options.Projections.LiveStreamAggregation<Incident>();
options.Projections.Add<IncidentHistoryTransformation>(ProjectionLifecycle.Inline);
options.Projections.Add<IncidentDetailsProjection>(ProjectionLifecycle.Inline);
options.Projections.Add<IncidentShortInfoProjection>(ProjectionLifecycle.Inline);
options.Projections.Add<CustomerIncidentsSummaryProjection>(ProjectionLifecycle.Async);

options.ApplicationAssembly = typeof(CustomerIncidentsSummaryProjection).Assembly;

Expand Down Expand Up @@ -258,7 +258,8 @@ await documentSession.GetAndUpdate<Incident>(incidentId, ToExpectedVersion(eTag)
querySession.Json.WriteById<CustomerIncidentsSummary>(customerId, context)
);

app.UseExceptionHandler().UseSwagger()
app//.UseExceptionHandler()
.UseSwagger()
.UseSwaggerUI()
.UseForwardedHeaders(); // Header forwarding to enable Swagger in Nginx

Expand Down

0 comments on commit ac97000

Please sign in to comment.