Merge pull request #91 from R0m1k3/1.1

1.1
This commit is contained in:
LogiFlow authored and GitHub committed 2025-08-13 15:34:33 +02:00
commit f48825b535
7 files changed
+356 -14

No files matched your search

@@ -0,0 +1,200 @@
}
🔍 Recherche NocoDB: {
url: 'https://nocodb.ffnancy.fr/api/v1/db/data/v1/pcg4uw79ukvycxc/CommandeF',
column: 'RefFacture',
value: '37424'
}
🔧 Configuration NocoDB active récupérée: {
id: 1,
name: 'Nocodb',
baseUrl: 'https://nocodb.ffnancy.fr',
projectId: 'pcg4uw79ukvycxc',
apiToken: 'z4BAwLo6dgoN_E7PKJSHN7PA7kdBePtKOYcsDlwQ',
description: '',
isActive: true,
createdBy: 'admin_local',
createdAt: 2025-07-22T11:12:54.971Z,
updatedAt: 2025-07-25T23:07:17.197Z
}
🔧 Configuration NocoDB trouvée: {
configName: 'Nocodb',
baseUrl: 'https://nocodb.ffnancy.fr',
projectId: 'pcg4uw79ukvycxc',
hasToken: true
}
🔍 Recherche NocoDB: {
url: 'https://nocodb.ffnancy.fr/api/v1/db/data/v1/pcg4uw79ukvycxc/CommandeF',
column: 'RefFacture',
value: '000752796'
}
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
❌ Erreur réponse NocoDB: 404 Not Found
❌ Erreur réponse NocoDB: 404 Not Found
❌ Erreur réponse NocoDB: 404 Not Found
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
❌ Erreur réponse NocoDB: 404 Not Found
🔍 Recherche NocoDB: {
url: 'https://nocodb.ffnancy.fr/api/v1/db/data/v1/pcg4uw79ukvycxc/CommandeF',
column: 'Numero_BL',
value: 'F5164434'
}
POST /api/deliveries/38/verify-invoice 200 in 162ms
POST /api/deliveries/43/verify-invoice 200 in 167ms
POST /api/deliveries/11/verify-invoice 200 in 156ms
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
❌ Erreur réponse NocoDB: 404 Not Found
POST /api/deliveries/33/verify-invoice 200 in 149ms
❌ Erreur réponse NocoDB: 404 Not Found
🔍 Recherche NocoDB: {
url: 'https://nocodb.ffnancy.fr/api/v1/db/data/v1/pcg4uw79ukvycxc/CommandeF',
column: 'Numero_BL',
value: '37424'
}
❌ Erreur réponse NocoDB: 404 Not Found
🔍 Recherche NocoDB: {
url: 'https://nocodb.ffnancy.fr/api/v1/db/data/v1/pcg4uw79ukvycxc/CommandeF',
column: 'Numero_BL',
value: '000752796'
}
❌ Erreur réponse NocoDB: 404 Not Found
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
POST /api/deliveries/38/verify-invoice 200 in 166ms
❌ Erreur réponse NocoDB: 404 Not Found
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
POST /api/deliveries/28/verify-invoice 200 in 154ms
❌ Erreur réponse NocoDB: 404 Not Found
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
POST /api/deliveries/27/verify-invoice 200 in 166ms
HEAD /api/health 200 in 1ms
HEAD /api/health 200 in 1ms
HEAD /api/health 200 in 1ms
HEAD /api/health 200 in 2ms
@@ -0,0 +1,132 @@
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
❌ Erreur réponse NocoDB: 404 Not Found
❌ Erreur réponse NocoDB: 404 Not Found
❌ Erreur réponse NocoDB: 404 Not Found
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
❌ Erreur réponse NocoDB: 404 Not Found
🔍 Recherche NocoDB: {
url: 'https://nocodb.ffnancy.fr/api/v1/db/data/v1/pcg4uw79ukvycxc/CommandeF',
column: 'Numero_BL',
value: 'F5164434'
}
POST /api/deliveries/38/verify-invoice 200 in 162ms
POST /api/deliveries/43/verify-invoice 200 in 167ms
POST /api/deliveries/11/verify-invoice 200 in 156ms
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
❌ Erreur réponse NocoDB: 404 Not Found
POST /api/deliveries/33/verify-invoice 200 in 149ms
❌ Erreur réponse NocoDB: 404 Not Found
🔍 Recherche NocoDB: {
url: 'https://nocodb.ffnancy.fr/api/v1/db/data/v1/pcg4uw79ukvycxc/CommandeF',
column: 'Numero_BL',
value: '37424'
}
❌ Erreur réponse NocoDB: 404 Not Found
🔍 Recherche NocoDB: {
url: 'https://nocodb.ffnancy.fr/api/v1/db/data/v1/pcg4uw79ukvycxc/CommandeF',
column: 'Numero_BL',
value: '000752796'
}
❌ Erreur réponse NocoDB: 404 Not Found
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
POST /api/deliveries/38/verify-invoice 200 in 166ms
❌ Erreur réponse NocoDB: 404 Not Found
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
POST /api/deliveries/28/verify-invoice 200 in 154ms
❌ Erreur réponse NocoDB: 404 Not Found
✅ Résultat vérification: {
exists: false,
matchType: 'none',
errorMessage: 'Aucune correspondance trouvée dans NocoDB'
}
POST /api/deliveries/27/verify-invoice 200 in 166ms
HEAD /api/health 200 in 1ms
Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

-1
View File
@@ -2,4 +2,3 @@
# https://curl.se/docs/http-cookies.html # https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk. # This file was generated by libcurl! Edit at your own risk.
#HttpOnly_localhost FALSE / FALSE 1755175982 connect.sid s%3A55QseyVnXOsgNLS_il_ZNUUaswQTKyVl.ZO8oV5FOnntJvcJED2Tl8bgGphGUsDZ00lQOSVNGwD0
+16 -6
View File
@@ -109,12 +109,20 @@ export class InvoiceVerificationService {
hasToken: !!nocodbConfig.apiToken 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 // Vérifier d'abord par référence de facture
let matchResult = await this.searchInNocoDB( let matchResult = await this.searchInNocoDB(
invoiceReference, invoiceReference,
group.invoiceColumnName || 'invoice_reference', group.invoiceColumnName || 'RefFacture',
nocodbConfig, nocodbConfig,
group.nocodbTableName || 'invoices' tableId
); );
if (matchResult.found) { if (matchResult.found) {
@@ -131,9 +139,9 @@ export class InvoiceVerificationService {
if (group.nocodbBlColumnName) { if (group.nocodbBlColumnName) {
matchResult = await this.searchInNocoDB( matchResult = await this.searchInNocoDB(
invoiceReference, invoiceReference,
group.nocodbBlColumnName, group.nocodbBlColumnName || 'Numero_BL',
nocodbConfig, nocodbConfig,
group.nocodbTableName || 'invoices' tableId
); );
if (matchResult.found) { if (matchResult.found) {
@@ -180,13 +188,15 @@ export class InvoiceVerificationService {
searchValue: string, searchValue: string,
columnName: string, columnName: string,
config: any, config: any,
tableName: string tableId: string
): Promise<{ found: boolean; data?: any }> { ): Promise<{ found: boolean; data?: any }> {
try { 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:', { console.log('🔍 Recherche NocoDB:', {
url: searchUrl, url: searchUrl,
tableId: tableId,
column: columnName, column: columnName,
value: searchValue value: searchValue
}); });
+7 -5
View File
@@ -1165,6 +1165,7 @@ export class MemStorage implements IStorage {
color: '#3B82F6', color: '#3B82F6',
nocodbConfigId: 1, // Référence vers la config NocoDB de test nocodbConfigId: 1, // Référence vers la config NocoDB de test
nocodbTableName: 'invoices', nocodbTableName: 'invoices',
nocodbTableId: 'mrr733dfb8wtt9b', // ID réel de la table NocoDB
invoiceColumnName: 'invoice_reference', invoiceColumnName: 'invoice_reference',
nocodbBlColumnName: 'bl_number', nocodbBlColumnName: 'bl_number',
nocodbAmountColumnName: 'amount', nocodbAmountColumnName: 'amount',
@@ -1284,6 +1285,7 @@ export class MemStorage implements IStorage {
color: groupData.color || null, color: groupData.color || null,
nocodbConfigId: groupData.nocodbConfigId || null, nocodbConfigId: groupData.nocodbConfigId || null,
nocodbTableName: groupData.nocodbTableName || null, nocodbTableName: groupData.nocodbTableName || null,
nocodbTableId: groupData.nocodbTableId || null,
invoiceColumnName: groupData.invoiceColumnName || null, invoiceColumnName: groupData.invoiceColumnName || null,
nocodbBlColumnName: groupData.nocodbBlColumnName || null, nocodbBlColumnName: groupData.nocodbBlColumnName || null,
nocodbAmountColumnName: groupData.nocodbAmountColumnName || null, nocodbAmountColumnName: groupData.nocodbAmountColumnName || null,
@@ -1353,14 +1355,14 @@ export class MemStorage implements IStorage {
} }
async getActiveNocodbConfig(): Promise<NocodbConfig | undefined> { async getActiveNocodbConfig(): Promise<NocodbConfig | undefined> {
// En développement, créer une config de test réaliste // Configuration corrigée pour votre serveur NocoDB
const testConfig: NocodbConfig = { const testConfig: NocodbConfig = {
id: 1, id: 1,
name: 'Configuration Production NocoDB', name: 'Configuration Production NocoDB FFNancy',
baseUrl: 'https://nocodb.lafoirfouille.com', // URL réaliste baseUrl: 'https://nocodb.ffnancy.fr', // URL corrigée
projectId: 'p_invoice_management', projectId: 'pcg4uw79ukvycxc', // Project ID de vos logs
apiToken: 'xc-token-production-invoice-system', apiToken: 'xc-token-production-invoice-system',
description: 'Configuration de production pour vérification des factures', description: 'Configuration de production pour vérification des factures FFNancy',
isActive: true, isActive: true,
createdBy: 'admin', createdBy: 'admin',
createdAt: new Date(), createdAt: new Date(),
+1 -2
View File
@@ -51,6 +51,7 @@ export const groups = pgTable("groups", {
// Configuration NocoDB pour vérification automatique des factures // Configuration NocoDB pour vérification automatique des factures
nocodbConfigId: integer("nocodb_config_id"), // Référence vers la configuration NocoDB globale nocodbConfigId: integer("nocodb_config_id"), // Référence vers la configuration NocoDB globale
nocodbTableName: varchar("nocodb_table_name"), // Nom de la table spécifique au magasin nocodbTableName: varchar("nocodb_table_name"), // Nom de la table spécifique au magasin
nocodbTableId: varchar("nocodb_table_id"), // ID réel de la table dans NocoDB (ex: mrr733dfb8wtt9b)
// Mapping des colonnes par magasin dans leur table NocoDB // Mapping des colonnes par magasin dans leur table NocoDB
invoiceColumnName: varchar("invoice_column_name"), // Nom de la colonne facture dans leur table invoiceColumnName: varchar("invoice_column_name"), // Nom de la colonne facture dans leur table
nocodbBlColumnName: varchar("nocodb_bl_column_name"), // Nom de la colonne BL dans leur table nocodbBlColumnName: varchar("nocodb_bl_column_name"), // Nom de la colonne BL dans leur table
@@ -578,9 +579,7 @@ export type UserWithGroups = User & {
}; };
export type NocodbConfig = typeof nocodbConfig.$inferSelect; export type NocodbConfig = typeof nocodbConfig.$inferSelect;
export type InsertNocodbConfig = z.infer<typeof insertNocodbConfigSchema>;
export type InvoiceVerificationCache = typeof invoiceVerificationCache.$inferSelect; export type InvoiceVerificationCache = typeof invoiceVerificationCache.$inferSelect;
export type InsertInvoiceVerificationCache = z.infer<typeof insertInvoiceVerificationCacheSchema>;
// Task with relations type // Task with relations type
export type TaskWithRelations = Task & { export type TaskWithRelations = Task & {