Skip to content

Commit

Permalink
Fix a lot of issues
Browse files Browse the repository at this point in the history
  • Loading branch information
marinasundstrom committed Mar 3, 2024
1 parent 6560ed1 commit 5190f23
Show file tree
Hide file tree
Showing 33 changed files with 286 additions and 766 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"editor.formatOnSave": true,
"editor.formatOnSave": false,
"restoreTerminals.terminals": [
{
"splitTerminals": [
Expand Down
2 changes: 1 addition & 1 deletion ApiKeys/ApiKeys.Client/OpenAPIs/apikeys.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"x-generator": "NSwag v13.16.0.0 (NJsonSchema v10.7.1.0 (Newtonsoft.Json v13.0.0.0))",
"x-generator": "NSwag v13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))",
"openapi": "3.0.0",
"info": {
"title": "ApiKeys API",
Expand Down
57 changes: 50 additions & 7 deletions AppService/AppService.Client/OpenAPIs/AppService.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"x-generator": "NSwag v13.16.1.0 (NJsonSchema v10.7.2.0 (Newtonsoft.Json v13.0.0.0))",
"x-generator": "NSwag v13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))",
"openapi": "3.0.0",
"info": {
"title": "Web API",
Expand Down Expand Up @@ -547,6 +547,39 @@
}
}
},
"/Modules": {
"get": {
"tags": [
"Modules"
],
"operationId": "Modules_GetModules",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ModuleDto"
}
}
}
}
},
"404": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
}
},
"/Notifications": {
"get": {
"tags": [
Expand Down Expand Up @@ -797,12 +830,7 @@
"200": {
"description": ""
}
},
"security": [
{
"JWT": []
}
]
}
}
},
"/DoSomething": {
Expand Down Expand Up @@ -1115,6 +1143,21 @@
}
}
},
"ModuleDto": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"assembly": {
"type": "string"
},
"enabled": {
"type": "boolean"
}
}
},
"NotificationsResults": {
"allOf": [
{
Expand Down
2 changes: 1 addition & 1 deletion Catalog/Catalog.Client/OpenAPIs/catalog.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"x-generator": "NSwag v13.16.1.0 (NJsonSchema v10.7.2.0 (Newtonsoft.Json v13.0.0.0))",
"x-generator": "NSwag v13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))",
"swagger": "2.0",
"info": {
"title": "Catalog API",
Expand Down
4 changes: 2 additions & 2 deletions Catalog/Catalog/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@

builder.Services.AddDocumentsClients((sp, http) =>
{
http.BaseAddress = new Uri($"{Configuration.GetServiceUri("nginx", "https")}/api/documents/");
http.BaseAddress = new Uri($"https://localhost:5174/api/documents/");
});

builder.Services.AddPaymentsClients((sp, http) =>
{
http.BaseAddress = new Uri($"{Configuration.GetServiceUri("nginx", "https")}/api/payments/");
http.BaseAddress = new Uri($"https://localhost:5174/api/payments/");
});

var app = builder.Build();
Expand Down
4 changes: 2 additions & 2 deletions Customers/Customers/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@

builder.Services.AddDocumentsClients((sp, http) =>
{
http.BaseAddress = new Uri($"{Configuration.GetServiceUri("nginx", "https")}/api/documents/");
http.BaseAddress = new Uri($"https://localhost:5174/api/documents/");
});

builder.Services.AddPaymentsClients((sp, http) =>
{
http.BaseAddress = new Uri($"{Configuration.GetServiceUri("nginx", "https")}/api/payments/");
http.BaseAddress = new Uri($"https://localhost:5174/api/payments/");
});

var app = builder.Build();
Expand Down
20 changes: 20 additions & 0 deletions Documents/Documents/Infrastructure/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi

services.AddScoped<IDomainEventDispatcher, DomainEventDispatcher>();

RemoveFaultyDomainEventHandlerRegistrations(services);

try
{
services.Decorate(typeof(INotificationHandler<>), typeof(IdempotentDomainEventHandler<>));
Expand Down Expand Up @@ -46,4 +48,22 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi

return services;
}

private static void RemoveFaultyDomainEventHandlerRegistrations(IServiceCollection services)
{
// This removes registrations between INotificationHandler<T> to IdempotentDomainEventHandler<T>. This was not a problem before MediatR 12.0.
// An alternative would be to put IdempotentDomainEventHandler in a library separate from Application logic, so that MediatR doesn't register that implementation as a real handler.

foreach (var reg in services.Where(reg => reg.ServiceType.Name.Contains("INotificationHandler")).ToList())
{
var notificationHandlerType = reg.ServiceType!;
var notificationHandlerImplType = reg.ImplementationType!;

var requestType = notificationHandlerType.GetGenericArguments().FirstOrDefault();

if (!notificationHandlerImplType.Name.Contains("IdempotentDomainEventHandler")) continue;

services.Remove(reg);
}
}
}
12 changes: 6 additions & 6 deletions Finance/Accounting/Accountant/Accountant/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,30 @@

builder.Services.AddAccountingClients((sp, http) =>
{
http.BaseAddress = new Uri($"{Configuration.GetServiceUri("nginx", "https")}/api/accounting/");
http.BaseAddress = new Uri($"https://localhost:5174/api/accounting/");
});

builder.Services.AddInvoicingClients((sp, http) =>
{
http.BaseAddress = new Uri($"{Configuration.GetServiceUri("nginx", "https")}/api/invoicing/");
http.BaseAddress = new Uri($"https://localhost:5174/api/invoicing/");
});

builder.Services.AddPaymentsClients((sp, http) =>
{
http.BaseAddress = new Uri($"{Configuration.GetServiceUri("nginx", "https")}/api/payments/");
http.BaseAddress = new Uri($"https://localhost:5174/api/payments/");
});

builder.Services.AddDocumentsClients((sp, http) =>
{
http.BaseAddress = new Uri($"{Configuration.GetServiceUri("nginx", "https")}/api/documents/");
http.BaseAddress = new Uri($"https://localhost:5174/api/documents/");
});

// Add Hangfire services.
builder.Services.AddHangfire(configuration => configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseSqlServerStorage(Configuration.GetConnectionString2("mssql", "HangfireDB"), new SqlServerStorageOptions
.UseSqlServerStorage(Configuration.GetConnectionString("HangfireConnection"), new SqlServerStorageOptions
{
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
Expand All @@ -92,7 +92,7 @@

app.MapHangfireDashboard();

using (var connection = new SqlConnection(Configuration.GetConnectionString2("mssql", "HangfireDB")))
using (var connection = new SqlConnection(Configuration.GetConnectionString("HangfireConnection")))
{
connection.Open();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost,1433;User Id=sa;Password=P@ssw0rd;Encrypt=false;Database=Accountant",
"HangfireConnection": "Server=localhost,1433;Database=HangfireDB;User Id=sa;Password=P@ssw0rd;Encrypt=false;"
},
"Logging": {
"LogLevel": {
"Default": "Information",
Expand Down
4 changes: 2 additions & 2 deletions Finance/Accounting/Accounting.UI/ModuleInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static void ConfigureServices(IServiceProvider services)
var group2 = group.GetGroup("accounting") ?? group.CreateGroup("accounting", () => resources["Accounting"], MudBlazor.Icons.Material.Filled.List);

group2.CreateItem("accounts", () => resources["Accounts"], MudBlazor.Icons.Material.Filled.List, "/accounts");
group2.CreateItem("ledger", () => resources["Ledger"], MudBlazor.Icons.Material.Filled.List, "/ledger");
group2.CreateItem("verifications", () => resources["Verifications"], MudBlazor.Icons.Material.Filled.List, "/verifications");
group2.CreateItem("ledger", () => resources["General ledger"], MudBlazor.Icons.Material.Filled.List, "/ledger");
group2.CreateItem("journal", () => resources["Journal"], MudBlazor.Icons.Material.Filled.List, "/journal");
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@page "/verifications/new"
@page "/journal/new"
@using System.ComponentModel.DataAnnotations
@inject NavigationManager NavigationManager
@inject IAccountsClient AccountsClient
Expand Down Expand Up @@ -229,7 +229,7 @@
* 10000), file.Name));
}

NavigationManager.NavigateTo("/verifications");
NavigationManager.NavigateTo("/journal");
}

private Task<IEnumerable<AccountDto>> Search(string value)
Expand Down
Loading

0 comments on commit 5190f23

Please sign in to comment.