public override async Task <IList <StoredEventData> > ExecuteQuery(ListOrderStoredEventsQuery request, CancellationToken cancellationToken) { List <StoredEventData> storedEvents = new List <StoredEventData>(); var orderStoredEvents = await _storedEvents .GetByAggregateId(request.OrderId, cancellationToken); storedEvents.AddRange( StoredEventPrettier <StoredEventData> .ToPretty(orderStoredEvents) ); var orderId = new OrderId(request.OrderId); var isPaymentOfOrder = new IsPaymentOfOrder(orderId); var payment = await _unitOfWork.Payments .Find(isPaymentOfOrder, cancellationToken); if (payment.Count > 0) { var paymentStoredEvents = await _storedEvents .GetByAggregateId(payment[0].Id.Value, cancellationToken); storedEvents.AddRange(StoredEventPrettier <StoredEventData> .ToPretty(paymentStoredEvents)); } return(storedEvents); }
public override async Task <IList <CustomerStoredEventData> > ExecuteQuery(ListCustomerStoredEventsQuery request, CancellationToken cancellationToken) { var storedEvents = await _storedEvents .GetByAggregateId(request.CustomerId, cancellationToken); IList <CustomerStoredEventData> customerStoredEvents = StoredEventPrettier <CustomerStoredEventData> .ToPretty(storedEvents); return(customerStoredEvents); }