cleaning
This commit is contained in:
parent
3aeb79f054
commit
1f59ccfb2c
1 changed files with 26 additions and 17 deletions
11
src/index.ts
11
src/index.ts
|
@ -17,7 +17,7 @@ class App {
|
|||
|
||||
async startCronJob() {
|
||||
console.log("START CRON JOB");
|
||||
|
||||
const newGamesAdded = [];
|
||||
await this.googleCalendar.init();
|
||||
|
||||
// Schedule the job to run daily at a specific time (e.g., 1:00 AM)
|
||||
|
@ -32,12 +32,21 @@ class App {
|
|||
);
|
||||
|
||||
if (!isDuplicateEvent) {
|
||||
newGamesAdded.push(game);
|
||||
console.log("Event does not exist");
|
||||
await this.googleCalendar.updateNewEvent([game]);
|
||||
} else {
|
||||
console.log("Event already exists");
|
||||
console.log("Event:");
|
||||
console.log("Happening at:");
|
||||
}
|
||||
}
|
||||
|
||||
if(newGamesAdded.length > 0) {
|
||||
console.log("New games added:", newGamesAdded);
|
||||
} else {
|
||||
console.log("No new games added");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error in cron job:", error.message);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue