Enhance documentation with new features: added dark/light/system theme support, instructions page, and application catalog. Updated API and domain model for app management and automatic migrations on startup. Improved frontend structure with new routes and features for user instructions and app management.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
namespace PnvPanel.Api.Common;
|
||||
|
||||
public static class RateLimiting
|
||||
{
|
||||
public const string AuthPolicy = "auth";
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using PnvPanel.Application.Common.Models;
|
||||
|
||||
namespace PnvPanel.Api.Common;
|
||||
|
||||
public static class ResultExtensions
|
||||
{
|
||||
public static IResult ToHttpResult(this Result result)
|
||||
=> result.IsSuccess ? Results.NoContent() : ToProblem(result.Error);
|
||||
|
||||
public static IResult ToHttpResult<T>(this Result<T> result)
|
||||
=> result.IsSuccess ? Results.Ok(result.Value) : ToProblem(result.Error);
|
||||
|
||||
private static IResult ToProblem(Error error)
|
||||
{
|
||||
var statusCode = error.Type switch
|
||||
{
|
||||
ErrorType.Validation => StatusCodes.Status400BadRequest,
|
||||
ErrorType.Unauthorized => StatusCodes.Status401Unauthorized,
|
||||
ErrorType.Forbidden => StatusCodes.Status403Forbidden,
|
||||
ErrorType.NotFound => StatusCodes.Status404NotFound,
|
||||
ErrorType.Conflict => StatusCodes.Status409Conflict,
|
||||
_ => StatusCodes.Status422UnprocessableEntity,
|
||||
};
|
||||
|
||||
return Results.Problem(title: error.Code, detail: error.Message, statusCode: statusCode);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user