forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplates.module.ts
More file actions
35 lines (33 loc) · 1.13 KB
/
Copy pathtemplates.module.ts
File metadata and controls
35 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { BullModule, InjectQueue } from "@nestjs/bull";
import { Module, OnModuleInit } from "@nestjs/common";
import { TypeOrmModule } from "@nestjs/typeorm";
import { Queue } from "bull";
import { SavedTemplate } from "./entities/saved-template.entity";
import { SmartDefault } from "./entities/smart-default.entity";
import { Split } from "@/entities/split.entity";
import { TemplateService } from "./templates.service";
import { TemplateProcessor } from "./templates.processor";
import { TemplateController } from "./templates.controller";
@Module({
imports: [
TypeOrmModule.forFeature([SavedTemplate, SmartDefault, Split]),
BullModule.registerQueue({
name: "template-tasks",
}),
],
providers: [TemplateService, TemplateProcessor],
controllers: [TemplateController],
})
export class TemplatesModule implements OnModuleInit {
constructor(@InjectQueue("template-tasks") private queue: Queue) {}
async onModuleInit() {
await this.queue.add(
"recalculate-smart-defaults",
{},
{
repeat: { cron: "0 0 * * 0" }, // Every Sunday at Midnight
jobId: "weekly-smart-update",
},
);
}
}