mirror of
https://github.com/C9Glax/tranga.git
synced 2025-10-11 05:09:49 +02:00
Fix CleanupNoDownloadManga
This commit is contained in:
@@ -24,10 +24,13 @@ public class MaintenanceController(MangaContext mangaContext) : Controller
|
|||||||
[ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
|
[ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
|
||||||
public async Task<Results<Ok, InternalServerError<string>>> CleanupNoDownloadManga()
|
public async Task<Results<Ok, InternalServerError<string>>> CleanupNoDownloadManga()
|
||||||
{
|
{
|
||||||
await mangaContext.Mangas
|
if (await mangaContext.Mangas
|
||||||
.Include(m => m.MangaConnectorIds)
|
.Include(m => m.MangaConnectorIds)
|
||||||
.Where(m => !m.MangaConnectorIds.Any(id => id.UseForDownload))
|
.Where(m => !m.MangaConnectorIds.Any(id => id.UseForDownload))
|
||||||
.ExecuteDeleteAsync(HttpContext.RequestAborted);
|
.ToListAsync(HttpContext.RequestAborted) is not { } remove)
|
||||||
|
return TypedResults.InternalServerError("Database error");
|
||||||
|
|
||||||
|
mangaContext.RemoveRange(remove);
|
||||||
|
|
||||||
if(await mangaContext.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
|
if(await mangaContext.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
|
||||||
return TypedResults.InternalServerError(result.exceptionMessage);
|
return TypedResults.InternalServerError(result.exceptionMessage);
|
||||||
|
Reference in New Issue
Block a user