c2-mongoose 2.1.113 → 2.1.114

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.
@@ -10,10 +10,10 @@ var BuildLogFlowItem = /** @class */ (function () {
10
10
  BuildLogFlowItem.prototype.build = function (options, dataAfter, operation, repository) {
11
11
  var _a;
12
12
  return {
13
- user: (_a = options.owner) !== null && _a !== void 0 ? _a : express_http_context_1.default.get("user")._id,
13
+ user: (_a = options.user) !== null && _a !== void 0 ? _a : express_http_context_1.default.get("user")._id,
14
14
  owner: options.owner,
15
15
  data: dataAfter,
16
- collection: repository.collection.name,
16
+ collectionName: repository.collection.name,
17
17
  operation: operation
18
18
  };
19
19
  };
@@ -9,7 +9,7 @@ declare enum TypeOfOperation {
9
9
  interface ILogger {
10
10
  owner: Types.ObjectId;
11
11
  user: Types.ObjectId;
12
- collection: string;
12
+ collectionName: string;
13
13
  createdAtDateTime: moment.Moment;
14
14
  operation: TypeOfOperation;
15
15
  data: any;
@@ -19,7 +19,6 @@ declare const LoggerModel: mongoose.Schema<any, mongoose.Model<any, any, any, an
19
19
  createdAt: string;
20
20
  };
21
21
  }>, {
22
- collection: string;
23
22
  owner: {
24
23
  prototype?: Types.ObjectId | undefined;
25
24
  cacheHexString?: unknown;
@@ -36,10 +35,10 @@ declare const LoggerModel: mongoose.Schema<any, mongoose.Model<any, any, any, an
36
35
  createFromHexString?: {} | undefined;
37
36
  isValid?: {} | undefined;
38
37
  };
38
+ collectionName: string;
39
39
  operation: string;
40
40
  data?: any;
41
41
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
42
- collection: string;
43
42
  owner: {
44
43
  prototype?: Types.ObjectId | undefined;
45
44
  cacheHexString?: unknown;
@@ -56,10 +55,10 @@ declare const LoggerModel: mongoose.Schema<any, mongoose.Model<any, any, any, an
56
55
  createFromHexString?: {} | undefined;
57
56
  isValid?: {} | undefined;
58
57
  };
58
+ collectionName: string;
59
59
  operation: string;
60
60
  data?: any;
61
61
  }>> & Omit<mongoose.FlatRecord<{
62
- collection: string;
63
62
  owner: {
64
63
  prototype?: Types.ObjectId | undefined;
65
64
  cacheHexString?: unknown;
@@ -76,6 +75,7 @@ declare const LoggerModel: mongoose.Schema<any, mongoose.Model<any, any, any, an
76
75
  createFromHexString?: {} | undefined;
77
76
  isValid?: {} | undefined;
78
77
  };
78
+ collectionName: string;
79
79
  operation: string;
80
80
  data?: any;
81
81
  }> & {
@@ -55,7 +55,7 @@ exports.TypeOfOperation = TypeOfOperation;
55
55
  var LoggerModel = new mongoose_1.Schema({
56
56
  owner: { type: mongoose_1.Types.ObjectId, required: true, immutable: true },
57
57
  user: { type: mongoose_1.Types.ObjectId, required: true, immutable: true },
58
- collection: { type: String, required: true, immutable: true },
58
+ collectionName: { type: String, required: true, immutable: true },
59
59
  operation: { type: String, enum: TypeOfOperation, required: true, immutable: true },
60
60
  data: { type: mongoose_1.default.Schema.Types.Mixed, immutable: true }
61
61
  }, {
@@ -79,7 +79,7 @@ var LoggerSearch = /** @class */ (function (_super) {
79
79
  var regex = this.buildRegex(this.searchText);
80
80
  var condition = {
81
81
  $or: [
82
- // { 'name': { $regex: regex } },
82
+ { 'collectionName': { $regex: regex } },
83
83
  ]
84
84
  };
85
85
  filters.$and.push(condition);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.113",
3
+ "version": "2.1.114",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -6,10 +6,10 @@ import mongoose from "mongoose"
6
6
  class BuildLogFlowItem {
7
7
  build(options: Partial<Options>, dataAfter: any[], operation: TypeOfOperation, repository: mongoose.Model<any>): Partial<ILogger> {
8
8
  return {
9
- user: options.owner ?? httpContext.get("user")._id,
9
+ user: options.user ?? httpContext.get("user")._id,
10
10
  owner: options.owner,
11
11
  data: dataAfter,
12
- collection: repository.collection.name,
12
+ collectionName: repository.collection.name,
13
13
  operation
14
14
  }
15
15
  }
@@ -12,7 +12,7 @@ enum TypeOfOperation {
12
12
  interface ILogger {
13
13
  owner: Types.ObjectId
14
14
  user: Types.ObjectId
15
- collection: string
15
+ collectionName: string
16
16
  createdAtDateTime: moment.Moment
17
17
  operation: TypeOfOperation
18
18
  data: any
@@ -21,7 +21,7 @@ interface ILogger {
21
21
  const LoggerModel = new Schema({
22
22
  owner: { type: Types.ObjectId, required: true, immutable: true },
23
23
  user: { type: Types.ObjectId, required: true, immutable: true },
24
- collection: { type: String, required: true, immutable: true },
24
+ collectionName: { type: String, required: true, immutable: true },
25
25
  operation: { type: String, enum: TypeOfOperation, required: true, immutable: true },
26
26
  data: { type: mongoose.Schema.Types.Mixed, immutable: true }
27
27
  }, {
@@ -47,7 +47,7 @@ class LoggerSearch extends SearchFlow {
47
47
  let regex = this.buildRegex(this.searchText)
48
48
  let condition = {
49
49
  $or: [
50
- // { 'name': { $regex: regex } },
50
+ { 'collectionName': { $regex: regex } },
51
51
  ]
52
52
  }
53
53
  filters.$and.push(condition)