Update invoice verification to use specific NocoDB table IDs

Refactor invoice verification service to correctly utilize `nocodbTableId` for NocoDB API calls, defaulting to 'mrr733dfb8wtt9b' if not provided. Updates column names for invoice and delivery slip searches to 'RefFacture' and 'Numero_BL' respectively. Also, corrects NocoDB configuration URLs and project IDs for production environments.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/t34W525
This commit is contained in:
michaelschal committed 2025-08-13 13:30:44 +00:00
1 parent d7241e857e
commit 87c111741b
6 files changed
+356 -13

No files matched your search

+16 -6
View File
@@ -109,12 +109,20 @@ export class InvoiceVerificationService {
hasToken: !!nocodbConfig.apiToken
});
// Utiliser l'ID de table configuré dans le groupe
const tableId = group.nocodbTableId || 'mrr733dfb8wtt9b'; // Fallback par défaut
console.log('🔧 Utilisation table ID:', {
groupTable: group.nocodbTableName,
configuredId: group.nocodbTableId,
resolvedId: tableId
});
// Vérifier d'abord par référence de facture
let matchResult = await this.searchInNocoDB(
invoiceReference,
group.invoiceColumnName || 'invoice_reference',
group.invoiceColumnName || 'RefFacture',
nocodbConfig,
group.nocodbTableName || 'invoices'
tableId
);
if (matchResult.found) {
@@ -131,9 +139,9 @@ export class InvoiceVerificationService {
if (group.nocodbBlColumnName) {
matchResult = await this.searchInNocoDB(
invoiceReference,
group.nocodbBlColumnName,
group.nocodbBlColumnName || 'Numero_BL',
nocodbConfig,
group.nocodbTableName || 'invoices'
tableId
);
if (matchResult.found) {
@@ -180,13 +188,15 @@ export class InvoiceVerificationService {
searchValue: string,
columnName: string,
config: any,
tableName: string
tableId: string
): Promise<{ found: boolean; data?: any }> {
try {
const searchUrl = `${config.baseUrl}/api/v1/db/data/v1/${config.projectId}/${tableName}`;
// Utiliser directement l'ID de table fourni
const searchUrl = `${config.baseUrl}/api/v1/db/data/v1/${config.projectId}/${tableId}`;
console.log('🔍 Recherche NocoDB:', {
url: searchUrl,
tableId: tableId,
column: columnName,
value: searchValue
});