🛠️ Fix build compilation errors
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
import { Processor, Process } from '@nestjs/bull';
|
import { Processor, Process, InjectQueue } from '@nestjs/bull';
|
||||||
import { Job } from 'bull';
|
import { Job, Queue } from 'bull';
|
||||||
import { Logger } from '@nestjs/common';
|
import { Logger } from '@nestjs/common';
|
||||||
import { InjectRedis } from '@liaoliaots/nestjs-redis';
|
|
||||||
import Redis from 'ioredis';
|
|
||||||
import { InvoicesService } from './invoice.service';
|
import { InvoicesService } from './invoice.service';
|
||||||
|
|
||||||
@Processor('invoice-bulk-queue')
|
@Processor('invoice-bulk-queue')
|
||||||
@@ -11,7 +9,7 @@ export class BulkUploadProcessor {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly invoicesService: InvoicesService,
|
private readonly invoicesService: InvoicesService,
|
||||||
@InjectRedis() private readonly redis: Redis,
|
@InjectQueue('invoice-bulk-queue') private readonly bulkQueue: Queue,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Process('process-zip')
|
@Process('process-zip')
|
||||||
@@ -24,11 +22,11 @@ export class BulkUploadProcessor {
|
|||||||
// 1. Calculate Hash (MD5/SHA256)
|
// 1. Calculate Hash (MD5/SHA256)
|
||||||
// 2. Check Redis SMEMBERS to prevent duplicate processing
|
// 2. Check Redis SMEMBERS to prevent duplicate processing
|
||||||
// const hash = 'calculated_file_hash';
|
// const hash = 'calculated_file_hash';
|
||||||
// const exists = await this.redis.sismember(`company:${companyId}:invoice-hashes`, hash);
|
// const exists = await this.bulkQueue.client.sismember(`company:${companyId}:invoice-hashes`, hash);
|
||||||
// if (exists) return;
|
// if (exists) return;
|
||||||
|
|
||||||
// 3. Save hash and trigger individual processing
|
// 3. Save hash and trigger individual processing
|
||||||
// await this.redis.sadd(`company:${companyId}:invoice-hashes`, hash);
|
// await this.bulkQueue.client.sadd(`company:${companyId}:invoice-hashes`, hash);
|
||||||
// await this.invoicesService.processSingleFile(fileInZip, tenantId, companyId);
|
// await this.invoicesService.processSingleFile(fileInZip, tenantId, companyId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ export class GeminiExtractorService {
|
|||||||
const data = JSON.parse(cleanedJson);
|
const data = JSON.parse(cleanedJson);
|
||||||
return data.invoices || [];
|
return data.invoices || [];
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
this.logger.error(\`AI Extraction failed: \${error.message}\`);
|
this.logger.error(`AI Extraction failed: ${error.message}`);
|
||||||
throw new InternalServerErrorException('AI Extraction failed');
|
throw new InternalServerErrorException('AI Extraction failed');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ export class InvoiceProcessor {
|
|||||||
if (result.isValid) {
|
if (result.isValid) {
|
||||||
await this.invoiceRepository.update(invoiceId, {
|
await this.invoiceRepository.update(invoiceId, {
|
||||||
status: InvoiceStatus.VALIDATED,
|
status: InvoiceStatus.VALIDATED,
|
||||||
validation_errors: null,
|
validation_errors: [],
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await this.invoiceRepository.update(invoiceId, {
|
await this.invoiceRepository.update(invoiceId, {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export class UBLGeneratorService {
|
|||||||
.up();
|
.up();
|
||||||
|
|
||||||
// ── InvoiceLines ─────────────────────────────────────
|
// ── InvoiceLines ─────────────────────────────────────
|
||||||
invoice.lines.forEach((line) => {
|
invoice.lines.forEach((line: any) => {
|
||||||
doc.ele('cac:InvoiceLine')
|
doc.ele('cac:InvoiceLine')
|
||||||
.ele('cbc:ID').txt(line.line_number.toString()).up()
|
.ele('cbc:ID').txt(line.line_number.toString()).up()
|
||||||
.ele('cbc:InvoicedQuantity', { unitCode: 'PCE' }).txt(line.quantity.toString()).up()
|
.ele('cbc:InvoicedQuantity', { unitCode: 'PCE' }).txt(line.quantity.toString()).up()
|
||||||
|
|||||||
Reference in New Issue
Block a user