@dynamatix/cat-shared 0.0.141 → 0.0.150

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -329,7 +329,7 @@ function applyAuditMiddleware(schema, collectionName) {
329
329
  minimumFractionDigits: decimalPart ? decimalPart.length : 0,
330
330
  maximumFractionDigits: decimalPart ? decimalPart.length : 20
331
331
  });
332
- return `£${formatted}`;
332
+ return `£${formatted}.00`;
333
333
  };
334
334
  displayOldValue = formatPoundValue(displayOldValue);
335
335
  displayNewValue = formatPoundValue(displayNewValue);
@@ -426,12 +426,21 @@ function applyAuditMiddleware(schema, collectionName) {
426
426
  async function updateContextAuditCount(contextId, count) {
427
427
  count = Number(count);
428
428
  if (!contextId || isNaN(count)) return;
429
- const model = mongoose.models['Application'];
430
- await model.findByIdAndUpdate(
431
- { _id: contextId },
432
- { $inc: { newAuditRecordsCount: count } },
433
- { new: true, upsert: true }
434
- );
429
+
430
+ try {
431
+ const model = mongoose.models['Application'];
432
+
433
+ // Use direct collection access to bypass all Mongoose middleware
434
+ // This prevents workflow triggers from firing for audit count updates
435
+ await model.collection.updateOne(
436
+ { _id: new mongoose.Types.ObjectId(contextId) },
437
+ { $inc: { newAuditRecordsCount: count } },
438
+ { upsert: false }
439
+ );
440
+ } catch (error) {
441
+ console.error('Error updating audit count:', error);
442
+ // Don't throw - audit count update failure shouldn't break the main operation
443
+ }
435
444
  }
436
445
 
437
446
  export function registerAuditHook(callback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/cat-shared",
3
- "version": "0.0.141",
3
+ "version": "0.0.150",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",