mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-10 15:17:41 +00:00
feat: implement scheduler for periodic data updates and optimize database procedures
- Added SchedulerModule and SchedulerService to handle hourly data updates for AQI, occupancy, and energy consumption. - Refactored existing services to remove unused device repository dependencies and streamline procedure execution. - Updated SQL procedures to use correct parameter indexing. - Enhanced error handling and logging for scheduled tasks. - Integrated new repositories for presence sensor and AQI pollutant stats across multiple modules. - Added NestJS schedule package for task scheduling capabilities.
This commit is contained in:
25
src/scheduler/scheduler.module.ts
Normal file
25
src/scheduler/scheduler.module.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { DatabaseModule } from '@app/common/database/database.module';
|
||||
import { SqlLoaderService } from '@app/common/helper/services/sql-loader.service';
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { SchedulerService } from './scheduler.service';
|
||||
import { ScheduleModule as NestScheduleModule } from '@nestjs/schedule'; // ✅ الباكيج الرسمي
|
||||
import { AqiDataService } from '@app/common/helper/services/aqi.data.service';
|
||||
import { OccupancyService } from '@app/common/helper/services/occupancy.service';
|
||||
import { PowerClampService } from '@app/common/helper/services/power.clamp.service';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
NestScheduleModule.forRoot(),
|
||||
TypeOrmModule.forFeature([]),
|
||||
DatabaseModule,
|
||||
],
|
||||
providers: [
|
||||
SchedulerService,
|
||||
SqlLoaderService,
|
||||
PowerClampService,
|
||||
OccupancyService,
|
||||
AqiDataService,
|
||||
],
|
||||
})
|
||||
export class SchedulerModule {}
|
Reference in New Issue
Block a user