feat(history): enhance ReadHistoryQuery to support Envelope object and UUID

- Replace nullable `OnlyLast` with non-nullable default `true`
- Support filtering by Envelope object (Id or Uuid) in addition to deprecated EnvelopeId
- Throw `BadRequestException` if no valid Envelope reference is provided
- Preserve status filtering and ordering for latest history entries
This commit is contained in:
2025-11-14 13:24:02 +01:00
parent e5a061d5b5
commit 00c7fe5316
3 changed files with 17 additions and 5 deletions

View File

@@ -51,9 +51,9 @@ public class ReadHistoryQueryHandler : IRequestHandler<ReadHistoryQuery, IEnumer
{
var query = _repo.Query;
if (request.Envelope?.Id is int envId)
if (request.Envelope.Id is int envId)
query = query.Where(e => e.Id == envId);
else if (request.Envelope?.Uuid is string uuid)
else if (request.Envelope.Uuid is string uuid)
query = query.Where(e => e.Envelope!.Uuid == uuid);
#pragma warning disable CS0618 // Type or member is obsolete
else if (request.EnvelopeId is not null)