using System.Runtime.CompilerServices; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using RecruitmentDAL.DTO.Reports; using RecruitmentDAL.Query.Reports; namespace RecruitmentDAL.CustomeCode.Reports.CandidateSourceQuality { public class CandidateSourceQualityDAL : ICandidateSourceQualityDAL { private readonly IQueryExecutor _QueryExecutor; public CandidateSourceQualityDAL(IQueryExecutor queryExecutor) { _QueryExecutor = queryExecutor; } // Small bounded aggregate (<= 6 Source rows per tenant) — no real SQL-level OFFSET/FETCH, // see CandidateSourceQualityQB's doc comment. Offset/PageSize are intentionally not added // to the parameter set: the SQL text never references them (same pattern as // TMSDAL's ComplianceCoverageSummaryDAL, whose SQL also never references its own // Offset/PageSize parameters). public async Task> GetCandidateSourceQuality( int firstNumber, int maxResult, LoginDTO login, CancellationToken ct) { var parameters = new { TenantId = login.ClientId }; return await _QueryExecutor .QueryPagedAsync(login, CandidateSourceQualityQB.GET_CANDIDATE_SOURCE_QUALITY, parameters) .ConfigureAwait(false); } public async IAsyncEnumerable GetCandidateSourceQualityStream( LoginDTO login, [EnumeratorCancellation] CancellationToken ct) { var parameters = new { TenantId = login.ClientId }; await foreach (var row in _QueryExecutor .QueryStreamAsync(login, CandidateSourceQualityQB.GET_CANDIDATE_SOURCE_QUALITY, parameters, ct) .ConfigureAwait(false)) { yield return row; } } } }