search and ai stabilization work, localization stablized.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
using static StellaOps.Localization.T;
|
||||
|
||||
namespace StellaOps.Registry.TokenService.Admin;
|
||||
|
||||
@@ -99,8 +100,8 @@ public static class PlanAdminEndpoints
|
||||
{
|
||||
return TypedResults.NotFound(CreateProblemDetails(
|
||||
StatusCodes.Status404NotFound,
|
||||
"Plan Not Found",
|
||||
$"Plan with ID '{planId}' was not found."));
|
||||
_t("registry.error.plan_not_found"),
|
||||
_t("registry.error.plan_not_found_detail", planId)));
|
||||
}
|
||||
|
||||
return TypedResults.Ok(plan);
|
||||
@@ -120,8 +121,8 @@ public static class PlanAdminEndpoints
|
||||
{
|
||||
return TypedResults.BadRequest(CreateProblemDetails(
|
||||
StatusCodes.Status400BadRequest,
|
||||
"Validation Failed",
|
||||
"The plan request is invalid.",
|
||||
_t("registry.error.validation_failed"),
|
||||
_t("registry.validation.plan_request_invalid"),
|
||||
validationResult.Errors));
|
||||
}
|
||||
|
||||
@@ -136,7 +137,7 @@ public static class PlanAdminEndpoints
|
||||
{
|
||||
return TypedResults.Conflict(CreateProblemDetails(
|
||||
StatusCodes.Status409Conflict,
|
||||
"Name Conflict",
|
||||
_t("registry.error.plan_name_conflict"),
|
||||
ex.Message));
|
||||
}
|
||||
}
|
||||
@@ -173,8 +174,8 @@ public static class PlanAdminEndpoints
|
||||
{
|
||||
return TypedResults.BadRequest(CreateProblemDetails(
|
||||
StatusCodes.Status400BadRequest,
|
||||
"Validation Failed",
|
||||
"The update request is invalid.",
|
||||
_t("registry.error.validation_failed"),
|
||||
_t("registry.validation.plan_update_invalid"),
|
||||
relevantErrors));
|
||||
}
|
||||
}
|
||||
@@ -190,21 +191,21 @@ public static class PlanAdminEndpoints
|
||||
{
|
||||
return TypedResults.NotFound(CreateProblemDetails(
|
||||
StatusCodes.Status404NotFound,
|
||||
"Plan Not Found",
|
||||
$"Plan with ID '{planId}' was not found."));
|
||||
_t("registry.error.plan_not_found"),
|
||||
_t("registry.error.plan_not_found_detail", planId)));
|
||||
}
|
||||
catch (PlanVersionConflictException ex)
|
||||
{
|
||||
return TypedResults.Conflict(CreateProblemDetails(
|
||||
StatusCodes.Status409Conflict,
|
||||
"Version Conflict",
|
||||
_t("registry.error.plan_version_conflict"),
|
||||
ex.Message));
|
||||
}
|
||||
catch (PlanNameConflictException ex)
|
||||
{
|
||||
return TypedResults.Conflict(CreateProblemDetails(
|
||||
StatusCodes.Status409Conflict,
|
||||
"Name Conflict",
|
||||
_t("registry.error.plan_name_conflict"),
|
||||
ex.Message));
|
||||
}
|
||||
}
|
||||
@@ -222,8 +223,8 @@ public static class PlanAdminEndpoints
|
||||
{
|
||||
return TypedResults.NotFound(CreateProblemDetails(
|
||||
StatusCodes.Status404NotFound,
|
||||
"Plan Not Found",
|
||||
$"Plan with ID '{planId}' was not found."));
|
||||
_t("registry.error.plan_not_found"),
|
||||
_t("registry.error.plan_not_found_detail", planId)));
|
||||
}
|
||||
|
||||
return TypedResults.NoContent();
|
||||
|
||||
@@ -11,6 +11,7 @@ using OpenTelemetry.Trace;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using StellaOps.AirGap.Policy;
|
||||
using StellaOps.Localization;
|
||||
using StellaOps.Auth.Abstractions;
|
||||
using StellaOps.Auth.ServerIntegration;
|
||||
using StellaOps.Auth.ServerIntegration.Tenancy;
|
||||
@@ -101,6 +102,8 @@ builder.Services.AddStellaOpsResourceServerAuthentication(
|
||||
|
||||
builder.Services.AddStellaOpsTenantServices();
|
||||
builder.Services.AddStellaOpsCors(builder.Environment, builder.Configuration);
|
||||
builder.Services.AddStellaOpsLocalization(builder.Configuration);
|
||||
builder.Services.AddTranslationBundle(System.Reflection.Assembly.GetExecutingAssembly());
|
||||
builder.Services.AddAuthorization(options =>
|
||||
{
|
||||
var scopes = bootstrapOptions.Authority.RequiredScopes.Count == 0
|
||||
@@ -135,11 +138,14 @@ app.LogStellaOpsLocalHostname("registry-token");
|
||||
|
||||
app.UseSerilogRequestLogging();
|
||||
app.UseStellaOpsCors();
|
||||
app.UseStellaOpsLocalization();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.UseStellaOpsTenantMiddleware();
|
||||
app.TryUseStellaRouter(routerEnabled);
|
||||
|
||||
await app.LoadTranslationsAsync();
|
||||
|
||||
app.MapHealthChecks("/healthz");
|
||||
|
||||
// Plan Admin API endpoints
|
||||
@@ -214,5 +220,5 @@ app.MapGet("/token", (
|
||||
.RequireTenant();
|
||||
|
||||
app.TryRefreshStellaRouterEndpoints(routerEnabled);
|
||||
app.Run();
|
||||
await app.RunAsync().ConfigureAwait(false);
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
<ProjectReference Include="../../__Libraries/StellaOps.DependencyInjection/StellaOps.DependencyInjection.csproj" />
|
||||
<ProjectReference Include="../../__Libraries/StellaOps.Determinism.Abstractions/StellaOps.Determinism.Abstractions.csproj" />
|
||||
<ProjectReference Include="../../Telemetry/StellaOps.Telemetry.Core/StellaOps.Telemetry.Core/StellaOps.Telemetry.Core.csproj" />
|
||||
<ProjectReference Include="../../__Libraries/StellaOps.Localization/StellaOps.Localization.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Translations\*.json" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="StellaOpsReleaseVersion">
|
||||
<Version>1.0.0-alpha1</Version>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_meta": { "locale": "en-US", "namespace": "registry", "version": "1.0" },
|
||||
|
||||
"registry.error.plan_not_found": "Plan Not Found",
|
||||
"registry.error.plan_not_found_detail": "Plan with ID '{0}' was not found.",
|
||||
"registry.error.plan_name_conflict": "Name Conflict",
|
||||
"registry.error.plan_version_conflict": "Version Conflict",
|
||||
"registry.error.validation_failed": "Validation Failed",
|
||||
|
||||
"registry.validation.plan_request_invalid": "The plan request is invalid.",
|
||||
"registry.validation.plan_update_invalid": "The update request is invalid."
|
||||
}
|
||||
Reference in New Issue
Block a user