@dynamatix/cat-shared 0.0.8 → 0.0.9

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.
@@ -12,9 +12,8 @@ function applyAuditMiddleware(schema, collectionName) {
12
12
 
13
13
  if (isNewDoc && auditConfig.trackCreation) {
14
14
  logs.push({
15
- collectionName,
15
+ name: collectionName + ' created',
16
16
  documentId: doc._id,
17
- field: '__created__',
18
17
  oldValue: null,
19
18
  newValue: 'Document created',
20
19
  createdBy: doc._updatedBy || null
@@ -26,9 +25,8 @@ function applyAuditMiddleware(schema, collectionName) {
26
25
  for (const field of auditConfig.fields) {
27
26
  if (doc.isModified(field)) {
28
27
  logs.push({
29
- collectionName,
28
+ name: collectionName + '.'+ field,
30
29
  documentId: doc._id,
31
- field,
32
30
  oldValue: original[field],
33
31
  newValue: doc[field],
34
32
  createdBy: doc._updatedBy || null
@@ -1,9 +1,8 @@
1
1
  import mongoose from 'mongoose';
2
2
 
3
3
  const auditSchema = new mongoose.Schema({
4
- collection: String,
4
+ name: String,
5
5
  recordId: mongoose.Schema.Types.ObjectId,
6
- field: String,
7
6
  oldValue: mongoose.Schema.Types.Mixed,
8
7
  newValue: mongoose.Schema.Types.Mixed,
9
8
  timestamp: { type: Date, default: Date.now },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/cat-shared",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"