feat: add question bank readonly endpoints

This commit is contained in:
xiong
2026-07-26 14:17:30 +08:00
parent 3221b581c8
commit 97e7819a34
9 changed files with 747 additions and 3 deletions

View File

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