async function getProducts()

in backend/src/getAllProducts/getAllProducts.js [9:24]


async function getProducts() {
  const config = await getConfig();
  const flag = await getFeature('show_stock', config);
  let attributesToGet = '';
  if (flag) {
    attributesToGet = ['id', 'itemDesc', 'itemName', 'itemPrice', 'itemImage', 'itemStock'];
  } else {
    attributesToGet = ['id', 'itemDesc', 'itemName', 'itemPrice', 'itemImage'];
  }
  const params = {
    TableName: tableName,
    AttributesToGet: attributesToGet,
  };
  const data = await docClient.scan(params).promise();
  return data;
}