private async Task PublishContact(Token token, ContactDetails contact) { var contactTopicArn = Environment.GetEnvironmentVariable("CONTACT_DETAILS_SNS_ARN"); var createContactDetailsSnsMessage = _snsFactory.Create(contact, token, EventConstants.DELETED); await _snsGateway.Publish(createContactDetailsSnsMessage, contactTopicArn).ConfigureAwait(false); }
public async Task <PersonResponseObject> ExecuteAsync(CreatePersonRequestObject personRequestObject, Token token) { var person = await _gateway.PostNewPersonAsync(personRequestObject).ConfigureAwait(false); var personSnsMessage = _snsFactory.Create(person, token); var topicArn = Environment.GetEnvironmentVariable("PERSON_SNS_ARN"); await _snsGateway.Publish(personSnsMessage, topicArn).ConfigureAwait(false); return(_responseFactory.ToResponse(person)); }
public async Task <ContactDetailsResponseObject> ExecuteAsync(ContactDetailsRequestObject contactRequest, Token token) { var dbObject = contactRequest.ToDomain(token).ToDatabase(); var contact = await _gateway.CreateContact(dbObject).ConfigureAwait(false); var contactTopicArn = Environment.GetEnvironmentVariable("CONTACT_DETAILS_SNS_ARN"); var createContactDetailsSnsMessage = _snsFactory.Create(contact, token, EventConstants.CREATED); await _snsGateway.Publish(createContactDetailsSnsMessage, contactTopicArn).ConfigureAwait(false); return(contact.ToResponse()); }