in services/application/apps/product/src/products/products.service.ts [77:101]
async findOne(id: string, tenantId: string) {
try {
console.log('Getting Product: ', id);
const client = await this.fetchClient(tenantId);
const cmd = new QueryCommand({
TableName: this.tableName,
KeyConditionExpression: 'tenant_id=:t_id AND product_id=:p_id',
ExpressionAttributeValues: {
':t_id': tenantId,
':p_id': id,
},
});
const response = await client.send(cmd);
return JSON.stringify(response.Items && response.Items[0]);
} catch (error) {
console.error(error);
throw new HttpException(
{
status: HttpStatus.INTERNAL_SERVER_ERROR,
error: error,
},
HttpStatus.INTERNAL_SERVER_ERROR,
);
}
}