forked from xiongyuxing/tiku-backend.net
feat: add question bank readonly endpoints
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user