I stuck with problem, how correctly put this two crons into methods?
exampleCron1:
module.exports = functions.pubsub
.schedule("0 0 12 * *")
.timeZone("")
.onRun(async () => {
const startDate = startOfDate();
const endDate = endOfDate();
const dateBefore = dateBeforeGameDay();
let listGameOrders = await getGameOrdersForEmailing(startDate, endDate);
return !finishedGameOrdersStatusIds.includes(order.GameStatus);
});
let rows = finishGameOrdersStatus
.map(
(id) =>
`</td><td>${game.id}</td></tr>`
)
sentGameHtmlEmail(statusGameOrdersView);
});
exampleCron2:
const processGamerReminderEmail = async (gamerOrders: OrderData[]) => {
const gamerId = firstOrder
? firstGameOrder.gamerId
? firstGameOrder.gamerId
: ""
: "";
const gamerData = await (await gamer.doc(gamerId).get()).data();
return await sentGameHtmlEmail(
gamerReminderEmail
);
};
module.exports = functions.pubsub
.schedule("0 0 12 * *")
.timeZone("")
.onRun(async () => {
const startDate = startOfDate();
const endDate = endOfDate();
const dateBefore = dateBeforeGameDay();
const finalizedStatusDayBefore = [
];
return await Promise.all(
_.map(orderedByGamerId, (gameOrders: OrderData[]) => {
return processGamerReminderEmail(gameOrders);
})
);
});
And I don't understand how write methods correctly
I thought it should look something like this :
newGameEmails(()==>{
exampleСron1(),
exampleCron2()})