Skip to content

Commit 0ef50c6

Browse files
committed
🧱refactor: remove Blazor front-end & reposition API as the core product
Strategic refactor to address technical debt and scope deviation. Motivation (Why): - Improved maintainability with full focus on the .NET API ecosystem (C#, ASP.NET Core, EF Core, SQL Server, Redis). - The project previously maintained a monolithic coupling with an incomplete Blazor UI (Finance.Web), which did not meet the same quality standards as the back-end. - A poorly functioning or visually weak front-end degrades the perceived value of a robust API. A bad UI anchors perception negatively: “a weak front-end stains a strong back-end”. - The core identity of this project is back-end engineering. Maintaining a mediocre UI diverted focus from performance, security, and API architecture. - A RESTful API must be client-agnostic. Removing the Blazor client enforces proper decoupling and elevates OpenAPI (Swagger) as the primary interface. New Product Definition: - From this commit onward, the API itself is the final product. - Swagger UI becomes the main interaction surface for developers and reviewers, exposing endpoints, contracts, and data models transparently. Technical Changes (How): - Removed Finance.Web and Finance.Web.Tests from the solution. - Deleted Blazor source folders from the filesystem. - Refactored Dockerfile to remove unnecessary build stages tied to the front-end. - Added .dockerignore to reduce Docker build context and image size. - Updated CORS policy: - Removed hardcoded localhost origin tied to the former front-end. - Adopted a permissive development-focused policy to support Swagger, Postman, and future client integrations. Impact: - Breaking change: the application no longer serves HTML/Blazor pages. - Significantly reduced build times.
1 parent 84e30d7 commit 0ef50c6

97 files changed

Lines changed: 9 additions & 62150 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Finance.Api.Tests/FakeAuthenticationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected override Task<AuthenticateResult> HandleAuthenticateAsync()
1414
var claims = new[]
1515
{
1616
new Claim(ClaimTypes.NameIdentifier, "1"),
17-
new Claim("email", "teste@email.com")
17+
new Claim("email", "teste@user.com")
1818
};
1919
var identity = new ClaimsIdentity(claims, AuthenticationScheme);
2020
var principal = new ClaimsPrincipal(identity);

Finance.Api/Extensions/BuilderExtension.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ public static void AddConfiguration(this WebApplicationBuilder builder)
2525
public static void AddDatabase(this WebApplicationBuilder builder)
2626
{
2727
builder.Services.AddDbContext<FinanceDbContext>(o =>
28-
o.UseSqlServer(ApiConfiguration.ConnectionString));
28+
o.UseSqlServer(ApiConfiguration.ConnectionString, sqlOptions =>
29+
{
30+
sqlOptions.EnableRetryOnFailure(
31+
maxRetryCount: 5,
32+
maxRetryDelay: TimeSpan.FromSeconds(10),
33+
errorNumbersToAdd: null);
34+
}));
2935
}
3036

3137
public static void AddCors(this WebApplicationBuilder builder)
@@ -34,7 +40,7 @@ public static void AddCors(this WebApplicationBuilder builder)
3440
options => options.AddPolicy(
3541
ApiConfiguration.CorsPolicyName,
3642
policy => policy
37-
.WithOrigins("https://localhost:7243")
43+
.SetIsOriginAllowed(origin => true)
3844
.AllowAnyMethod()
3945
.AllowAnyHeader()
4046
.AllowCredentials()

Finance.Web.Tests/BunitTestHelper.cs

Lines changed: 0 additions & 14 deletions
This file was deleted.

Finance.Web.Tests/Finance.Web.Tests.csproj

Lines changed: 0 additions & 37 deletions
This file was deleted.

Finance.Web.Tests/Properties/launchSettings.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

Finance.Web.Tests/Shared/CategoryFormTests.cs

Lines changed: 0 additions & 50 deletions
This file was deleted.

Finance.Web.Tests/Shared/TransactionFormTests.cs

Lines changed: 0 additions & 58 deletions
This file was deleted.

Finance.Web.Tests/TestAuthenticationStateProvider.cs

Lines changed: 0 additions & 31 deletions
This file was deleted.

Finance.Web.Tests/TestLayout.razor

Lines changed: 0 additions & 20 deletions
This file was deleted.

Finance.Web/App.razor

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)