async function handleTimerEvent()

in lambda/publish-todays-curation/src/main.ts [70:95]


async function handleTimerEvent(
	date: Date,
	contentPrefix: string,
	staticBucketName: string,
	fastlyApiKey: string,
): Promise<void> {
	console.log(`Checking we have curation for ${formatISO(date)}...`);
	//Check if we have curation available for the new date
	const curations = await validateAllCuration(date, false, staticBucketName);
	if (curations.length == 0) {
		console.error(`No curation data was available for date ${formatISO(date)}`);
	} else {
		console.log(`Activating ${curations.length} fronts...`);
		await Promise.all(
			curations.map((curation) =>
				activateCuration(
					curation,
					contentPrefix,
					staticBucketName,
					fastlyApiKey,
				),
			),
		);
		console.log('Done.');
	}
}