@dynamatix/cat-shared 0.0.151 → 0.0.153
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.
|
@@ -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';
|