whitelisted cols

by David Santiago

TypeScript

const tableName = "Payments";

const WHITELISTED_COLUMNS = {
  Payments: [
    "paymentId",
    "fee",
    "address",
  ]
};

console.log(WHITELISTED_COLUMNS[`${tableName}`].join(","));


 function getDateTimeRange(date: Date) {
  const start = new Date(date);
  start.setDate(date.getDate() - 1);
  start.setUTCHours(22, 0, 0, 0);

  const end = new Date(date);
  end.setUTCHours(21, 59, 59, 999);
  return { start, end };
}

 function yesterdayTimeRange() {
  const today = new Date();
  const yesterday = new Date();
  yesterday.setDate(today.getDate() - 1);
  return getDateTimeRange(yesterday);
}

function getDateAsString(date: Date) {
  // eslint-disable-next-line prettier/prettier
  return `${date.getUTCFullYear()}-${date.getUTCMonth() + 1}-${date.getUTCDate()}`;
}

console.log("Yesterday timeRange", yesterdayTimeRange().end);

console.log(new Date().toISOString().substring(0, 10));