async function deleteUserSubscription()

in typescript/src/link/deleteLink.ts [31:48]


async function deleteUserSubscription(
  userLinks: UserSubscription[],
): Promise<number> {
  let count = 0;
  for (const userLink of userLinks) {
    const deletionResult = await dynamoMapper.delete(userLink);
    if (deletionResult) {
      count++;
    }
  }

  if (userLinks.length != count) {
    console.warn(`Queried ${userLinks.length} rows, but only deleted ${count}`);
  }

  console.log(`Deleted ${count} rows`);
  return count;
}