fix: correct SyncService initialization in sync-scheduler

Fixed TypeScript errors in sync-scheduler:
- Added constructor to initialize SyncService with AutotaskClient
- Fixed AutotaskConfig property names (password, apiIntegrationCode)
- Changed method calls to match SyncService API (incrementalSync, fullSync)
- Fixed syncService references to use this.syncService

This resolves build errors preventing Docker image creation.
This commit is contained in:
root 2026-01-26 10:29:31 -05:00
parent f117210c9d
commit 3db50d8531

View file

@ -4,8 +4,9 @@
*/
import cron, { ScheduledTask } from 'node-cron';
import { syncService } from './sync-service';
import { SyncService, createSyncService } from './sync-service';
import { postgresClient } from './postgres-client';
import { AutotaskClient } from './autotask-client';
export interface ScheduleConfig {
id: string;
@ -34,6 +35,18 @@ class SyncScheduler {
private tasks: Map<string, ScheduledTask> = new Map();
private runningJobs: Set<string> = new Set();
private initialized = false;
private syncService: SyncService;
constructor() {
// Create sync service instance
const autotaskClient = new AutotaskClient({
apiUrl: process.env.AUTOTASK_API_URL || '',
username: process.env.AUTOTASK_USERNAME || '',
password: process.env.AUTOTASK_SECRET || '',
apiIntegrationCode: process.env.AUTOTASK_INTEGRATION_CODE || '',
});
this.syncService = createSyncService(autotaskClient);
}
/**
* Initialize the scheduler and load schedules from database
@ -228,9 +241,9 @@ class SyncScheduler {
// Execute the sync
if (config.sync_type === 'incremental') {
await syncService.startIncrementalSync('scheduled');
await this.syncService.incrementalSync('scheduled');
} else {
await syncService.startFullSync('scheduled', config.years_back || 2);
await this.syncService.fullSync('scheduled', config.years_back || 2);
}
// Update success status