@chevre/domain 23.2.0-alpha.31 → 23.2.0-alpha.33

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.
@@ -90,11 +90,11 @@ export declare class EventRepo {
90
90
  */
91
91
  update: boolean;
92
92
  }): Promise<{
93
- bulkWriteResult: BulkWriteResult;
93
+ bulkWriteResult?: BulkWriteResult;
94
94
  modifiedEvents: {
95
95
  id: string;
96
96
  }[];
97
- } | void>;
97
+ }>;
98
98
  /**
99
99
  * イベント部分更新
100
100
  */
@@ -344,15 +344,27 @@ class EventRepo {
344
344
  }
345
345
  if (bulkWriteOps.length > 0) {
346
346
  const bulkWriteResult = yield this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
347
- // modifiedの場合upsertedIdsに含まれないので、idを検索する
348
- const modifiedEvents = yield this.eventModel.find({ $or: queryFilters }, {
349
- _id: 0,
350
- id: { $toString: '$_id' }
351
- })
352
- .lean()
353
- .exec();
354
- return { bulkWriteResult, modifiedEvents };
347
+ // update:falseの場合、upsertedIdsのみmodifiedEventsとして返せばよい(2026-01-16~)
348
+ if (!update) {
349
+ // BulkWriteResult -> upsertedIds: { '0': '7iri6p4m54k0r3g' }
350
+ return {
351
+ bulkWriteResult,
352
+ modifiedEvents: Object.values(bulkWriteResult.upsertedIds)
353
+ .map((id) => ({ id: String(id) }))
354
+ };
355
+ }
356
+ else {
357
+ // modifiedの場合upsertedIdsに含まれないので、idを検索する
358
+ const modifiedEvents = yield this.eventModel.find({ $or: queryFilters }, {
359
+ _id: 0,
360
+ id: { $toString: '$_id' }
361
+ })
362
+ .lean()
363
+ .exec();
364
+ return { bulkWriteResult, modifiedEvents };
365
+ }
355
366
  }
367
+ return { modifiedEvents: [] };
356
368
  });
357
369
  }
358
370
  /**
@@ -21,9 +21,18 @@ interface IUpdateOptions {
21
21
  * 施設の入場ゲートリポジトリ
22
22
  */
23
23
  export declare class EntranceGateRepo {
24
+ /**
25
+ * 施設
26
+ */
24
27
  private readonly operator;
25
28
  private readonly civicStructureModel;
26
29
  constructor(connection: Connection, operater: IOperator);
30
+ /**
31
+ * リポジトリの施設をセットする
32
+ */
33
+ setOperatorId(params: {
34
+ id: string;
35
+ }): void;
27
36
  findEntranceGates(params: factory.place.entranceGate.ISearchConditions): Promise<IEntranceGate[]>;
28
37
  addEntranceGatesByIdentifierIfNotExist(params: {
29
38
  $set: ICreatingEntranceGate;
@@ -22,6 +22,12 @@ class EntranceGateRepo {
22
22
  this.civicStructureModel = connection.model(civicStructure_1.modelName, (0, civicStructure_1.createSchema)());
23
23
  this.operator = operater;
24
24
  }
25
+ /**
26
+ * リポジトリの施設をセットする
27
+ */
28
+ setOperatorId(params) {
29
+ this.operator.id = params.id;
30
+ }
25
31
  findEntranceGates(params) {
26
32
  return __awaiter(this, void 0, void 0, function* () {
27
33
  const aggregate = this.civicStructureModel.aggregate([
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  Object.defineProperty(exports, "__esModule", { value: true });
12
23
  exports.call = call;
13
24
  const factory = require("../../factory");
@@ -24,6 +35,7 @@ const unitPriceInCatalog_1 = require("../../repo/offer/unitPriceInCatalog");
24
35
  const offerCatalog_1 = require("../../repo/offerCatalog");
25
36
  const offerCatalogItem_1 = require("../../repo/offerCatalogItem");
26
37
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
38
+ const entranceGate_1 = require("../../repo/place/entranceGate");
27
39
  const hasPOS_1 = require("../../repo/place/hasPOS");
28
40
  const movieTheater_1 = require("../../repo/place/movieTheater");
29
41
  const screeningRoom_1 = require("../../repo/place/screeningRoom");
@@ -48,6 +60,7 @@ function call(data) {
48
60
  aggregateOffer: new aggregateOffer_1.AggregateOfferRepo(connection),
49
61
  categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
50
62
  creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
63
+ entranceGate: new entranceGate_1.EntranceGateRepo(connection, { id: '' }), // 先の処理で明示的に指定される
51
64
  event: new event_1.EventRepo(connection),
52
65
  eventSeries: new eventSeries_1.EventSeriesRepo(connection),
53
66
  hasPOS: new hasPOS_1.HasPOSRepo(connection, { id: '' }), // 先の処理で明示的に指定される
@@ -124,6 +137,10 @@ function onResourceUpdated(params) {
124
137
  case factory.placeType.ScreeningRoom:
125
138
  yield createInformRoomTasks(params, setting)(repos);
126
139
  break;
140
+ // 入場ゲート通知に対応(2026-01-17~)
141
+ case factory.placeType.EntranceGate:
142
+ yield createInformEntranceGateTasks(params, setting)(repos);
143
+ break;
127
144
  case 'AccountTitle':
128
145
  yield createInformAccountTitleTasks({
129
146
  project: { id: params.project.id },
@@ -422,8 +439,7 @@ function createInformMovieTheaterTasks(params, setting) {
422
439
  }, [
423
440
  'additionalProperty',
424
441
  'branchCode',
425
- 'hasEntranceGate',
426
- // 'hasPOS',
442
+ // 'hasEntranceGate', // migrate to IEntranceGateAsNotification(2026-01-17~)
427
443
  'kanaName',
428
444
  'name',
429
445
  'parentOrganization',
@@ -444,7 +460,10 @@ function createInformMovieTheaterTasks(params, setting) {
444
460
  // containedInPlace: { id: { $eq: movieTheater.id } }
445
461
  // }
446
462
  // );
447
- const movieTheaters4inform = [Object.assign({}, movieTheater
463
+ // 入場ゲートを廃止(2026-01-17~)
464
+ const { hasEntranceGate } = movieTheater, movieTheaterWithoutEntranceGates = __rest(movieTheater, ["hasEntranceGate"]);
465
+ const movieTheaters4inform = [Object.assign({}, movieTheaterWithoutEntranceGates
466
+ // ...movieTheater
448
467
  // migrate to IRoomAsNotification(2026-01-16~)
449
468
  // containsPlace: screeningRooms.map((room) => {
450
469
  // return {
@@ -566,6 +585,64 @@ function createInformRoomTasks(params, setting) {
566
585
  }
567
586
  });
568
587
  }
588
+ // tslint:disable-next-line:max-func-body-length
589
+ function createInformEntranceGateTasks(params, setting) {
590
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
591
+ var _a;
592
+ const informResources = (_a = setting === null || setting === void 0 ? void 0 : setting.onResourceUpdated) === null || _a === void 0 ? void 0 : _a.informResource;
593
+ if (Array.isArray(params.identifier) && params.identifier.length > 0) {
594
+ // 入場ゲートを検索
595
+ repos.entranceGate.setOperatorId({ id: params.containedInPlace.id });
596
+ const entranceGates = (yield repos.entranceGate.findEntranceGates({
597
+ project: { id: { $eq: params.project.id } },
598
+ identifier: { $in: params.identifier }
599
+ }));
600
+ const entranceGatesAsNotification = [{
601
+ id: params.containedInPlace.id,
602
+ typeOf: factory.placeType.MovieTheater,
603
+ hasEntranceGate: entranceGates.map((entranceGate) => {
604
+ return Object.assign(Object.assign({}, entranceGate), { typeOf: factory.placeType.Place });
605
+ })
606
+ }];
607
+ const taskRunsAt = new Date();
608
+ const informTasks = [];
609
+ informResources === null || informResources === void 0 ? void 0 : informResources.forEach((informResource) => {
610
+ var _a;
611
+ const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
612
+ entranceGatesAsNotification.forEach((entranceGateAsNotification) => {
613
+ var _a;
614
+ const informActionAttributes = {
615
+ object: entranceGateAsNotification,
616
+ recipient: {
617
+ id: '',
618
+ name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
619
+ typeOf: factory.creativeWorkType.WebApplication
620
+ },
621
+ target: {
622
+ httpMethod: 'POST',
623
+ encodingType: factory.encodingFormat.Application.json,
624
+ typeOf: 'EntryPoint',
625
+ urlTemplate: informUrl
626
+ }
627
+ };
628
+ informTasks.push({
629
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
630
+ name: factory.taskName.TriggerWebhook,
631
+ status: factory.taskStatus.Ready,
632
+ runsAt: taskRunsAt,
633
+ remainingNumberOfTries: 10,
634
+ numberOfTried: 0,
635
+ executionResults: [],
636
+ data: informActionAttributes
637
+ });
638
+ });
639
+ });
640
+ if (informTasks.length > 0) {
641
+ yield repos.task.saveMany(informTasks, { emitImmediately: true });
642
+ }
643
+ }
644
+ });
645
+ }
569
646
  function createInformAccountTitleTasks(params, setting) {
570
647
  return (repos
571
648
  // settings: Settings
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "5.4.0-alpha.20",
14
+ "@chevre/factory": "5.4.0-alpha.22",
15
15
  "@cinerino/sdk": "12.13.0",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.4.0-alpha.1",
@@ -116,5 +116,5 @@
116
116
  "postversion": "git push origin --tags",
117
117
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
118
118
  },
119
- "version": "23.2.0-alpha.31"
119
+ "version": "23.2.0-alpha.33"
120
120
  }