@chevre/domain 23.2.0-alpha.27 → 23.2.0-alpha.28
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.
|
@@ -146,6 +146,7 @@ class MovieTheaterRepo {
|
|
|
146
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
147
|
const { project, sellerId } = options;
|
|
148
148
|
const bulkWriteOps = [];
|
|
149
|
+
const queryFilters = [];
|
|
149
150
|
if (Array.isArray(params)) {
|
|
150
151
|
params.forEach(({ $set, $unset }) => {
|
|
151
152
|
const { branchCode, hasEntranceGate, hasPOS } = $set, // 入場ゲート,POSを決して編集しないように
|
|
@@ -175,13 +176,27 @@ class MovieTheaterRepo {
|
|
|
175
176
|
upsert: true
|
|
176
177
|
};
|
|
177
178
|
bulkWriteOps.push({ updateOne });
|
|
179
|
+
queryFilters.push({
|
|
180
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
181
|
+
'project.id': { $eq: project.id },
|
|
182
|
+
branchCode: { $eq: branchCode },
|
|
183
|
+
// プロジェクトとコードでユニークな仕様だが、販売者も指定する -> 異なる販売者でコードが重複すればDuplicateErrorとなる
|
|
184
|
+
'parentOrganization.id': { $exists: true, $eq: sellerId }
|
|
185
|
+
});
|
|
178
186
|
});
|
|
179
187
|
}
|
|
180
188
|
if (bulkWriteOps.length > 0) {
|
|
181
189
|
const bulkWriteResult = yield this.civicStructureModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
182
|
-
|
|
190
|
+
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
191
|
+
const modifiedMovieTheaters = yield this.civicStructureModel.find({ $or: queryFilters }, {
|
|
192
|
+
_id: 0,
|
|
193
|
+
id: { $toString: '$_id' }
|
|
194
|
+
})
|
|
195
|
+
.lean()
|
|
196
|
+
.exec();
|
|
197
|
+
return { bulkWriteResult, modifiedMovieTheaters };
|
|
183
198
|
}
|
|
184
|
-
return {};
|
|
199
|
+
return { modifiedMovieTheaters: [] };
|
|
185
200
|
});
|
|
186
201
|
}
|
|
187
202
|
/**
|
package/package.json
CHANGED