@chevre/domain 21.2.0-alpha.152 → 21.2.0-alpha.154

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,175 +12,346 @@ async function main() {
12
12
 
13
13
  const eventRepo = new chevre.repository.Event(mongoose.connection);
14
14
 
15
- const result = await eventRepo.createManyIfNotExist<chevre.factory.eventType.ScreeningEvent>([{
16
- attributes: {
17
- typeOf: chevre.factory.eventType.ScreeningEvent,
18
- project: { id: PROJECT_ID, typeOf: chevre.factory.organizationType.Project },
19
- name: {
20
- en: 'PetPetPetPet',
21
- ja: 'ペット'
22
- },
23
- doorTime: moment('2023-06-27T00:00:00.000Z')
24
- .toDate(),
25
- endDate: moment('2023-06-27T01:00:00.000Z')
26
- .toDate(),
27
- eventStatus: chevre.factory.eventStatusType.EventCancelled,
28
- location: {
29
- typeOf: chevre.factory.placeType.ScreeningRoom,
30
- branchCode: '30',
15
+ const result = await eventRepo.createManyIfNotExist<chevre.factory.eventType.ScreeningEvent>([
16
+ {
17
+ attributes: {
18
+ typeOf: chevre.factory.eventType.ScreeningEvent,
19
+ project: { id: PROJECT_ID, typeOf: chevre.factory.organizationType.Project },
31
20
  name: {
32
- ja: 'シネマ3',
33
- en: 'CINEMA3'
21
+ en: 'PetPetPetPet',
22
+ ja: 'ペット'
34
23
  },
35
- address: {
36
- ja: '7階',
37
- en: '7F'
38
- }
39
- },
40
- startDate: moment('2023-06-27T00:00:00.000Z')
41
- .toDate(),
42
- superEvent: {
43
- typeOf: chevre.factory.eventType.ScreeningEventSeries,
44
- id: '7k9ayl8hc',
45
- videoFormat: [
46
- {
47
- typeOf: '2D',
48
- name: '2D'
24
+ doorTime: moment('2023-06-27T00:00:00.000Z')
25
+ .toDate(),
26
+ endDate: moment('2023-06-27T01:00:00.000Z')
27
+ .toDate(),
28
+ eventStatus: chevre.factory.eventStatusType.EventCancelled,
29
+ location: {
30
+ typeOf: chevre.factory.placeType.ScreeningRoom,
31
+ branchCode: '30',
32
+ name: {
33
+ ja: 'シネマ3',
34
+ en: 'CINEMA3'
35
+ },
36
+ address: {
37
+ ja: '7階',
38
+ en: '7F'
49
39
  }
50
- ],
51
- soundFormat: [],
52
- workPerformed: {
53
- typeOf: chevre.factory.creativeWorkType.Movie,
54
- identifier: '1622100',
55
- id: '5bfb841d5a78d7948369980a',
40
+ },
41
+ startDate: moment('2023-06-27T00:00:00.000Z')
42
+ .toDate(),
43
+ superEvent: {
44
+ typeOf: chevre.factory.eventType.ScreeningEventSeries,
45
+ id: '7k9ayl8hc',
46
+ videoFormat: [
47
+ {
48
+ typeOf: '2D',
49
+ name: '2D'
50
+ }
51
+ ],
52
+ soundFormat: [],
53
+ workPerformed: {
54
+ typeOf: chevre.factory.creativeWorkType.Movie,
55
+ identifier: '1622100',
56
+ id: '5bfb841d5a78d7948369980a',
57
+ name: {
58
+ en: 'Pet',
59
+ ja: 'ペット'
60
+ },
61
+ duration: 'PT2H3M'
62
+ },
63
+ location: {
64
+ typeOf: chevre.factory.placeType.MovieTheater,
65
+ id: '5bfb841d5a78d7948369979a',
66
+ branchCode: '118',
67
+ name: {
68
+ ja: 'シネモーション赤坂 ',
69
+ en: 'CineMotion Akasaka'
70
+ },
71
+ kanaName: 'シネモーションアカサカ'
72
+ },
73
+ kanaName: 'ペットカナタイトル',
56
74
  name: {
57
- en: 'Pet',
75
+ en: 'PetPetPetPet',
58
76
  ja: 'ペット'
59
77
  },
60
- duration: 'PT2H3M'
78
+ additionalProperty: [
79
+ {
80
+ name: 'sortNumber',
81
+ value: '99'
82
+ }
83
+ ],
84
+ startDate: moment('2020-03-31T15:00:00.000Z')
85
+ .toDate(),
86
+ endDate: moment('2034-12-01T15:00:00.000Z')
87
+ .toDate(),
88
+ description: {
89
+ en: 'english description',
90
+ ja: 'ムビチケ検証用のイベントです。'
91
+ },
92
+ headline: {
93
+ en: 'headlineheadlineheadlineheadlineheadlineheadlineheadline',
94
+ ja: 'サブタイトルkanaName'
95
+ },
96
+ subtitleLanguage: {
97
+ typeOf: 'Language',
98
+ name: 'Japanese'
99
+ }
61
100
  },
62
- location: {
63
- typeOf: chevre.factory.placeType.MovieTheater,
64
- id: '5bfb841d5a78d7948369979a',
65
- branchCode: '118',
66
- name: {
67
- ja: 'シネモーション赤坂 ',
68
- en: 'CineMotion Akasaka'
101
+ offers: {
102
+ typeOf: chevre.factory.offerType.Offer,
103
+ priceCurrency: chevre.factory.priceCurrency.JPY,
104
+ availabilityEnds: moment('2023-06-26T14:20:00.000Z')
105
+ .toDate(),
106
+ availabilityStarts: moment('2023-06-23T15:00:00.000Z')
107
+ .toDate(),
108
+ eligibleQuantity: {
109
+ typeOf: 'QuantitativeValue',
110
+ unitCode: chevre.factory.unitCode.C62,
111
+ maxValue: 6,
112
+ value: 1
69
113
  },
70
- kanaName: 'シネモーションアカサカ'
114
+ itemOffered: {
115
+ id: '6308580bdef565000a9aa1fd',
116
+ name: {
117
+ ja: '通常興行カタログ'
118
+ },
119
+ serviceOutput: {
120
+ typeOf: chevre.factory.reservationType.EventReservation,
121
+ reservedTicket: {
122
+ typeOf: 'Ticket',
123
+ ticketedSeat: {
124
+ typeOf: chevre.factory.placeType.Seat
125
+ }
126
+ }
127
+ },
128
+ typeOf: chevre.factory.product.ProductType.EventService,
129
+ availableChannel: {
130
+ typeOf: 'ServiceChannel',
131
+ serviceLocation: {
132
+ typeOf: chevre.factory.placeType.ScreeningRoom,
133
+ branchCode: '30',
134
+ name: {
135
+ ja: 'シネマ3',
136
+ en: 'CINEMA3'
137
+ },
138
+ containedInPlace: {
139
+ typeOf: chevre.factory.placeType.MovieTheater,
140
+ id: '5bfb841d5a78d7948369979a',
141
+ branchCode: '118',
142
+ name: {
143
+ ja: 'シネモーション赤坂 ',
144
+ en: 'CineMotion Akasaka'
145
+ }
146
+ }
147
+ }
148
+ },
149
+ serviceType: {
150
+ codeValue: '0001',
151
+ id: '5e3361d01dc1ef1a20dd8737',
152
+ inCodeSet: {
153
+ typeOf: 'CategoryCodeSet',
154
+ identifier: chevre.factory.categoryCode.CategorySetIdentifier.ServiceType
155
+ },
156
+ typeOf: 'CategoryCode'
157
+ }
158
+ },
159
+ validFrom: moment('2023-06-23T15:00:00.000Z')
160
+ .toDate(),
161
+ validThrough: moment('2023-06-26T14:20:00.000Z')
162
+ .toDate(),
163
+ seller: {
164
+ typeOf: chevre.factory.organizationType.Corporation,
165
+ id: '59d20831e53ebc2b4e774466',
166
+ name: {
167
+ ja: 'シネモーション赤坂',
168
+ en: 'CineMotion Akasaka'
169
+ },
170
+ makesOffer: [
171
+ ]
172
+ }
71
173
  },
72
- kanaName: 'ペットカナタイトル',
174
+ maximumAttendeeCapacity: 90,
175
+ remainingAttendeeCapacity: 90,
176
+ additionalProperty: [{
177
+ name: 'eventIdentifier',
178
+ value: `bySample2023062701`
179
+ }]
180
+ },
181
+ filter: {
182
+ name: 'eventIdentifier'
183
+ }
184
+ },
185
+ {
186
+ attributes: {
187
+ typeOf: chevre.factory.eventType.ScreeningEvent,
188
+ project: { id: PROJECT_ID, typeOf: chevre.factory.organizationType.Project },
73
189
  name: {
74
190
  en: 'PetPetPetPet',
75
191
  ja: 'ペット'
76
192
  },
77
- additionalProperty: [
78
- {
79
- name: 'sortNumber',
80
- value: '99'
81
- }
82
- ],
83
- startDate: moment('2020-03-31T15:00:00.000Z')
193
+ doorTime: moment('2023-06-27T01:00:00.000Z')
84
194
  .toDate(),
85
- endDate: moment('2034-12-01T15:00:00.000Z')
195
+ endDate: moment('2023-06-27T02:00:00.000Z')
86
196
  .toDate(),
87
- description: {
88
- en: 'english description',
89
- ja: 'ムビチケ検証用のイベントです。'
90
- },
91
- headline: {
92
- en: 'headlineheadlineheadlineheadlineheadlineheadlineheadline',
93
- ja: 'サブタイトルkanaName'
197
+ eventStatus: chevre.factory.eventStatusType.EventCancelled,
198
+ location: {
199
+ typeOf: chevre.factory.placeType.ScreeningRoom,
200
+ branchCode: '30',
201
+ name: {
202
+ ja: 'シネマ3',
203
+ en: 'CINEMA3'
204
+ },
205
+ address: {
206
+ ja: '7階',
207
+ en: '7F'
208
+ }
94
209
  },
95
- subtitleLanguage: {
96
- typeOf: 'Language',
97
- name: 'Japanese'
98
- }
99
- },
100
- offers: {
101
- typeOf: chevre.factory.offerType.Offer,
102
- priceCurrency: chevre.factory.priceCurrency.JPY,
103
- availabilityEnds: moment('2023-06-26T14:20:00.000Z')
210
+ startDate: moment('2023-06-27T01:00:00.000Z')
104
211
  .toDate(),
105
- availabilityStarts: moment('2023-06-23T15:00:00.000Z')
106
- .toDate(),
107
- eligibleQuantity: {
108
- typeOf: 'QuantitativeValue',
109
- unitCode: chevre.factory.unitCode.C62,
110
- maxValue: 6,
111
- value: 1
112
- },
113
- itemOffered: {
114
- id: '6308580bdef565000a9aa1fd',
212
+ superEvent: {
213
+ typeOf: chevre.factory.eventType.ScreeningEventSeries,
214
+ id: '7k9ayl8hc',
215
+ videoFormat: [
216
+ {
217
+ typeOf: '2D',
218
+ name: '2D'
219
+ }
220
+ ],
221
+ soundFormat: [],
222
+ workPerformed: {
223
+ typeOf: chevre.factory.creativeWorkType.Movie,
224
+ identifier: '1622100',
225
+ id: '5bfb841d5a78d7948369980a',
226
+ name: {
227
+ en: 'Pet',
228
+ ja: 'ペット'
229
+ },
230
+ duration: 'PT2H3M'
231
+ },
232
+ location: {
233
+ typeOf: chevre.factory.placeType.MovieTheater,
234
+ id: '5bfb841d5a78d7948369979a',
235
+ branchCode: '118',
236
+ name: {
237
+ ja: 'シネモーション赤坂 ',
238
+ en: 'CineMotion Akasaka'
239
+ },
240
+ kanaName: 'シネモーションアカサカ'
241
+ },
242
+ kanaName: 'ペットカナタイトル',
115
243
  name: {
116
- ja: '通常興行カタログ'
117
- },
118
- serviceOutput: {
119
- typeOf: chevre.factory.reservationType.EventReservation,
120
- reservedTicket: {
121
- typeOf: 'Ticket',
122
- ticketedSeat: {
123
- typeOf: chevre.factory.placeType.Seat
124
- }
244
+ en: 'PetPetPetPet',
245
+ ja: 'ペット'
246
+ },
247
+ additionalProperty: [
248
+ {
249
+ name: 'sortNumber',
250
+ value: '99'
125
251
  }
252
+ ],
253
+ startDate: moment('2020-03-31T15:00:00.000Z')
254
+ .toDate(),
255
+ endDate: moment('2034-12-01T15:00:00.000Z')
256
+ .toDate(),
257
+ description: {
258
+ en: 'english description',
259
+ ja: 'ムビチケ検証用のイベントです。'
126
260
  },
127
- typeOf: chevre.factory.product.ProductType.EventService,
128
- availableChannel: {
129
- typeOf: 'ServiceChannel',
130
- serviceLocation: {
131
- typeOf: chevre.factory.placeType.ScreeningRoom,
132
- branchCode: '30',
133
- name: {
134
- ja: 'シネマ3',
135
- en: 'CINEMA3'
136
- },
137
- containedInPlace: {
138
- typeOf: chevre.factory.placeType.MovieTheater,
139
- id: '5bfb841d5a78d7948369979a',
140
- branchCode: '118',
261
+ headline: {
262
+ en: 'headlineheadlineheadlineheadlineheadlineheadlineheadline',
263
+ ja: 'サブタイトルkanaName'
264
+ },
265
+ subtitleLanguage: {
266
+ typeOf: 'Language',
267
+ name: 'Japanese'
268
+ }
269
+ },
270
+ offers: {
271
+ typeOf: chevre.factory.offerType.Offer,
272
+ priceCurrency: chevre.factory.priceCurrency.JPY,
273
+ availabilityEnds: moment('2023-06-26T14:20:00.000Z')
274
+ .toDate(),
275
+ availabilityStarts: moment('2023-06-23T15:00:00.000Z')
276
+ .toDate(),
277
+ eligibleQuantity: {
278
+ typeOf: 'QuantitativeValue',
279
+ unitCode: chevre.factory.unitCode.C62,
280
+ maxValue: 6,
281
+ value: 1
282
+ },
283
+ itemOffered: {
284
+ id: '6308580bdef565000a9aa1fd',
285
+ name: {
286
+ ja: '通常興行カタログ'
287
+ },
288
+ serviceOutput: {
289
+ typeOf: chevre.factory.reservationType.EventReservation,
290
+ reservedTicket: {
291
+ typeOf: 'Ticket',
292
+ ticketedSeat: {
293
+ typeOf: chevre.factory.placeType.Seat
294
+ }
295
+ }
296
+ },
297
+ typeOf: chevre.factory.product.ProductType.EventService,
298
+ availableChannel: {
299
+ typeOf: 'ServiceChannel',
300
+ serviceLocation: {
301
+ typeOf: chevre.factory.placeType.ScreeningRoom,
302
+ branchCode: '30',
141
303
  name: {
142
- ja: 'シネモーション赤坂 ',
143
- en: 'CineMotion Akasaka'
304
+ ja: 'シネマ3',
305
+ en: 'CINEMA3'
306
+ },
307
+ containedInPlace: {
308
+ typeOf: chevre.factory.placeType.MovieTheater,
309
+ id: '5bfb841d5a78d7948369979a',
310
+ branchCode: '118',
311
+ name: {
312
+ ja: 'シネモーション赤坂 ',
313
+ en: 'CineMotion Akasaka'
314
+ }
144
315
  }
145
316
  }
317
+ },
318
+ serviceType: {
319
+ codeValue: '0001',
320
+ id: '5e3361d01dc1ef1a20dd8737',
321
+ inCodeSet: {
322
+ typeOf: 'CategoryCodeSet',
323
+ identifier: chevre.factory.categoryCode.CategorySetIdentifier.ServiceType
324
+ },
325
+ typeOf: 'CategoryCode'
146
326
  }
147
327
  },
148
- serviceType: {
149
- codeValue: '0001',
150
- id: '5e3361d01dc1ef1a20dd8737',
151
- inCodeSet: {
152
- typeOf: 'CategoryCodeSet',
153
- identifier: chevre.factory.categoryCode.CategorySetIdentifier.ServiceType
328
+ validFrom: moment('2023-06-23T15:00:00.000Z')
329
+ .toDate(),
330
+ validThrough: moment('2023-06-26T14:20:00.000Z')
331
+ .toDate(),
332
+ seller: {
333
+ typeOf: chevre.factory.organizationType.Corporation,
334
+ id: '59d20831e53ebc2b4e774466',
335
+ name: {
336
+ ja: 'シネモーション赤坂',
337
+ en: 'CineMotion Akasaka'
154
338
  },
155
- typeOf: 'CategoryCode'
339
+ makesOffer: [
340
+ ]
156
341
  }
157
342
  },
158
- validFrom: moment('2023-06-23T15:00:00.000Z')
159
- .toDate(),
160
- validThrough: moment('2023-06-26T14:20:00.000Z')
161
- .toDate(),
162
- seller: {
163
- typeOf: chevre.factory.organizationType.Corporation,
164
- id: '59d20831e53ebc2b4e774466',
165
- name: {
166
- ja: 'シネモーション赤坂',
167
- en: 'CineMotion Akasaka'
168
- },
169
- makesOffer: [
170
- ]
171
- }
343
+ maximumAttendeeCapacity: 90,
344
+ remainingAttendeeCapacity: 90,
345
+ additionalProperty: [{
346
+ name: 'eventIdentifier',
347
+ value: `bySample2023062702`
348
+ }]
172
349
  },
173
- maximumAttendeeCapacity: 90,
174
- remainingAttendeeCapacity: 90,
175
- additionalProperty: [{
176
- name: 'eventIdentifier',
177
- value: `bySample2023062701`
178
- }]
179
- },
180
- filter: {
181
- name: 'eventIdentifier'
350
+ filter: {
351
+ name: 'eventIdentifier'
352
+ }
182
353
  }
183
- }]);
354
+ ]);
184
355
  console.log('result:', result);
185
356
 
186
357
  }
@@ -97,14 +97,20 @@ export declare class MongoRepository {
97
97
  expectsNoContent: boolean;
98
98
  }): Promise<factory.event.IEvent<T>[] | void>;
99
99
  /**
100
- * 特定の追加特性をキーにして、なければ作成する(複数対応)
100
+ * 特定の追加特性をキーにして、存在しなければ作成する(複数対応)
101
+ * 存在すれば、eventStatusのみ更新する
101
102
  */
102
103
  createManyIfNotExist<T extends factory.eventType>(params: {
103
104
  attributes: factory.event.IAttributes<T>;
104
105
  filter: {
105
106
  name: string;
106
107
  };
107
- }[]): Promise<BulkWriteOpResultObject | void>;
108
+ }[]): Promise<{
109
+ bulkWriteResult: BulkWriteOpResultObject;
110
+ modifiedEvents: {
111
+ id: string;
112
+ }[];
113
+ } | void>;
108
114
  /**
109
115
  * コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
110
116
  */
@@ -471,11 +471,13 @@ class MongoRepository {
471
471
  });
472
472
  }
473
473
  /**
474
- * 特定の追加特性をキーにして、なければ作成する(複数対応)
474
+ * 特定の追加特性をキーにして、存在しなければ作成する(複数対応)
475
+ * 存在すれば、eventStatusのみ更新する
475
476
  */
476
477
  createManyIfNotExist(params) {
477
478
  return __awaiter(this, void 0, void 0, function* () {
478
479
  const bulkWriteOps = [];
480
+ const additionalProperties = [];
479
481
  if (Array.isArray(params)) {
480
482
  params.forEach((creatingEventParams) => {
481
483
  var _a, _b;
@@ -486,11 +488,12 @@ class MongoRepository {
486
488
  if (typeof additionalPropertyValue !== 'string') {
487
489
  throw new factory.errors.NotFound('additionalProperty.value');
488
490
  }
491
+ additionalProperties.push({ name: creatingEventParams.filter.name, value: additionalPropertyValue });
489
492
  const _c = creatingEventParams.attributes, { eventStatus } = _c, setOnInsertFields = __rest(_c, ["eventStatus"]);
490
493
  bulkWriteOps.push({
491
494
  updateOne: {
492
495
  filter: {
493
- typeOf: creatingEventParams.attributes.typeOf,
496
+ typeOf: { $eq: creatingEventParams.attributes.typeOf },
494
497
  // 追加特性をキーにした冪等イベント作成時のfilterにproject.idを追加(2023-04-06~)
495
498
  'project.id': { $eq: creatingEventParams.attributes.project.id },
496
499
  // 追加特性をキーに更新
@@ -510,7 +513,21 @@ class MongoRepository {
510
513
  });
511
514
  }
512
515
  if (bulkWriteOps.length > 0) {
513
- return this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
516
+ const bulkWriteResult = yield this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
517
+ // modifiedの場合upsertedIdsに含まれないので、idを検索する
518
+ const modifiedEvents = yield this.eventModel.find({
519
+ typeOf: { $eq: params[0].attributes.typeOf },
520
+ // 追加特性をキーにした冪等イベント作成時のfilterにproject.idを追加(2023-04-06~)
521
+ 'project.id': { $eq: params[0].attributes.project.id },
522
+ // 追加特性をキーに更新
523
+ additionalProperty: {
524
+ $exists: true,
525
+ $in: additionalProperties
526
+ }
527
+ })
528
+ .select(['_id'])
529
+ .exec();
530
+ return { bulkWriteResult, modifiedEvents };
514
531
  }
515
532
  });
516
533
  }
@@ -88,6 +88,12 @@ export declare class MongoRepository {
88
88
  };
89
89
  typeOf: factory.placeType.ScreeningRoom;
90
90
  }>;
91
+ updateScreeningRoomsByContainedInPlaceId(screeningRoom: {
92
+ project: {
93
+ id: string;
94
+ };
95
+ containedInPlace: Pick<factory.place.screeningRoom.IContainedInPlace, 'id' | 'name'>;
96
+ }): Promise<void>;
91
97
  deleteScreeningRoom(screeningRoom: {
92
98
  project: {
93
99
  id: string;
@@ -552,6 +552,21 @@ class MongoRepository {
552
552
  }
553
553
  });
554
554
  }
555
+ updateScreeningRoomsByContainedInPlaceId(screeningRoom) {
556
+ var _a;
557
+ return __awaiter(this, void 0, void 0, function* () {
558
+ if (typeof ((_a = screeningRoom.containedInPlace.name) === null || _a === void 0 ? void 0 : _a.ja) === 'string') {
559
+ yield this.placeModel.updateMany({
560
+ typeOf: { $eq: factory.placeType.ScreeningRoom },
561
+ 'project.id': { $eq: screeningRoom.project.id },
562
+ 'containedInPlace.id': { $exists: true, $eq: screeningRoom.containedInPlace.id }
563
+ }, {
564
+ 'containedInPlace.name': screeningRoom.containedInPlace.name
565
+ })
566
+ .exec();
567
+ }
568
+ });
569
+ }
555
570
  deleteScreeningRoom(screeningRoom, useScreeningRoomType) {
556
571
  return __awaiter(this, void 0, void 0, function* () {
557
572
  if (useScreeningRoomType === true) {
@@ -5,6 +5,3 @@ export type IOperation<T> = (settings: IConnectionSettings) => Promise<T>;
5
5
  * タスク実行関数
6
6
  */
7
7
  export declare function call(data: factory.task.onResourceUpdated.IData): IOperation<void>;
8
- /**
9
- * 施設のcontainsPlaceをdocumentとして保管する
10
- */
@@ -78,17 +78,18 @@ function onResourceUpdated(params) {
78
78
  // no op
79
79
  }
80
80
  }
81
- // switch (params.typeOf) {
82
- // case factory.placeType.MovieTheater:
83
- // await syncScreeningRooms({
84
- // project: { id: params.project.id },
85
- // ids: params.id,
86
- // typeOf: params.typeOf
87
- // })(repos);
88
- // break;
89
- // default:
90
- // // no op
91
- // }
81
+ switch (params.typeOf) {
82
+ // 施設名称を同期する(2023-06-29~)
83
+ case factory.placeType.MovieTheater:
84
+ yield syncMovieTheater({
85
+ project: { id: params.project.id },
86
+ ids: params.id,
87
+ typeOf: params.typeOf
88
+ })(repos);
89
+ break;
90
+ default:
91
+ // no op
92
+ }
92
93
  });
93
94
  }
94
95
  function createInformMovieTasks(params) {
@@ -374,45 +375,22 @@ function createInformAccountTitleTasks(params) {
374
375
  }
375
376
  });
376
377
  }
377
- /**
378
- * 施設のcontainsPlaceをdocumentとして保管する
379
- */
380
- // function syncScreeningRooms(params: {
381
- // project: { id: string };
382
- // ids: string[];
383
- // typeOf: factory.placeType.MovieTheater;
384
- // }) {
385
- // return async (repos: {
386
- // place: PlaceRepo;
387
- // }) => {
388
- // if (params.ids.length !== 1) {
389
- // throw new factory.errors.Argument('id', 'id.length must be 1');
390
- // }
391
- // const movieTheaters = <Pick<
392
- // factory.place.movieTheater.IPlace,
393
- // 'id' | 'branchCode' | 'name' | 'project' | 'typeOf' | 'containsPlace'
394
- // >[]>
395
- // await repos.place.searchMovieTheaters(
396
- // { id: { $eq: params.ids[0] } },
397
- // ['_id', 'branchCode', 'name', 'project', 'typeOf', 'containsPlace'],
398
- // []
399
- // );
400
- // const movieTheater = movieTheaters.shift();
401
- // if (movieTheater === undefined) {
402
- // throw new factory.errors.NotFound(factory.placeType.MovieTheater);
403
- // }
404
- // const creatingScreeningRooms: factory.place.screeningRoom.IPlace[] = movieTheater.containsPlace.map((place) => {
405
- // return {
406
- // ...place,
407
- // containedInPlace: {
408
- // id: movieTheater.id,
409
- // typeOf: movieTheater.typeOf,
410
- // branchCode: movieTheater.branchCode,
411
- // name: movieTheater.name
412
- // },
413
- // project: movieTheater.project
414
- // };
415
- // });
416
- // debug('sync processing', creatingScreeningRooms.length, 'screeningRooms...');
417
- // };
418
- // }
378
+ function syncMovieTheater(params) {
379
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
380
+ if (params.ids.length !== 1) {
381
+ throw new factory.errors.Argument('id', 'id.length must be 1');
382
+ }
383
+ const movieTheaters = yield repos.place.searchMovieTheaters({
384
+ id: { $eq: params.ids[0] },
385
+ project: { id: { $eq: params.project.id } }
386
+ }, ['_id', 'name'], []);
387
+ const movieTheater = movieTheaters.shift();
388
+ if (movieTheater === undefined) {
389
+ throw new factory.errors.NotFound(factory.placeType.MovieTheater);
390
+ }
391
+ yield repos.place.updateScreeningRoomsByContainedInPlaceId({
392
+ project: { id: params.project.id },
393
+ containedInPlace: movieTheater
394
+ });
395
+ });
396
+ }
package/package.json CHANGED
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.2.0-alpha.152"
120
+ "version": "21.2.0-alpha.154"
121
121
  }