@chevre/domain 20.2.0-alpha.36 → 20.2.0-alpha.37
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.
|
@@ -67,7 +67,10 @@ export declare class MongoRepository {
|
|
|
67
67
|
/**
|
|
68
68
|
* 複数イベントを作成する
|
|
69
69
|
*/
|
|
70
|
-
createMany<T extends factory.eventType>(params:
|
|
70
|
+
createMany<T extends factory.eventType>(params: {
|
|
71
|
+
attributes: factory.event.IAttributes<T>[];
|
|
72
|
+
expectsNoContent: boolean;
|
|
73
|
+
}): Promise<factory.event.IEvent<T>[] | void>;
|
|
71
74
|
/**
|
|
72
75
|
* 特定の追加特性をキーにして、なければ作成する(複数対応)
|
|
73
76
|
*/
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -448,9 +448,12 @@ class MongoRepository {
|
|
|
448
448
|
*/
|
|
449
449
|
createMany(params) {
|
|
450
450
|
return __awaiter(this, void 0, void 0, function* () {
|
|
451
|
-
const docs = yield this.eventModel.insertMany(params.map((p) => {
|
|
451
|
+
const docs = yield this.eventModel.insertMany(params.attributes.map((p) => {
|
|
452
452
|
return Object.assign({ _id: uniqid() }, p);
|
|
453
453
|
}));
|
|
454
|
+
if (params.expectsNoContent) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
454
457
|
return docs.map((doc) => doc.toObject());
|
|
455
458
|
});
|
|
456
459
|
}
|
package/package.json
CHANGED