Esempio n. 1
0
        public async Task CancelOrder(Guid orderId)
        {
            var player = await _playerRepo.GetPlayer(Context.User);

            var order = await _repo.GetOrder(orderId);

            if (order.OwnerId != player.PlayerId)
            {
                throw new UnauthorizedAccessException("User does not own the order");
            }

            var evnt = new OrderCancelledEvent(orderId, player)
            {
                CancellationReason = OrderCancellationReason.User,
            };
            await _eventStore.ProduceAsync(evnt);
        }