| import type { ModuleInterface } from '@n8n/decorators'; |
| import { BackendModule } from '@n8n/decorators'; |
| import { Container } from '@n8n/di'; |
| import './insights.controller'; |
| import { InstanceSettings } from 'n8n-core'; |
|
|
| import { InsightsByPeriod } from './database/entities/insights-by-period'; |
| import { InsightsMetadata } from './database/entities/insights-metadata'; |
| import { InsightsRaw } from './database/entities/insights-raw'; |
|
|
| @BackendModule({ name: 'insights' }) |
| export class InsightsModule implements ModuleInterface { |
| async init() { |
| const { instanceType } = Container.get(InstanceSettings); |
|
|
| |
| |
| |
| |
| if (instanceType === 'worker') return; |
|
|
| await import('./insights.controller'); |
|
|
| const { InsightsService } = await import('./insights.service'); |
| Container.get(InsightsService).startTimers(); |
| } |
|
|
| entities() { |
| return [InsightsByPeriod, InsightsMetadata, InsightsRaw]; |
| } |
|
|
| async settings() { |
| const { InsightsService } = await import('./insights.service'); |
| return Container.get(InsightsService).settings(); |
| } |
| } |
|
|