public virtual async Task Remove(Guid currentUserId, Guid chatId) { await ChatsPermissionValidator.ValidateRemove(currentUserId, chatId, ServiceName); var command = ChatsCommandBuilder.BuildRemoveChatCommand(currentUserId, chatId); await ChatCommandSender.Send(command).ConfigureAwait(false); }
public virtual async Task Handle(IRemoveChatCommand command, IChatBusContext chatEventPublisher) { await ChatsPermissionValidator.ValidateRemove(command.InitiatorUserId, command.ChatId, WorkerName).ConfigureAwait(false); var chatInfo = await ChatStore.Delete(command.ChatId, command.InitiatorUserId).ConfigureAwait(false); var @event = ChatsEventBuilder.BuildChatRemovedEvent(command.InitiatorUserId, command.ChatId, chatInfo); await chatEventPublisher.EventPublisher.Publish(@event).ConfigureAwait(false); }