@dynamatix/cat-shared 0.0.150 → 0.0.152
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.
|
@@ -324,12 +324,11 @@ function applyAuditMiddleware(schema, collectionName) {
|
|
|
324
324
|
const numericString = valueSansSymbol.replace(/,/g, '');
|
|
325
325
|
const numericValue = Number(numericString);
|
|
326
326
|
if (!Number.isFinite(numericValue)) return `£${valueSansSymbol}`;
|
|
327
|
-
const decimalPart = numericString.split('.')[1];
|
|
328
327
|
const formatted = numericValue.toLocaleString('en-GB', {
|
|
329
|
-
minimumFractionDigits:
|
|
330
|
-
maximumFractionDigits:
|
|
328
|
+
minimumFractionDigits: 2,
|
|
329
|
+
maximumFractionDigits: 2
|
|
331
330
|
});
|
|
332
|
-
return `£${formatted}
|
|
331
|
+
return `£${formatted}`;
|
|
333
332
|
};
|
|
334
333
|
displayOldValue = formatPoundValue(displayOldValue);
|
|
335
334
|
displayNewValue = formatPoundValue(displayNewValue);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Mongoose schema for error logs.
|
|
5
|
+
* @constant {Schema}
|
|
6
|
+
*/
|
|
7
|
+
const errorLogSchema = new mongoose.Schema({
|
|
8
|
+
error_message: { type: String, required: true },
|
|
9
|
+
status_code: { type: Number, required: true },
|
|
10
|
+
route: { type: String, required: true },
|
|
11
|
+
error_logged_at: { type: Date, default: Date.now },
|
|
12
|
+
user_agent: { type: String, required: true },
|
|
13
|
+
stack_trace: [{ type: String }],
|
|
14
|
+
userId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: false },
|
|
15
|
+
source: { type: String, required: true }
|
|
16
|
+
}, { timestamps: true });
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Mongoose model for error logs.
|
|
20
|
+
* @constant {Model}
|
|
21
|
+
*/
|
|
22
|
+
const ErrorLogModel = mongoose.models.ErrorLog || mongoose.model('ErrorLog', errorLogSchema);
|
|
23
|
+
|
|
24
|
+
export default ErrorLogModel;
|
package/models/index.js
CHANGED
|
@@ -8,4 +8,5 @@ export { default as WorkflowAlertModel } from './workflow-alert.model.js';
|
|
|
8
8
|
export { default as WorkflowConfigModel } from './workflow-config.model.js';
|
|
9
9
|
export { default as DocumentHistoryModel } from './document-history.model.js';
|
|
10
10
|
export { default as MetaModel } from './meta.model.js';
|
|
11
|
-
export { default as PropertyMetaDataModel } from './property-metadata.model.js';
|
|
11
|
+
export { default as PropertyMetaDataModel } from './property-metadata.model.js';
|
|
12
|
+
export { default as ErrorLogModel } from './error-log.model.js';
|