c2-mongoose 2.1.164 → 2.1.166

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.
@@ -5,10 +5,10 @@ declare class C2Flow<D> {
5
5
  private repository;
6
6
  constructor(repository: mongoose.Model<any>);
7
7
  create(data: Partial<D>, options: Partial<Options>): Promise<Partial<D>>;
8
- createMany(data: Partial<D>[], options: Partial<Options>): Promise<Partial<D>>;
8
+ createMany(data: Partial<D>[], options: Partial<Options>): Promise<Partial<D>[]>;
9
9
  updateById(_id: Types.ObjectId, data: Partial<D>, options: Partial<Options>): Promise<Partial<D>>;
10
10
  updateByModel(searcher: SearchFlow, data: Partial<D>, options: Partial<Options>): Promise<Partial<D>>;
11
11
  deleteById(_id: Types.ObjectId, options: Partial<Options>): Promise<void>;
12
- deleteByModel(searcher: SearchFlow, data: Partial<D>, options: Partial<Options>): Promise<void>;
12
+ deleteByModel(searcher: SearchFlow, options: Partial<Options>): Promise<void>;
13
13
  }
14
14
  export default C2Flow;
@@ -91,7 +91,7 @@ var C2Flow = /** @class */ (function () {
91
91
  return [4 /*yield*/, global.LoggerRepository.create([log], { session: options.session })];
92
92
  case 2:
93
93
  _a.sent();
94
- return [2 /*return*/, dataAfter[0]._doc];
94
+ return [2 /*return*/, dataAfter];
95
95
  }
96
96
  });
97
97
  });
@@ -156,7 +156,7 @@ var C2Flow = /** @class */ (function () {
156
156
  });
157
157
  });
158
158
  };
159
- C2Flow.prototype.deleteByModel = function (searcher, data, options) {
159
+ C2Flow.prototype.deleteByModel = function (searcher, options) {
160
160
  return __awaiter(this, void 0, void 0, function () {
161
161
  var dataAfter, log;
162
162
  return __generator(this, function (_a) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.164",
3
+ "version": "2.1.166",
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",
@@ -26,7 +26,7 @@ class C2Flow<D> {
26
26
  return dataAfter[0]._doc
27
27
  }
28
28
 
29
- async createMany(data: Partial<D>[], options: Partial<Options>): Promise<Partial<D>> {
29
+ async createMany(data: Partial<D>[], options: Partial<Options>): Promise<Partial<D>[]> {
30
30
  let dataAfter = await this.repository.create(data, { session: options.session })
31
31
 
32
32
  if (options.logger === false) {
@@ -36,7 +36,7 @@ class C2Flow<D> {
36
36
  let log: Partial<ILogger> = BuildLogFlowItem.build(options, dataAfter[0]._doc, TypeOfOperation.CREATE, this.repository)
37
37
  await (global as any).LoggerRepository.create([log], { session: options.session })
38
38
 
39
- return dataAfter[0]._doc
39
+ return dataAfter
40
40
  }
41
41
 
42
42
  async updateById(_id: Types.ObjectId, data: Partial<D>, options: Partial<Options>): Promise<Partial<D>> {
@@ -78,7 +78,7 @@ class C2Flow<D> {
78
78
  await (global as any).LoggerRepository.create([log], { session: options.session })
79
79
  }
80
80
 
81
- public async deleteByModel(searcher: SearchFlow, data: Partial<D>, options: Partial<Options>) {
81
+ public async deleteByModel(searcher: SearchFlow, options: Partial<Options>) {
82
82
 
83
83
  let dataAfter = await this.repository.deleteMany(searcher.filters).session(options.session!)
84
84