using Application.Abstractions.Messaging; using Application.Abstractions.YouTube; using SharedKernel.Results; namespace Application.Features.Admin.Channel.YouTubePubSub.Resubscribe; internal sealed class Handler(IYouTubePubSubService pubSubService) : ICommandHandler { public async Task Handle(Command request, CancellationToken ct) { if (string.IsNullOrWhiteSpace(request.YouTubeChannelID)) { return Result.Failure(Error.Problem("YouTubePubSub.ChannelIDRequired", "YouTube Channel ID가 필요합니다.")); } var success = await pubSubService.SubscribeAsync(request.YouTubeChannelID, ct); if (!success) { return Result.Failure(Error.Problem("YouTubePubSub.SubscribeFailed", "구독 요청이 실패했습니다.")); } return Result.Success(); } }