Compare commits
2 commits
43bb990df5
...
f95ed86012
Author | SHA1 | Date | |
---|---|---|---|
f95ed86012 | |||
95b2f4283b |
5 changed files with 22 additions and 23 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,8 +1,9 @@
|
|||
## Node modules ##
|
||||
# node_modules
|
||||
node_modules
|
||||
|
||||
#javascript build files #
|
||||
public/**/*
|
||||
dist/**/*
|
||||
|
||||
# Tmp files #
|
||||
tmp
|
||||
|
@ -10,6 +11,7 @@ tmp
|
|||
|
||||
## ENV Vars ##
|
||||
.env
|
||||
config/client_google_auth.json
|
||||
|
||||
## Docker ##
|
||||
build_image.sh
|
||||
|
|
2
dist/GameSource.js
vendored
2
dist/GameSource.js
vendored
|
@ -31,7 +31,7 @@ class GameSource {
|
|||
const end = (0, moment_1.default)(gameDate + gameTime, "DD/MM/YYYYHH:mm").add(2, "hours").toISOString();
|
||||
games.push({
|
||||
summary: 'Maccabi Haifa F.C.',
|
||||
location: "Ofir's stadium",
|
||||
location: headerSplit[4].trim(),
|
||||
description: `${teamsPlaying[0]} vs. ${teamsPlaying[1]}`,
|
||||
start: {
|
||||
dateTime: start,
|
||||
|
|
3
dist/index.js
vendored
3
dist/index.js
vendored
|
@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const GameSource_1 = __importDefault(require("./GameSource"));
|
||||
const GoogleCalendar_1 = __importDefault(require("./GoogleCalendar"));
|
||||
const dotenv_1 = __importDefault(require("dotenv"));
|
||||
const node_cron_1 = __importDefault(require("node-cron"));
|
||||
dotenv_1.default.config();
|
||||
class App {
|
||||
constructor() {
|
||||
|
@ -17,7 +16,6 @@ class App {
|
|||
console.log("START CRON JOB");
|
||||
await this.googleCalendar.init();
|
||||
// Schedule the job to run daily at a specific time (e.g., 1:00 AM)
|
||||
node_cron_1.default.schedule("* * * * *", async () => {
|
||||
try {
|
||||
const games = await app.gameSource.getGamesFromHaifa();
|
||||
for (const game of games) {
|
||||
|
@ -34,7 +32,6 @@ class App {
|
|||
catch (error) {
|
||||
console.error("Error in cron job:", error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
const app = new App();
|
||||
|
|
|
@ -33,9 +33,11 @@ export default class GameSource {
|
|||
const start = moment(gameDate + gameTime, "DD/MM/YYYYHH:mm").toISOString();
|
||||
const end = moment(gameDate + gameTime, "DD/MM/YYYYHH:mm").add(2, "hours").toISOString();
|
||||
|
||||
|
||||
|
||||
games.push({
|
||||
summary: 'Maccabi Haifa F.C.',
|
||||
location: "Ofir's stadium",
|
||||
location: headerSplit[4].trim(),
|
||||
description: `${teamsPlaying[0]} vs. ${teamsPlaying[1]}`,
|
||||
start: {
|
||||
dateTime: start,
|
||||
|
|
|
@ -21,7 +21,6 @@ class App {
|
|||
await this.googleCalendar.init();
|
||||
|
||||
// Schedule the job to run daily at a specific time (e.g., 1:00 AM)
|
||||
cron.schedule("* * * * *", async () => {
|
||||
try {
|
||||
const games = await app.gameSource.getGamesFromHaifa();
|
||||
|
||||
|
@ -42,7 +41,6 @@ class App {
|
|||
} catch (error) {
|
||||
console.error("Error in cron job:", error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue