private async Task <Validation <BaseError, LibraryPath> > MediaSourceMustExist(DeleteLocalLibraryPath request) => (await _libraryRepository.GetPath(request.LocalLibraryPathId)) .HeadOrNone() .ToValidation <BaseError>( $"Local library path {request.LocalLibraryPathId} does not exist.");
public Task <Either <BaseError, Unit> > Handle( DeleteLocalLibraryPath request, CancellationToken cancellationToken) => MediaSourceMustExist(request) .MapT(DoDeletion) .Bind(t => t.ToEitherAsync());