This commit is contained in:
moriese
2024-12-27 01:23:35 +01:00
parent 7d349a37d4
commit c06ac10d09
18 changed files with 543 additions and 0 deletions

0
src/tasks/drink.task.ts Normal file
View File

View File

@@ -0,0 +1,16 @@
import { CronJob } from "cron";
import { GreetingService } from "services/greeting.service";
const greetingService = new GreetingService();
new CronJob(
"0 */1 * * * *", // cronTime
async () => {
console.log("called greeting");
await greetingService.greet();
}, // onTick
null, // onComplete
true, // start
"Europe/Berlin", // timeZone
);
// job.start() is optional here because of the fourth parameter set to true.

View File

@@ -0,0 +1,16 @@
import { CronJob } from "cron";
import { WaterMeService } from "services/water-me.service";
const waterMeService = new WaterMeService();
new CronJob(
"0 0 */2 * * *", // cronTime
async () => {
console.log("isThirsty()");
await waterMeService.isThirsty();
}, // onTick
null, // onComplete
true, // start
"Europe/Berlin", // timeZone
);
// job.start() is optional here because of the fourth parameter set to true.