Moves media library scanning to domain layer

This commit is contained in:
BinaryAlley committed 2025-02-16 21:45:26 +02:00
1 parent 8b51abe0b2
commit c4246d2e69
209 files changed
+3793 -641

No files matched your search

@@ -60,7 +60,7 @@ public class AdminController : Controller
/// <summary>
/// Gets the authorization permissions of a role identified by <paramref name="roleId"/>.
/// </summary>
/// <param name="roleId">The Id of the role for which to get the list of permissions.</param>
/// <param name="roleId">The unique identifier of the role for which to get the list of permissions.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
[HttpGet("api-get-permissions-by-role-id/{roleId}")]
public async Task<IActionResult> GetPermissionsByRoleId(Guid roleId, CancellationToken cancellationToken)
@@ -72,7 +72,7 @@ public class AdminController : Controller
/// <summary>
/// Gets the authorization permissions of a user identified by <paramref name="userId"/>.
/// </summary>
/// <param name="userId">The Id of the user for whom to get the list of permissions.</param>
/// <param name="userId">The unique identifier of the user for whom to get the list of permissions.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
[HttpGet("api-get-permissions-by-user-id/{userId}")]
public async Task<IActionResult> GetPermissionsByUserId(Guid userId, CancellationToken cancellationToken)
@@ -84,7 +84,7 @@ public class AdminController : Controller
/// <summary>
/// Gets the authorization role of a user identified by <paramref name="userId"/>.
/// </summary>
/// <param name="userId">The Id of the user for whom to get the role.</param>
/// <param name="userId">The unique identifier of the user for whom to get the role.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
[HttpGet("api-get-role-by-user-id/{userId}")]
public async Task<IActionResult> GetRoleByUserId(Guid userId, CancellationToken cancellationToken)
@@ -131,7 +131,7 @@ public class AdminController : Controller
/// <summary>
/// Deletes an authorization role.
/// </summary>
/// <param name="roleId">The Id of the role to be deleted.</param>
/// <param name="roleId">The unique identifier of the role to be deleted.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
[HttpDelete("api-delete-role/{roleId}")]
public async Task<IActionResult> DeleteRole(Guid roleId, CancellationToken cancellationToken)
@@ -121,7 +121,7 @@ public class LibraryManagementController : Controller
[HttpPost("api-scan-libraries")]
public async Task<IActionResult> ScanAllLibraries(CancellationToken cancellationToken = default)
{
ScanLibraryModel[] response = await _apiHttpClient.PostAsync<ScanLibraryModel[], EmptyModel>($"libraries/scan", new EmptyModel(), cancellationToken).ConfigureAwait(false);
ScanLibraryModel[] response = await _apiHttpClient.PostAsync<ScanLibraryModel[], EmptyModel>($"libraries/scans", new EmptyModel(), cancellationToken).ConfigureAwait(false);
return Json(new { success = true, data = response });
}
@@ -133,30 +133,31 @@ public class LibraryManagementController : Controller
[HttpPost("api-scan-library/{id}")]
public async Task<IActionResult> ScanLibrary(Guid id, CancellationToken cancellationToken = default)
{
ScanLibraryModel response = await _apiHttpClient.PostAsync<ScanLibraryModel, EmptyModel>($"libraries/{id}/scan", new EmptyModel(), cancellationToken).ConfigureAwait(false);
ScanLibraryModel response = await _apiHttpClient.PostAsync<ScanLibraryModel, EmptyModel>($"libraries/{id}/scans", new EmptyModel(), cancellationToken).ConfigureAwait(false);
return Json(new { success = true, data = response });
}
/// <summary>
/// Cancells the previously started scan of all media libraries.
/// Cancels the previously started scan of all media libraries.
/// </summary>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
[HttpPost("api-cancel-libraries-scan")]
public async Task<IActionResult> CancelLibrariesScan(CancellationToken cancellationToken = default)
{
await _apiHttpClient.PostAsync<EmptyModel, EmptyModel>($"libraries/cancel-scan", new EmptyModel(), cancellationToken).ConfigureAwait(false);
await _apiHttpClient.PostAsync<EmptyModel, EmptyModel>($"libraries/scans/cancel", new EmptyModel(), cancellationToken).ConfigureAwait(false);
return Json(new { success = true });
}
/// <summary>
/// Cancells the previously started scan of a media library.
/// Cancels the previously started scan of a media library.
/// </summary>
/// <param name="id">The id of the media library whose scan is cancelled.</param>
/// <param name="libraryId">The id of the media library whose scan is cancelled.</param>
/// <param name="scanId">The id of the scan to cancel.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
[HttpPost("api-cancel-library-scan/{id}")]
public async Task<IActionResult> CancelLibraryScan(Guid id, CancellationToken cancellationToken = default)
[HttpPost("{libraryId:guid}/api-cancel-library-scan/{scanId:guid}")]
public async Task<IActionResult> CancelLibraryScan(Guid libraryId, Guid scanId, CancellationToken cancellationToken = default)
{
await _apiHttpClient.PostAsync<EmptyModel, EmptyModel>($"libraries/{id}/cancel-scan", new EmptyModel(), cancellationToken).ConfigureAwait(false);
await _apiHttpClient.PostAsync<EmptyModel, EmptyModel>($"libraries/{libraryId}/scans/{scanId}/cancel", new EmptyModel(), cancellationToken).ConfigureAwait(false);
return Json(new { success = true });
}
}