in source/services/api/status/lib/status.js [135:164]
async _validateUserDeviceRegistration(deviceId, userId) {
let params = {
TableName: process.env.REGISTRATION_TBL,
Key: {
userId: userId,
deviceId: deviceId,
},
};
const docClient = new AWS.DynamoDB.DocumentClient(this.dynamoConfig);
try {
let data = await docClient.get(params).promise();
if (!_.isEmpty(data)) {
return Promise.resolve(true);
} else {
return Promise.resolve(false);
}
} catch (err) {
Logger.error(Logger.levels.INFO, err);
Logger.error(
Logger.levels.INFO,
`[RegistrationRetrieveFailure] Error occurred while attempting to retrieve registration information for device ${deviceId}.`
);
return Promise.reject({
code: 500,
error: 'RegistrationRetrieveFailure',
message: `Error occurred while attempting to retrieve registration information for device "${deviceId}".`,
});
}
}