feat: add tenant content asset management endpoints

This commit is contained in:
xiong
2026-07-26 15:34:59 +08:00
parent e505384ecf
commit 3c0acebbbe
8 changed files with 1402 additions and 0 deletions

View File

@@ -88,6 +88,16 @@ public sealed class ExceptionHandlingMiddleware(
return;
}
if (exception is AssetManagementException assetManagementException)
{
await WriteProblemAsync(
context,
assetManagementException.Message,
AssetManagementStatusCode(assetManagementException.Code),
assetManagementException.Code);
return;
}
if (exception is LearningValidationException learningValidationException)
{
await WriteProblemAsync(
@@ -209,4 +219,15 @@ public sealed class ExceptionHandlingMiddleware(
_ => StatusCodes.Status400BadRequest
};
}
private static int AssetManagementStatusCode(string code)
{
return code switch
{
"asset_not_found" or "import_job_not_found" => StatusCodes.Status404NotFound,
"asset_upload_missing" => StatusCodes.Status409Conflict,
"tenant_content_access_denied" => StatusCodes.Status403Forbidden,
_ => StatusCodes.Status400BadRequest
};
}
}