Skip to content

Commit

Permalink
Merge pull request #159 from soat-fiap/add_user_to_customers_group
Browse files Browse the repository at this point in the history
add user to customer group
  • Loading branch information
italopessoa authored Sep 24, 2024
2 parents 6c2946b + 3aee0e5 commit 51391d9
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ public async Task<Customer> CreateAsync(Customer customer)
}
});

await _cognitoClient.AdminAddUserToGroupAsync(new AdminAddUserToGroupRequest
{
UserPoolId = _userPoolId,
Username = customer.Cpf,
GroupName = "customer"
});

logger.LogInformation("Customer successfully created.");
customer.Id = Guid.Parse(signUpResponse.User.Attributes.First(a => a.Name is "sub").Value);
return customer;
Expand Down Expand Up @@ -91,6 +98,8 @@ public async Task<Customer> CreateAsync(Customer customer)
UserPoolId = _userPoolId,
});



if (response.Users.Count > 0)
{
var attributes = response.Users[0].Attributes;
Expand Down

0 comments on commit 51391d9

Please sign in to comment.