feat(application): IAvisoQueryRepository + NullAvisoQueryRepository (CAT-002)
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
namespace SIGCM2.Application.Abstractions.Persistence;
|
||||
|
||||
/// <summary>
|
||||
/// Query-only access to Aviso counts by Rubro.
|
||||
/// CAT-002 introduces the contract. The real Dapper-based impl lands in PRD-002
|
||||
/// (when dbo.Aviso exists). Until then, NullAvisoQueryRepository is the binding.
|
||||
/// </summary>
|
||||
public interface IAvisoQueryRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the count of avisos (active, non-archived) assigned to the given rubro.
|
||||
/// </summary>
|
||||
Task<int> CountAvisosEnRubroAsync(int rubroId, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a dictionary of { rubroId → count } for the provided ids.
|
||||
/// Used by GetRubroTreeQueryHandler to avoid N+1 when populating TieneAvisos per node.
|
||||
/// The implementation MUST do a single query; the stub returns an empty dictionary
|
||||
/// (every rubro gets 0 via dictionary.GetValueOrDefault).
|
||||
/// </summary>
|
||||
Task<IReadOnlyDictionary<int, int>> CountAvisosBatchAsync(
|
||||
IReadOnlyCollection<int> rubroIds,
|
||||
CancellationToken ct = default);
|
||||
}
|
||||
Reference in New Issue
Block a user