Better sync log

This commit is contained in:
2025-09-18 02:04:01 +02:00
parent c199f37b14
commit 429cd2284f
18 changed files with 30 additions and 29 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) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType()) 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) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Ok();
}
@@ -113,10 +113,10 @@ public class FileLibraryController(MangaContext context) : Controller
public async Task<Results<Created<string>, InternalServerError<string>>> CreateNewLibrary ([FromBody]CreateLibraryRecord requestData)
{
//TODO Parameter check
Schema.MangaContext.FileLibrary library = new Schema.MangaContext.FileLibrary(requestData.BasePath, requestData.LibraryName);
Schema.MangaContext.FileLibrary library = new (requestData.BasePath, requestData.LibraryName);
context.FileLibraries.Add(library);
if(await context.Sync(HttpContext.RequestAborted) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType()) 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) is { success: false } result)
if(await context.Sync(HttpContext.RequestAborted, GetType()) is { success: false } result)
return TypedResults.InternalServerError(result.exceptionMessage);
return TypedResults.Ok();
}