feat: add learning activity endpoints

This commit is contained in:
xiong
2026-07-26 15:18:57 +08:00
parent b5be831749
commit db319ef5a2
8 changed files with 1158 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ using Tiku.Application.Assets;
using Tiku.Application.Auth;
using Tiku.Application.Storage;
using Tiku.Infrastructure.Content;
using Tiku.Infrastructure.Learning;
using Tiku.Infrastructure.QuestionBanks;
namespace Tiku.Api.Middleware;
@@ -87,6 +88,36 @@ public sealed class ExceptionHandlingMiddleware(
return;
}
if (exception is LearningValidationException learningValidationException)
{
await WriteProblemAsync(
context,
learningValidationException.Message,
StatusCodes.Status400BadRequest,
learningValidationException.Code);
return;
}
if (exception is LearningResourceNotFoundException learningResourceNotFoundException)
{
await WriteProblemAsync(
context,
learningResourceNotFoundException.Message,
StatusCodes.Status404NotFound,
learningResourceNotFoundException.Code);
return;
}
if (exception is LearningAccessDeniedException)
{
await WriteProblemAsync(
context,
exception.Message,
StatusCodes.Status403Forbidden,
"learning_access_denied");
return;
}
if (exception is ObjectStorageException storageException)
{
await WriteProblemAsync(