in src/checker.ts [38:56]
async function checkFile(): Promise<boolean> {
const config = await fetchConfig();
const today = moment();
const tomorrow = moment().add(1, 'day');
const filePath = `${
config.fulfilments.homedelivery.uploadFolder.prefix
}${tomorrow.format('YYYY-MM-DD')}_HOME_DELIVERY.csv`;
const metadata = await getFileInfo(filePath);
const lastModified = moment(metadata.LastModified);
console.log(`Last modified date ${lastModified.format('YYYY-MM-DD')}`);
const fileAge = today.diff(lastModified, 'days');
console.log(`File is ${fileAge} day(s) old`);
const tomorrowDayOfTheWeek = tomorrow.format('ddd') as keyof typeof maxAgeFor;
const maxAllowedAge = maxAgeFor[tomorrowDayOfTheWeek];
console.log(
`Max allowed age for ${tomorrowDayOfTheWeek} files is ${maxAllowedAge}`,
);
return fileAge <= maxAllowedAge;
}