Handler.cs 700 B

1234567891011121314151617181920
  1. using Application.Abstractions.Messaging;
  2. using Application.Abstractions.YouTube;
  3. using SharedKernel.Results;
  4. namespace Application.Features.Admin.Channel.YouTubePubSub.Unsubscribe;
  5. internal sealed class Handler(IYouTubePubSubService pubSubService) : ICommandHandler<Command, Result>
  6. {
  7. public async Task<Result> Handle(Command request, CancellationToken ct)
  8. {
  9. if (string.IsNullOrWhiteSpace(request.YouTubeChannelID))
  10. {
  11. return Result.Failure(Error.Problem("YouTubePubSub.ChannelIDRequired", "YouTube Channel ID가 필요합니다."));
  12. }
  13. await pubSubService.UnsubscribeAsync(request.YouTubeChannelID, ct);
  14. return Result.Success();
  15. }
  16. }