using FrameworkDAL.DTO.EventSub; using FrameworkDAL.Query.EventSub; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace FrameworkDAL.CustomCode.EventSub { public interface IEventSubDAL { /// /// Returns all active MACTION rows configured for the given EventTypeId, scoped to /// the firing ObjectId — MACTION rows whose JOBID is the default -1 ("not tied to a /// specific job") always match; rows bound to a specific JobId only match when it /// equals . /// Task> GetActionsByEventTypeAsync( int eventTypeId, int objectId, LoginDTO login, CancellationToken ct = default); } public sealed class EventSubDAL : IEventSubDAL { private readonly IQueryExecutor _qe; public EventSubDAL(IQueryExecutor qe) => _qe = qe; public async Task> GetActionsByEventTypeAsync( int eventTypeId, int objectId, LoginDTO login, CancellationToken ct = default) { return (await _qe.QueryAsync( login, EventSubQB.GET_ACTIONS_BY_EVENT_TYPE, new { EventTypeId = eventTypeId, ObjectId = objectId }, cancellationToken: ct).ConfigureAwait(false)).ToList(); } } }