feat: add content navigation readonly endpoints

This commit is contained in:
xiong
2026-07-26 14:08:23 +08:00
parent d5379affba
commit 3221b581c8
9 changed files with 982 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using Tiku.Api.Controllers;
using Tiku.Application.Auth;
using Tiku.Infrastructure.Content;
namespace Tiku.Api.Middleware;
@@ -33,6 +34,26 @@ public sealed class ExceptionHandlingMiddleware(
return;
}
if (exception is RequiredFieldException)
{
await WriteProblemAsync(
context,
exception.Message,
StatusCodes.Status400BadRequest,
"required_field");
return;
}
if (exception is ContentNavigationNotFoundException)
{
await WriteProblemAsync(
context,
exception.Message,
StatusCodes.Status404NotFound,
"content_navigation_not_found");
return;
}
logger.LogError(exception, "Unhandled API exception");
var problem = new ProblemDetails