using Application.Abstractions.Data;
using Application.Abstractions.Messaging;
using Microsoft.EntityFrameworkCore;

namespace Application.Features.Admin.Crypto.News.Source.Delete
{
    public sealed class Handler(IAppDbContext db) : ICommandHandler<Command>
    {
        public async Task Handle(Command request, CancellationToken ct)
        {
            if (request.IDs is null || request.IDs.Length == 0)
            {
                return;
            }

            await db.RssFeedSource.Where(c => request.IDs.Contains(c.ID)).ExecuteDeleteAsync(ct);
        }
    }
}