Refactor ReadHistoryQuery and optimize repository queries

- Changed `EnvelopeId` in `ReadHistoryQuery` to nullable
  for improved flexibility in queries.
- Introduced `withReceiver` variable in `HistoryController`
  to enhance query logic for retrieving history records.
- Updated `EnvelopeHistoryRepository` to use `AsNoTracking()`
  for better performance in read-only scenarios.
This commit is contained in:
Developer 02
2025-05-06 23:23:33 +02:00
parent 27d9a149bc
commit 21859ca6e6
3 changed files with 4 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ public class EnvelopeHistoryRepository : CRUDRepository<EnvelopeHistory, long, E
private IQueryable<EnvelopeHistory> By(int? envelopeId = null, string? userReference = null, int? status = null, bool withSender = false, bool withReceiver = false)
{
var query = _dbSet.AsQueryable();
var query = _dbSet.AsNoTracking();
if (envelopeId is not null)
query = query.Where(eh => eh.EnvelopeId == envelopeId);