async function updatePlateStatus()

in main/src/image-management/image-management.ts [517:579]


async function updatePlateStatus(
  plateId: any,
  status: any,
  width: any,
  height: any,
  depth: any,
  channels: any
) {
  const partitionKey = "plate#" + plateId;
  const key = {
    [PARTITION_KEY_IMGID]: partitionKey,
    [SORT_KEY_TRNID]: ORIGIN,
  };
  const expressionAttributeNames =
    '"#r" : "' +
    [SEARCH_READY_ATTRIBUTE] +
    '",' +
    '"#w" : "' +
    [WIDTH_ATTRIBUTE] +
    '",' +
    '"#h" : "' +
    [HEIGHT_ATTRIBUTE] +
    '",' +
    '"#d" : "' +
    [DEPTH_ATTRIBUTE] +
    '",' +
    '"#c" : "' +
    [CHANNELS_ATTRIBUTE] +
    '"';

  const expressionAttributeValues =
    '":r" : "' +
    status +
    '",' +
    '":w" : "' +
    width +
    '",' +
    '":h" : "' +
    height +
    '",' +
    '":d" : "' +
    depth +
    '",' +
    '":c" : "' +
    channels +
    '"';

  const updateExpression =
    "set #r = :r, " + "#w = :w, " + "#h = :h, " + "#d = :d, " + "#c = :c";

  const namesParse = "{" + expressionAttributeNames + "}";
  const valuesParse = "{" + expressionAttributeValues + "}";

  const params = {
    TableName: TABLE_NAME,
    Key: key,
    UpdateExpression: updateExpression,
    ExpressionAttributeNames: JSON.parse(namesParse),
    ExpressionAttributeValues: JSON.parse(valuesParse),
  };
  console.log(params);
  return await db.update(params).promise();
}