mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-12 01:37:40 +02:00
Merge pull request #392 from R0m1k3/1.1
Update validation to allow zero amounts for financial transactions
This commit is contained in:
3 files changed
+205
-1
No files matched your search
+204
@@ -0,0 +1,204 @@
|
||||
tions
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
✅ Résultat vérification avoir: {
|
||||
|
||||
exists: true,
|
||||
|
||||
matchType: 'invoice_reference',
|
||||
|
||||
errorMessage: null,
|
||||
|
||||
invoiceReference: 'FC-25-00005972',
|
||||
|
||||
supplierName: 'Artyfete',
|
||||
|
||||
fromCache: true,
|
||||
|
||||
permanent: false
|
||||
|
||||
}
|
||||
|
||||
POST /api/avoirs/7/verify-invoice 200 in 8ms
|
||||
|
||||
🔍 Vérification facture avoir: {
|
||||
|
||||
avoirId: 7,
|
||||
|
||||
invoiceReference: 'FC-25-00005972',
|
||||
|
||||
supplier: 'Artyfete',
|
||||
|
||||
group: 'Frouard',
|
||||
|
||||
␍ groupId: 1
|
||||
|
||||
}
|
||||
|
||||
🔍 [INVOICE] Début vérification facture: { invoiceReference: 'FC-25-00005972', groupId: 1, forceRefresh: true }
|
||||
|
||||
🔄 [INVOICE] Refresh forcé, ignorant le cache
|
||||
|
||||
🔧 Configuration groupe: {
|
||||
|
||||
groupName: 'Frouard',
|
||||
|
||||
hasNocodbConfig: true,
|
||||
|
||||
hasTableName: true,
|
||||
|
||||
hasWebhook: true
|
||||
|
||||
}
|
||||
|
||||
🔍 Vérification NocoDB en production...
|
||||
|
||||
🔧 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
|
||||
|
||||
}
|
||||
|
||||
🔧 Utilisation table ID: {
|
||||
|
||||
groupTable: 'CommandeF',
|
||||
|
||||
configuredId: 'mrr733dfb8wtt9b',
|
||||
|
||||
resolvedId: 'mrr733dfb8wtt9b'
|
||||
|
||||
}
|
||||
|
||||
🔍 Recherche NocoDB: { tableId: 'mrr733dfb8wtt9b', column: 'RefFacture' }
|
||||
|
||||
💾 [CACHE] Tentative sauvegarde: {
|
||||
|
||||
invoiceReference: 'FC-25-00005972',
|
||||
|
||||
groupId: 1,
|
||||
|
||||
cacheKey: '1_fc-25-00005972',
|
||||
|
||||
exists: true,
|
||||
|
||||
isReconciled: false,
|
||||
|
||||
cacheType: 'temporaire 6h (trouvé)',
|
||||
|
||||
expiresAt: '2025-09-09T00:48:35.637Z'
|
||||
|
||||
}
|
||||
|
||||
✅ [CACHE] Résultat sauvé en cache: {
|
||||
|
||||
␍ id: 23216,
|
||||
|
||||
invoiceReference: 'FC-25-00005972',
|
||||
|
||||
groupId: 1,
|
||||
|
||||
exists: true,
|
||||
|
||||
isReconciled: false,
|
||||
|
||||
cacheType: 'temporaire 6h (trouvé)',
|
||||
|
||||
cacheKey: '1_fc-25-00005972'
|
||||
|
||||
}
|
||||
|
||||
✅ Résultat vérification avoir: {
|
||||
|
||||
exists: true,
|
||||
|
||||
matchType: 'invoice_reference',
|
||||
|
||||
invoiceReference: 'FC-25-00005972',
|
||||
|
||||
invoiceAmount: -47.976,
|
||||
|
||||
supplierName: 'Artyfete'
|
||||
|
||||
}
|
||||
|
||||
POST /api/avoirs/7/verify-invoice 200 in 33ms
|
||||
|
||||
💰 PUT Avoir - Raw body received: {
|
||||
|
||||
"supplierId": 3,
|
||||
|
||||
"groupId": 1,
|
||||
|
||||
"invoiceReference": "FC-25-00005972",
|
||||
|
||||
"amount": -47.976,
|
||||
|
||||
"comment": "",
|
||||
|
||||
"commercialProcessed": false,
|
||||
|
||||
"status": "Reçu"
|
||||
|
||||
}
|
||||
|
||||
❌ [PUT AVOIR] ERREURS VALIDATION ZOD: [
|
||||
|
||||
{
|
||||
|
||||
"code": "too_small",
|
||||
|
||||
"minimum": 0,
|
||||
|
||||
"type": "number",
|
||||
|
||||
"inclusive": false,
|
||||
|
||||
"exact": false,
|
||||
|
||||
"message": "Number must be greater than 0",
|
||||
|
||||
"path": [
|
||||
|
||||
"amount"
|
||||
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
PUT /api/avoirs/7 400 in 7ms
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 237 KiB |
+1
-1
@@ -585,7 +585,7 @@ export const insertAvoirSchema = createInsertSchema(avoirs).omit({
|
||||
processedAt: true,
|
||||
}).extend({
|
||||
status: z.enum(["En attente de demande", "Demandé", "Reçu"]).default("En attente de demande"),
|
||||
amount: z.coerce.number().positive().optional(), // Montant optionnel et positif si présent
|
||||
amount: z.coerce.number().refine(val => val !== 0, "Le montant ne peut pas être zéro").optional(), // Montant optionnel, positif ou négatif (mais pas zéro)
|
||||
invoiceReference: z.string().optional(), // Référence facture optionnelle
|
||||
comment: z.string().optional(),
|
||||
commercialProcessed: z.boolean().default(false),
|
||||
|
||||
Reference in new issue
Block a user