Sync reason System.Reflection.MethodBase.GetCurrentMethod()?.Name

This commit is contained in:
2025-09-18 02:28:59 +02:00
parent 95a75bfbcb
commit e4263e4b2b
20 changed files with 40 additions and 39 deletions

View File

@@ -71,7 +71,7 @@ public class FileLibraryController(MangaContext context) : Controller
//TODO Path check
library.BasePath = newBasePath;
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Ok();
}
@@ -96,7 +96,7 @@ public class FileLibraryController(MangaContext context) : Controller
//TODO Name check
library.LibraryName = newName;
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Ok();
}
@@ -116,7 +116,7 @@ public class FileLibraryController(MangaContext context) : Controller
Schema.MangaContext.FileLibrary library = new (requestData.BasePath, requestData.LibraryName);
context.FileLibraries.Add(library);
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Created(string.Empty, library.Key);
@@ -140,7 +140,7 @@ public class FileLibraryController(MangaContext context) : Controller
context.FileLibraries.Remove(library);
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Ok();
}

View File

@@ -72,7 +72,7 @@ public class LibraryConnectorController(LibraryContext context) : Controller
context.LibraryConnectors.Add(connector);
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Created(string.Empty, connector.Key);
}
@@ -95,7 +95,7 @@ public class LibraryConnectorController(LibraryContext context) : Controller
context.LibraryConnectors.Remove(connector);
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Ok();
}

View File

@@ -32,7 +32,7 @@ public class MaintenanceController(MangaContext mangaContext) : Controller
mangaContext.Mangas.RemoveRange(noDownloads);
if(await mangaContext.Sync(HttpContext.RequestAborted, GetType()) 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.Ok();
}

View File

@@ -90,7 +90,7 @@ public class MangaConnectorController(MangaContext context) : Controller
connector.Enabled = Enabled;
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Ok();
}

View File

@@ -154,7 +154,7 @@ public class MangaController(MangaContext context) : Controller
context.Mangas.Remove(manga);
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Ok();
}
@@ -420,7 +420,7 @@ public class MangaController(MangaContext context) : Controller
return TypedResults.NotFound(nameof(MangaId));
manga.IgnoreChaptersBefore = chapterThreshold;
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Ok();
@@ -488,7 +488,7 @@ public class MangaController(MangaContext context) : Controller
}
mcId.UseForDownload = IsRequested;
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
DownloadCoverFromMangaconnectorWorker downloadCover = new(mcId);

View File

@@ -91,7 +91,7 @@ public class MetadataFetcherController(MangaContext context) : Controller
MetadataEntry entry = fetcher.CreateMetadataEntry(manga, Identifier);
context.MetadataEntries.Add(entry);
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Ok(entry);
}
@@ -122,7 +122,7 @@ public class MetadataFetcherController(MangaContext context) : Controller
context.Remove(entry);
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Ok();
}

View File

@@ -72,7 +72,7 @@ public class NotificationConnectorController(NotificationsContext context) : Con
context.NotificationConnectors.Add(newConnector);
context.Notifications.Add(new ("Added new Notification Connector!", newConnector.Name, NotificationUrgency.High));
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Created(string.Empty, newConnector.Name);
}
@@ -168,7 +168,7 @@ public class NotificationConnectorController(NotificationsContext context) : Con
context.NotificationConnectors.Remove(connector);
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Ok();
}