forked from xiongyuxing/tiku-backend.net
feat: add student video and profile experience
This commit is contained in:
@@ -156,6 +156,16 @@ public sealed class ExceptionHandlingMiddleware(
|
||||
return;
|
||||
}
|
||||
|
||||
if (exception is VideoPlaybackException videoPlaybackException)
|
||||
{
|
||||
await WriteProblemAsync(
|
||||
context,
|
||||
videoPlaybackException.Message,
|
||||
VideoPlaybackStatusCode(videoPlaybackException.Code),
|
||||
videoPlaybackException.Code);
|
||||
return;
|
||||
}
|
||||
|
||||
if (exception is ContentManagementException contentManagementException)
|
||||
{
|
||||
await WriteProblemAsync(
|
||||
@@ -436,12 +446,22 @@ public sealed class ExceptionHandlingMiddleware(
|
||||
return code switch
|
||||
{
|
||||
"profile_access_denied" => StatusCodes.Status403Forbidden,
|
||||
"profile_user_not_found" => StatusCodes.Status404NotFound,
|
||||
"profile_user_not_found" or "check_in_task_not_found" => StatusCodes.Status404NotFound,
|
||||
"region_not_found" or "school_not_found" or "major_not_found" => StatusCodes.Status404NotFound,
|
||||
_ => StatusCodes.Status400BadRequest
|
||||
};
|
||||
}
|
||||
|
||||
private static int VideoPlaybackStatusCode(string code)
|
||||
{
|
||||
return code switch
|
||||
{
|
||||
"video_access_denied" => StatusCodes.Status403Forbidden,
|
||||
"video_not_found" or "question_video_not_found" => StatusCodes.Status404NotFound,
|
||||
_ => StatusCodes.Status400BadRequest
|
||||
};
|
||||
}
|
||||
|
||||
private static int TenantAdminDirectStatusCode(string code)
|
||||
{
|
||||
return code switch
|
||||
|
||||
Reference in New Issue
Block a user