🚀 Elite Accountant Hub: Foundation & Trojan Horse deployment

This commit is contained in:
Hamza-Ayed
2026-04-22 01:05:25 +03:00
parent 2e2d76c0a8
commit 444097814d
23 changed files with 796 additions and 88 deletions

View File

@@ -0,0 +1,34 @@
import { Processor, Process } from '@nestjs/bull';
import { Job } from 'bull';
import { Logger } from '@nestjs/common';
import { InjectRedis } from '@liaoliaots/nestjs-redis';
import Redis from 'ioredis';
import { InvoicesService } from './invoice.service';
@Processor('invoice-bulk-queue')
export class BulkUploadProcessor {
private readonly logger = new Logger(BulkUploadProcessor.name);
constructor(
private readonly invoicesService: InvoicesService,
@InjectRedis() private readonly redis: Redis,
) {}
@Process('process-zip')
async handleBulkZip(job: Job<{ filePath: string, companyId: string, tenantId: string }>) {
const { filePath, companyId, tenantId } = job.data;
this.logger.log(`Processing bulk ZIP: ${filePath} for Company: ${companyId}`);
// TODO: Implement ZIP extraction (adm-zip or unzipper)
// TODO: For each file in ZIP:
// 1. Calculate Hash (MD5/SHA256)
// 2. Check Redis SMEMBERS to prevent duplicate processing
// const hash = 'calculated_file_hash';
// const exists = await this.redis.sismember(`company:${companyId}:invoice-hashes`, hash);
// if (exists) return;
// 3. Save hash and trigger individual processing
// await this.redis.sadd(`company:${companyId}:invoice-hashes`, hash);
// await this.invoicesService.processSingleFile(fileInZip, tenantId, companyId);
}
}