Refactor project files for improved readability and structure
CI / Backend (build + test) (push) Successful in 1m18s
CI / Frontend (lint + typecheck + build) (push) Successful in 31s

- Cleaned up whitespace in Directory.Build.props and Directory.Packages.props for consistency.
- Reformatted project file references in PnvPanel.Api.csproj for better clarity.
- Enhanced code readability in various endpoint files by adjusting line breaks and indentation.
- Standardized method signatures and improved formatting in ResultExtensions and multiple endpoint classes for better maintainability.
This commit is contained in:
Leonid Pershin
2026-07-14 07:24:13 +03:00
parent 9d5424bb9c
commit df137ca5a7
285 changed files with 6911 additions and 2063 deletions
@@ -10,9 +10,19 @@ public class AuthFlowTests(PnvPanelWebApplicationFactory factory)
{
private sealed record RegisterResponse(Guid Id, string UserName);
private sealed record CurrentUserResponse(Guid Id, string UserName, string Role, bool IsActivated, bool TelegramLinked);
private sealed record CurrentUserResponse(
Guid Id,
string UserName,
string Role,
bool IsActivated,
bool TelegramLinked
);
private sealed record LoginResponse(string AccessToken, DateTimeOffset ExpiresAt, CurrentUserResponse User);
private sealed record LoginResponse(
string AccessToken,
DateTimeOffset ExpiresAt,
CurrentUserResponse User
);
[Fact]
public async Task RegisterLoginMeRefreshLogout_FullFlow_Succeeds()
@@ -21,13 +31,19 @@ public class AuthFlowTests(PnvPanelWebApplicationFactory factory)
var userName = $"alice_{Guid.NewGuid():N}"[..20];
const string password = "P@ssw0rd123";
var registerResponse = await client.PostJsonAsync("/api/auth/register", new { userName, password });
var registerResponse = await client.PostJsonAsync(
"/api/auth/register",
new { userName, password }
);
Assert.Equal(HttpStatusCode.OK, registerResponse.StatusCode);
var registered = await registerResponse.ReadAsAsync<RegisterResponse>();
Assert.NotNull(registered);
Assert.Equal(userName, registered!.UserName);
var loginResponse = await client.PostJsonAsync("/api/auth/login", new { userName, password });
var loginResponse = await client.PostJsonAsync(
"/api/auth/login",
new { userName, password }
);
Assert.Equal(HttpStatusCode.OK, loginResponse.StatusCode);
var login = await loginResponse.ReadAsAsync<LoginResponse>();
Assert.NotNull(login);
@@ -61,9 +77,15 @@ public class AuthFlowTests(PnvPanelWebApplicationFactory factory)
using var client = factory.CreateClient();
var userName = $"bob_{Guid.NewGuid():N}"[..20];
await client.PostJsonAsync("/api/auth/register", new { userName, password = "CorrectPassword123" });
await client.PostJsonAsync(
"/api/auth/register",
new { userName, password = "CorrectPassword123" }
);
var loginResponse = await client.PostJsonAsync("/api/auth/login", new { userName, password = "WrongPassword123" });
var loginResponse = await client.PostJsonAsync(
"/api/auth/login",
new { userName, password = "WrongPassword123" }
);
Assert.Equal(HttpStatusCode.Unauthorized, loginResponse.StatusCode);
}
@@ -74,10 +96,16 @@ public class AuthFlowTests(PnvPanelWebApplicationFactory factory)
using var client = factory.CreateClient();
var userName = $"carol_{Guid.NewGuid():N}"[..20];
var first = await client.PostJsonAsync("/api/auth/register", new { userName, password = "P@ssw0rd123" });
var first = await client.PostJsonAsync(
"/api/auth/register",
new { userName, password = "P@ssw0rd123" }
);
Assert.Equal(HttpStatusCode.OK, first.StatusCode);
var second = await client.PostJsonAsync("/api/auth/register", new { userName, password = "AnotherPass123!" });
var second = await client.PostJsonAsync(
"/api/auth/register",
new { userName, password = "AnotherPass123!" }
);
Assert.Equal(HttpStatusCode.Conflict, second.StatusCode);
}