mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
699 B
18 lines
699 B
using ErsatzTV.Core; |
|
using ErsatzTV.Core.Interfaces.Repositories; |
|
|
|
namespace ErsatzTV.Application.Maintenance; |
|
|
|
public class DeleteOrphanedArtworkHandler : IRequestHandler<DeleteOrphanedArtwork, Either<BaseError, Unit>> |
|
{ |
|
private readonly IArtworkRepository _artworkRepository; |
|
|
|
public DeleteOrphanedArtworkHandler(IArtworkRepository artworkRepository) => |
|
_artworkRepository = artworkRepository; |
|
|
|
public Task<Either<BaseError, Unit>> |
|
Handle(DeleteOrphanedArtwork request, CancellationToken cancellationToken) => |
|
_artworkRepository.GetOrphanedArtwork() |
|
.Bind(_artworkRepository.Delete) |
|
.Map(_ => Right<BaseError, Unit>(Unit.Default)); |
|
}
|
|
|