aws-user-service
Advanced tools
Comparing version 1.2.1 to 1.3.0
17
index.js
@@ -44,13 +44,9 @@ const MongoRepository = require('senter-mongo-repository') | ||
async getUser(userId) { | ||
return await this.getUserById(userId) | ||
} | ||
async getUserFromRequest(request) { | ||
const userId = await this.getUserIdFromRequest(request) | ||
return await this.getUser(userId) | ||
return await this.getUserById(userId) | ||
} | ||
async getUserById(userId) { | ||
const listUsersResponse = await this.cognitoidentityserviceprovider.listUsers({ | ||
const listUsersResponsePromise = this.cognitoidentityserviceprovider.listUsers({ | ||
UserPoolId: this.authIntegrationUserPoolId, | ||
@@ -60,3 +56,10 @@ Filter: `sub = "${userId}"`, | ||
}).promise() | ||
return listUsersResponse.Users[0] | ||
const getSenterUserPromise = this.userRepository.getById(userId, null, noOrganisationOptions) | ||
const result = await Promise.all([listUsersResponsePromise, getSenterUserPromise]) | ||
const cognitoUser = result[0].Users[0] | ||
cognitoUser.organisationId = result[1].organisationId | ||
cognitoUser.id = userId | ||
return cognitoUser | ||
} | ||
@@ -63,0 +66,0 @@ |
{ | ||
"name": "aws-user-service", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Contain methods to work with asw user", | ||
@@ -14,2 +14,2 @@ "main": "index.js", | ||
} | ||
} | ||
} |
4946
113