@chevre/domain 21.4.0-alpha.2 → 21.4.0-alpha.21

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.
Files changed (86) hide show
  1. package/example/src/chevre/cleanActions.ts +23 -0
  2. package/example/src/chevre/cleanEventsByMovieTheater.ts +32 -0
  3. package/example/src/chevre/createDeleteTransactionTasksOfDeletedPeople.ts +126 -0
  4. package/example/src/chevre/createManyEventsIfNotExist.ts +6 -0
  5. package/example/src/chevre/migrateEventOrganizer.ts +125 -0
  6. package/example/src/chevre/migrateReservationProvider.ts +117 -0
  7. package/example/src/chevre/migrateScreeningRoomOrganizer.ts +91 -0
  8. package/example/src/chevre/processReserve.ts +0 -1
  9. package/example/src/chevre/searchEvents.ts +1 -9
  10. package/example/src/chevre/searchProductOffers.ts +6 -0
  11. package/lib/chevre/factory/event.d.ts +1 -1
  12. package/lib/chevre/repo/action.d.ts +6 -0
  13. package/lib/chevre/repo/action.js +13 -0
  14. package/lib/chevre/repo/assetTransaction.d.ts +4 -1
  15. package/lib/chevre/repo/assetTransaction.js +6 -12
  16. package/lib/chevre/repo/event.d.ts +25 -4
  17. package/lib/chevre/repo/event.js +122 -60
  18. package/lib/chevre/repo/mongoose/schemas/event.d.ts +7 -4
  19. package/lib/chevre/repo/mongoose/schemas/event.js +15 -2
  20. package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -6
  21. package/lib/chevre/repo/mongoose/schemas/place.js +9 -2
  22. package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
  23. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +3 -0
  24. package/lib/chevre/repo/mongoose/schemas/reservation.js +6 -3
  25. package/lib/chevre/repo/order.d.ts +21 -0
  26. package/lib/chevre/repo/order.js +54 -62
  27. package/lib/chevre/repo/place.d.ts +57 -16
  28. package/lib/chevre/repo/place.js +112 -167
  29. package/lib/chevre/repo/product.d.ts +2 -4
  30. package/lib/chevre/repo/product.js +52 -7
  31. package/lib/chevre/repo/productOffer.d.ts +19 -4
  32. package/lib/chevre/repo/productOffer.js +37 -14
  33. package/lib/chevre/repo/reservation.d.ts +33 -21
  34. package/lib/chevre/repo/reservation.js +97 -79
  35. package/lib/chevre/repo/seller.d.ts +4 -3
  36. package/lib/chevre/repo/seller.js +40 -38
  37. package/lib/chevre/repo/task.d.ts +1 -1
  38. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -2
  39. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -2
  40. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
  41. package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
  42. package/lib/chevre/service/assetTransaction/pay.js +9 -1
  43. package/lib/chevre/service/assetTransaction/registerService.js +2 -2
  44. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +10 -4
  45. package/lib/chevre/service/assetTransaction/reserve/factory.js +21 -40
  46. package/lib/chevre/service/assetTransaction/reserve.d.ts +0 -1
  47. package/lib/chevre/service/assetTransaction/reserve.js +7 -22
  48. package/lib/chevre/service/event/createEvent.d.ts +9 -0
  49. package/lib/chevre/service/event/createEvent.js +86 -0
  50. package/lib/chevre/service/event.d.ts +2 -0
  51. package/lib/chevre/service/event.js +26 -26
  52. package/lib/chevre/service/moneyTransfer.js +1 -1
  53. package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
  54. package/lib/chevre/service/offer/event/authorize.js +6 -2
  55. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +16 -2
  56. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +1 -1
  57. package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
  58. package/lib/chevre/service/order/returnOrder.js +8 -1
  59. package/lib/chevre/service/order/sendOrder.js +8 -1
  60. package/lib/chevre/service/payment/creditCard.js +9 -1
  61. package/lib/chevre/service/payment/movieTicket/factory.d.ts +2 -1
  62. package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
  63. package/lib/chevre/service/payment/movieTicket.js +19 -2
  64. package/lib/chevre/service/payment/paymentCard.js +1 -3
  65. package/lib/chevre/service/reserve/cancelReservation.js +15 -28
  66. package/lib/chevre/service/reserve/confirmReservation.js +12 -30
  67. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
  68. package/lib/chevre/service/reserve/verifyToken4reservation.js +3 -1
  69. package/lib/chevre/service/task/{syncScreeningRooms.d.ts → createEvent.d.ts} +1 -1
  70. package/lib/chevre/service/task/{syncScreeningRooms.js → createEvent.js} +10 -4
  71. package/lib/chevre/service/task/onAuthorizationCreated.js +1 -0
  72. package/lib/chevre/service/task/returnPayTransaction.js +1 -0
  73. package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
  74. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
  75. package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
  76. package/lib/chevre/service/transaction/returnOrder.js +9 -3
  77. package/package.json +3 -3
  78. package/example/src/chevre/findByOrderNumberAndReservationId.ts +0 -20
  79. package/example/src/chevre/findScreeningRoomsByBranchCode.ts +0 -27
  80. package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +0 -90
  81. package/example/src/chevre/migrateEventOffersItemOfferedTypeOf.ts +0 -75
  82. package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +0 -64
  83. package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +0 -79
  84. package/example/src/chevre/searchScreeningRooms.ts +0 -33
  85. package/example/src/chevre/syncScreeningRooms.ts +0 -21
  86. package/example/src/chevre/syncScreeningRoomsAll.ts +0 -41
@@ -319,23 +319,17 @@ class MongoRepository {
319
319
  });
320
320
  }
321
321
  addReservations(params) {
322
- var _a;
323
322
  return __awaiter(this, void 0, void 0, function* () {
324
323
  const doc = yield this.transactionModel.findOneAndUpdate({
325
324
  _id: { $eq: params.id },
326
325
  typeOf: { $eq: params.typeOf },
327
326
  status: { $eq: factory.transactionStatusType.InProgress }
328
- }, Object.assign({ 'object.acceptedOffer': params.object.acceptedOffer,
329
- // 念のため残す(2021/10/14)が、そのうち削除
330
- // 冗長なので削除(2021/10/19~)
331
- // 'object.event': params.object.reservationFor,
332
- 'object.reservationFor': params.object.reservationFor,
333
- // 念のため残す(2021/10/14)が、そのうち削除
334
- // 冗長なので削除(2021/10/19~)
335
- // 'object.reservations': params.object.subReservation,
336
- 'object.subReservation': params.object.subReservation }, (typeof ((_a = params.object.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
337
- ? { 'object.issuedThrough': params.object.issuedThrough }
338
- : undefined), { new: true })
327
+ }, {
328
+ 'object.acceptedOffer': params.object.acceptedOffer,
329
+ 'object.issuedThrough': params.object.issuedThrough,
330
+ 'object.reservationFor': params.object.reservationFor,
331
+ 'object.subReservation': params.object.subReservation
332
+ }, { new: true })
339
333
  .exec();
340
334
  if (doc === null) {
341
335
  throw new factory.errors.NotFound(this.transactionModel.modelName);
@@ -121,6 +121,9 @@ export declare class MongoRepository {
121
121
  * イベント部分更新
122
122
  */
123
123
  updatePartiallyById<T extends factory.eventType>(params: {
124
+ project: {
125
+ id: string;
126
+ };
124
127
  id: string;
125
128
  attributes: IAttributes4patchUpdate<T>;
126
129
  }): Promise<factory.event.IEvent<T>>;
@@ -143,15 +146,11 @@ export declare class MongoRepository {
143
146
  oldEventId: string;
144
147
  attributes: factory.event.IAttributes<factory.eventType.ScreeningEvent>;
145
148
  }): Promise<factory.event.IEvent<factory.eventType.ScreeningEvent>>;
146
- count<T extends factory.eventType>(params: ISearchConditions<T>): Promise<number>;
147
149
  /**
148
150
  * イベントを検索する
149
151
  */
150
152
  search<T extends factory.eventType>(params: ISearchConditions<T>, projection?: IProjection): Promise<factory.event.IEvent<T>[]>;
151
153
  searchIds<T extends factory.eventType>(params: ISearchConditions<T>): Promise<string[]>;
152
- findById<T extends factory.eventType>(params: {
153
- id: string;
154
- }, projection?: IProjection): Promise<factory.event.IEvent<T>>;
155
154
  findMinimizedIndividualEventById<T extends factory.eventType.ScreeningEvent | factory.eventType.Event>(params: {
156
155
  id: string;
157
156
  }): Promise<IMinimizedIndividualEvent<T>>;
@@ -159,11 +158,33 @@ export declare class MongoRepository {
159
158
  * イベントをキャンセルする
160
159
  */
161
160
  cancel(params: {
161
+ project: {
162
+ id: string;
163
+ };
162
164
  id: string;
163
165
  }): Promise<void>;
164
166
  deleteById(params: {
167
+ project: {
168
+ id: string;
169
+ };
165
170
  id: string;
166
171
  }): Promise<void>;
172
+ deleteScreeningEventsByMovieTheaterBranchCode(params: {
173
+ project: {
174
+ id: string;
175
+ };
176
+ location: {
177
+ branchCode: string;
178
+ };
179
+ }): Promise<import("mongodb").DeleteResult>;
180
+ deleteScreeningEventSeriesByMovieTheaterBranchCode(params: {
181
+ project: {
182
+ id: string;
183
+ };
184
+ location: {
185
+ branchCode: string;
186
+ };
187
+ }): Promise<import("mongodb").DeleteResult>;
167
188
  deleteByProject(params: {
168
189
  project: {
169
190
  id: string;
@@ -28,6 +28,7 @@ const errorHandler_1 = require("../errorHandler");
28
28
  const settings_1 = require("../settings");
29
29
  exports.PROJECTION_MINIMIZED_EVENT = {
30
30
  project: 1,
31
+ organizer: 1,
31
32
  _id: 1,
32
33
  typeOf: 1,
33
34
  additionalProperty: 1,
@@ -51,19 +52,35 @@ class MongoRepository {
51
52
  }
52
53
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
53
54
  static CREATE_MONGO_CONDITIONS(conditions) {
54
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39;
55
- const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
55
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42;
56
+ const andConditions = [];
57
+ const typeOfEq = conditions.typeOf;
58
+ if (typeof typeOfEq === 'string') {
59
+ andConditions.push({ typeOf: { $eq: typeOfEq } });
60
+ }
61
+ const typeOfIn = conditions.typeOfIn;
62
+ if (Array.isArray(typeOfIn)) {
63
+ andConditions.push({ typeOf: { $in: typeOfIn } });
64
+ }
65
+ // typeOf条件必須検証(2023-07-13~)
66
+ if (typeof typeOfEq !== 'string' && !Array.isArray(typeOfIn)) {
67
+ throw new factory.errors.ArgumentNull('typeOf');
68
+ }
56
69
  const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
57
70
  if (typeof projectIdEq === 'string') {
58
- andConditions.push({
59
- 'project.id': { $eq: projectIdEq }
60
- });
71
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
72
+ }
73
+ const organizerIdEq = (_d = (_c = conditions.organizer) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
74
+ if (typeof organizerIdEq === 'string') {
75
+ andConditions.push({ 'organizer.id': { $exists: true, $eq: organizerIdEq } });
61
76
  }
62
- const idIn = (_c = conditions.id) === null || _c === void 0 ? void 0 : _c.$in;
77
+ const idEq = (_e = conditions.id) === null || _e === void 0 ? void 0 : _e.$eq;
78
+ if (typeof idEq === 'string') {
79
+ andConditions.push({ _id: { $eq: idEq } });
80
+ }
81
+ const idIn = (_f = conditions.id) === null || _f === void 0 ? void 0 : _f.$in;
63
82
  if (Array.isArray(idIn)) {
64
- andConditions.push({
65
- _id: { $in: idIn }
66
- });
83
+ andConditions.push({ _id: { $in: idIn } });
67
84
  }
68
85
  // tslint:disable-next-line:no-single-line-block-comment
69
86
  /* istanbul ignore else */
@@ -114,17 +131,17 @@ class MongoRepository {
114
131
  endDate: { $lte: conditions.endThrough }
115
132
  });
116
133
  }
117
- const locationBranchCodeEq = (_e = (_d = conditions.location) === null || _d === void 0 ? void 0 : _d.branchCode) === null || _e === void 0 ? void 0 : _e.$eq;
134
+ const locationBranchCodeEq = (_h = (_g = conditions.location) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$eq;
118
135
  if (typeof locationBranchCodeEq === 'string') {
119
136
  andConditions.push({ 'location.branchCode': { $exists: true, $eq: locationBranchCodeEq } });
120
137
  }
121
- const locationBranchCodeIn = (_g = (_f = conditions.location) === null || _f === void 0 ? void 0 : _f.branchCode) === null || _g === void 0 ? void 0 : _g.$in;
138
+ const locationBranchCodeIn = (_k = (_j = conditions.location) === null || _j === void 0 ? void 0 : _j.branchCode) === null || _k === void 0 ? void 0 : _k.$in;
122
139
  if (Array.isArray(locationBranchCodeIn)) {
123
140
  andConditions.push({ 'location.branchCode': { $exists: true, $in: locationBranchCodeIn } });
124
141
  }
125
142
  // tslint:disable-next-line:no-single-line-block-comment
126
143
  /* istanbul ignore else */
127
- const hasOfferCatalogIdEq = (_j = (_h = conditions.hasOfferCatalog) === null || _h === void 0 ? void 0 : _h.id) === null || _j === void 0 ? void 0 : _j.$eq;
144
+ const hasOfferCatalogIdEq = (_m = (_l = conditions.hasOfferCatalog) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$eq;
128
145
  if (typeof hasOfferCatalogIdEq === 'string') {
129
146
  andConditions.push({
130
147
  'hasOfferCatalog.id': {
@@ -133,7 +150,7 @@ class MongoRepository {
133
150
  }
134
151
  });
135
152
  }
136
- const additionalPropertyElemMatch = (_k = conditions.additionalProperty) === null || _k === void 0 ? void 0 : _k.$elemMatch;
153
+ const additionalPropertyElemMatch = (_o = conditions.additionalProperty) === null || _o === void 0 ? void 0 : _o.$elemMatch;
137
154
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
138
155
  andConditions.push({
139
156
  additionalProperty: {
@@ -149,7 +166,7 @@ class MongoRepository {
149
166
  // tslint:disable-next-line:no-single-line-block-comment
150
167
  /* istanbul ignore else */
151
168
  if (params.offers !== undefined) {
152
- const itemOfferedIdIn4event = (_m = (_l = params.offers.itemOffered) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$in;
169
+ const itemOfferedIdIn4event = (_q = (_p = params.offers.itemOffered) === null || _p === void 0 ? void 0 : _p.id) === null || _q === void 0 ? void 0 : _q.$in;
153
170
  if (Array.isArray(itemOfferedIdIn4event)) {
154
171
  andConditions.push({
155
172
  'offers.itemOffered.id': {
@@ -199,8 +216,8 @@ class MongoRepository {
199
216
  }
200
217
  }
201
218
  }
202
- const sellerMakesOfferElemMatch4event = (_q = (_p = (_o = params.offers) === null || _o === void 0 ? void 0 : _o.seller) === null || _p === void 0 ? void 0 : _p.makesOffer) === null || _q === void 0 ? void 0 : _q.$elemMatch;
203
- if (typeof ((_r = sellerMakesOfferElemMatch4event === null || sellerMakesOfferElemMatch4event === void 0 ? void 0 : sellerMakesOfferElemMatch4event['availableAtOrFrom.id']) === null || _r === void 0 ? void 0 : _r.$eq) === 'string') {
219
+ const sellerMakesOfferElemMatch4event = (_t = (_s = (_r = params.offers) === null || _r === void 0 ? void 0 : _r.seller) === null || _s === void 0 ? void 0 : _s.makesOffer) === null || _t === void 0 ? void 0 : _t.$elemMatch;
220
+ if (typeof ((_u = sellerMakesOfferElemMatch4event === null || sellerMakesOfferElemMatch4event === void 0 ? void 0 : sellerMakesOfferElemMatch4event['availableAtOrFrom.id']) === null || _u === void 0 ? void 0 : _u.$eq) === 'string') {
204
221
  andConditions.push({
205
222
  'offers.seller.makesOffer': {
206
223
  $exists: true,
@@ -208,7 +225,7 @@ class MongoRepository {
208
225
  }
209
226
  });
210
227
  }
211
- const reservationForIdentifierEq = (_w = (_v = (_u = (_t = (_s = params.offers) === null || _s === void 0 ? void 0 : _s.itemOffered) === null || _t === void 0 ? void 0 : _t.serviceOutput) === null || _u === void 0 ? void 0 : _u.reservationFor) === null || _v === void 0 ? void 0 : _v.identifier) === null || _w === void 0 ? void 0 : _w.$eq;
228
+ const reservationForIdentifierEq = (_z = (_y = (_x = (_w = (_v = params.offers) === null || _v === void 0 ? void 0 : _v.itemOffered) === null || _w === void 0 ? void 0 : _w.serviceOutput) === null || _x === void 0 ? void 0 : _x.reservationFor) === null || _y === void 0 ? void 0 : _y.identifier) === null || _z === void 0 ? void 0 : _z.$eq;
212
229
  if (typeof reservationForIdentifierEq === 'string') {
213
230
  andConditions.push({
214
231
  'offers.itemOffered.serviceOutput.reservationFor.identifier': {
@@ -217,7 +234,7 @@ class MongoRepository {
217
234
  }
218
235
  });
219
236
  }
220
- const reservationForArrivalBusStopBranchCodeEq = (_2 = (_1 = (_0 = (_z = (_y = (_x = params.offers) === null || _x === void 0 ? void 0 : _x.itemOffered) === null || _y === void 0 ? void 0 : _y.serviceOutput) === null || _z === void 0 ? void 0 : _z.reservationFor) === null || _0 === void 0 ? void 0 : _0.arrivalBusStop) === null || _1 === void 0 ? void 0 : _1.branchCode) === null || _2 === void 0 ? void 0 : _2.$eq;
237
+ const reservationForArrivalBusStopBranchCodeEq = (_5 = (_4 = (_3 = (_2 = (_1 = (_0 = params.offers) === null || _0 === void 0 ? void 0 : _0.itemOffered) === null || _1 === void 0 ? void 0 : _1.serviceOutput) === null || _2 === void 0 ? void 0 : _2.reservationFor) === null || _3 === void 0 ? void 0 : _3.arrivalBusStop) === null || _4 === void 0 ? void 0 : _4.branchCode) === null || _5 === void 0 ? void 0 : _5.$eq;
221
238
  if (typeof reservationForArrivalBusStopBranchCodeEq === 'string') {
222
239
  andConditions.push({
223
240
  'offers.itemOffered.serviceOutput.reservationFor.arrivalBusStop.branchCode': {
@@ -226,7 +243,7 @@ class MongoRepository {
226
243
  }
227
244
  });
228
245
  }
229
- const reservationForDepartureBusStopBranchCodeEq = (_8 = (_7 = (_6 = (_5 = (_4 = (_3 = params.offers) === null || _3 === void 0 ? void 0 : _3.itemOffered) === null || _4 === void 0 ? void 0 : _4.serviceOutput) === null || _5 === void 0 ? void 0 : _5.reservationFor) === null || _6 === void 0 ? void 0 : _6.departureBusStop) === null || _7 === void 0 ? void 0 : _7.branchCode) === null || _8 === void 0 ? void 0 : _8.$eq;
246
+ const reservationForDepartureBusStopBranchCodeEq = (_11 = (_10 = (_9 = (_8 = (_7 = (_6 = params.offers) === null || _6 === void 0 ? void 0 : _6.itemOffered) === null || _7 === void 0 ? void 0 : _7.serviceOutput) === null || _8 === void 0 ? void 0 : _8.reservationFor) === null || _9 === void 0 ? void 0 : _9.departureBusStop) === null || _10 === void 0 ? void 0 : _10.branchCode) === null || _11 === void 0 ? void 0 : _11.$eq;
230
247
  if (typeof reservationForDepartureBusStopBranchCodeEq === 'string') {
231
248
  andConditions.push({
232
249
  'offers.itemOffered.serviceOutput.reservationFor.departureBusStop.branchCode': {
@@ -260,7 +277,7 @@ class MongoRepository {
260
277
  }
261
278
  // tslint:disable-next-line:no-single-line-block-comment
262
279
  /* istanbul ignore else */
263
- const superEventLocationIdEq = (_11 = (_10 = (_9 = params.superEvent) === null || _9 === void 0 ? void 0 : _9.location) === null || _10 === void 0 ? void 0 : _10.id) === null || _11 === void 0 ? void 0 : _11.$eq;
280
+ const superEventLocationIdEq = (_14 = (_13 = (_12 = params.superEvent) === null || _12 === void 0 ? void 0 : _12.location) === null || _13 === void 0 ? void 0 : _13.id) === null || _14 === void 0 ? void 0 : _14.$eq;
264
281
  if (typeof superEventLocationIdEq === 'string') {
265
282
  andConditions.push({
266
283
  'superEvent.location.id': {
@@ -303,7 +320,7 @@ class MongoRepository {
303
320
  });
304
321
  }
305
322
  }
306
- const itemOfferedIdIn = (_14 = (_13 = (_12 = params.offers) === null || _12 === void 0 ? void 0 : _12.itemOffered) === null || _13 === void 0 ? void 0 : _13.id) === null || _14 === void 0 ? void 0 : _14.$in;
323
+ const itemOfferedIdIn = (_17 = (_16 = (_15 = params.offers) === null || _15 === void 0 ? void 0 : _15.itemOffered) === null || _16 === void 0 ? void 0 : _16.id) === null || _17 === void 0 ? void 0 : _17.$in;
307
324
  if (Array.isArray(itemOfferedIdIn)) {
308
325
  andConditions.push({
309
326
  'offers.itemOffered.id': {
@@ -312,7 +329,7 @@ class MongoRepository {
312
329
  }
313
330
  });
314
331
  }
315
- const itemOfferedTicketedSeatTypeOfIn = (_19 = (_18 = (_17 = (_16 = (_15 = params.offers) === null || _15 === void 0 ? void 0 : _15.itemOffered) === null || _16 === void 0 ? void 0 : _16.serviceOutput) === null || _17 === void 0 ? void 0 : _17.reservedTicket) === null || _18 === void 0 ? void 0 : _18.ticketedSeat) === null || _19 === void 0 ? void 0 : _19.typeOfs;
332
+ const itemOfferedTicketedSeatTypeOfIn = (_22 = (_21 = (_20 = (_19 = (_18 = params.offers) === null || _18 === void 0 ? void 0 : _18.itemOffered) === null || _19 === void 0 ? void 0 : _19.serviceOutput) === null || _20 === void 0 ? void 0 : _20.reservedTicket) === null || _21 === void 0 ? void 0 : _21.ticketedSeat) === null || _22 === void 0 ? void 0 : _22.typeOfs;
316
333
  if (Array.isArray(itemOfferedTicketedSeatTypeOfIn)) {
317
334
  andConditions.push({
318
335
  'offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOf': {
@@ -321,7 +338,7 @@ class MongoRepository {
321
338
  }
322
339
  });
323
340
  }
324
- const itemOfferedServiceTypeIdIn = (_22 = (_21 = (_20 = params.offers) === null || _20 === void 0 ? void 0 : _20.itemOffered) === null || _21 === void 0 ? void 0 : _21.serviceType) === null || _22 === void 0 ? void 0 : _22.ids;
341
+ const itemOfferedServiceTypeIdIn = (_25 = (_24 = (_23 = params.offers) === null || _23 === void 0 ? void 0 : _23.itemOffered) === null || _24 === void 0 ? void 0 : _24.serviceType) === null || _25 === void 0 ? void 0 : _25.ids;
325
342
  if (Array.isArray(itemOfferedServiceTypeIdIn)) {
326
343
  andConditions.push({
327
344
  'offers.itemOffered.serviceType.id': {
@@ -330,8 +347,8 @@ class MongoRepository {
330
347
  }
331
348
  });
332
349
  }
333
- const sellerMakesOfferElemMatch = (_25 = (_24 = (_23 = params.offers) === null || _23 === void 0 ? void 0 : _23.seller) === null || _24 === void 0 ? void 0 : _24.makesOffer) === null || _25 === void 0 ? void 0 : _25.$elemMatch;
334
- if (typeof ((_26 = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _26 === void 0 ? void 0 : _26.$eq) === 'string') {
350
+ const sellerMakesOfferElemMatch = (_28 = (_27 = (_26 = params.offers) === null || _26 === void 0 ? void 0 : _26.seller) === null || _27 === void 0 ? void 0 : _27.makesOffer) === null || _28 === void 0 ? void 0 : _28.$elemMatch;
351
+ if (typeof ((_29 = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _29 === void 0 ? void 0 : _29.$eq) === 'string') {
335
352
  andConditions.push({
336
353
  'offers.seller.makesOffer': {
337
354
  $exists: true,
@@ -368,7 +385,7 @@ class MongoRepository {
368
385
  ]
369
386
  });
370
387
  }
371
- const locationIdEq = (_28 = (_27 = params.location) === null || _27 === void 0 ? void 0 : _27.id) === null || _28 === void 0 ? void 0 : _28.$eq;
388
+ const locationIdEq = (_31 = (_30 = params.location) === null || _30 === void 0 ? void 0 : _30.id) === null || _31 === void 0 ? void 0 : _31.$eq;
372
389
  // tslint:disable-next-line:no-single-line-block-comment
373
390
  /* istanbul ignore else */
374
391
  if (typeof locationIdEq === 'string') {
@@ -390,7 +407,7 @@ class MongoRepository {
390
407
  });
391
408
  }
392
409
  }
393
- const workPerformedIdentifierIn = (_29 = params.workPerformed) === null || _29 === void 0 ? void 0 : _29.identifiers;
410
+ const workPerformedIdentifierIn = (_32 = params.workPerformed) === null || _32 === void 0 ? void 0 : _32.identifiers;
394
411
  // tslint:disable-next-line:no-single-line-block-comment
395
412
  /* istanbul ignore else */
396
413
  if (Array.isArray(workPerformedIdentifierIn)) {
@@ -398,13 +415,13 @@ class MongoRepository {
398
415
  'workPerformed.identifier': { $exists: true, $in: workPerformedIdentifierIn }
399
416
  });
400
417
  }
401
- const workPerformedVersionEq = (_31 = (_30 = params.workPerformed) === null || _30 === void 0 ? void 0 : _30.version) === null || _31 === void 0 ? void 0 : _31.$eq;
418
+ const workPerformedVersionEq = (_34 = (_33 = params.workPerformed) === null || _33 === void 0 ? void 0 : _33.version) === null || _34 === void 0 ? void 0 : _34.$eq;
402
419
  if (typeof workPerformedVersionEq === 'string') {
403
420
  andConditions.push({
404
421
  'workPerformed.version': { $exists: true, $eq: workPerformedVersionEq }
405
422
  });
406
423
  }
407
- const videoFormatTypeOfEq = (_33 = (_32 = params.videoFormat) === null || _32 === void 0 ? void 0 : _32.typeOf) === null || _33 === void 0 ? void 0 : _33.$eq;
424
+ const videoFormatTypeOfEq = (_36 = (_35 = params.videoFormat) === null || _35 === void 0 ? void 0 : _35.typeOf) === null || _36 === void 0 ? void 0 : _36.$eq;
408
425
  if (typeof videoFormatTypeOfEq === 'string') {
409
426
  andConditions.push({
410
427
  'videoFormat.typeOf': {
@@ -413,7 +430,7 @@ class MongoRepository {
413
430
  }
414
431
  });
415
432
  }
416
- const videoFormatTypeOfIn = (_35 = (_34 = params.videoFormat) === null || _34 === void 0 ? void 0 : _34.typeOf) === null || _35 === void 0 ? void 0 : _35.$in;
433
+ const videoFormatTypeOfIn = (_38 = (_37 = params.videoFormat) === null || _37 === void 0 ? void 0 : _37.typeOf) === null || _38 === void 0 ? void 0 : _38.$in;
417
434
  if (Array.isArray(videoFormatTypeOfIn)) {
418
435
  andConditions.push({
419
436
  'videoFormat.typeOf': {
@@ -422,7 +439,7 @@ class MongoRepository {
422
439
  }
423
440
  });
424
441
  }
425
- const soundFormatTypeOfEq = (_37 = (_36 = params.soundFormat) === null || _36 === void 0 ? void 0 : _36.typeOf) === null || _37 === void 0 ? void 0 : _37.$eq;
442
+ const soundFormatTypeOfEq = (_40 = (_39 = params.soundFormat) === null || _39 === void 0 ? void 0 : _39.typeOf) === null || _40 === void 0 ? void 0 : _40.$eq;
426
443
  if (typeof soundFormatTypeOfEq === 'string') {
427
444
  andConditions.push({
428
445
  'soundFormat.typeOf': {
@@ -431,7 +448,7 @@ class MongoRepository {
431
448
  }
432
449
  });
433
450
  }
434
- const soundFormatTypeOfIn = (_39 = (_38 = params.soundFormat) === null || _38 === void 0 ? void 0 : _38.typeOf) === null || _39 === void 0 ? void 0 : _39.$in;
451
+ const soundFormatTypeOfIn = (_42 = (_41 = params.soundFormat) === null || _41 === void 0 ? void 0 : _41.typeOf) === null || _42 === void 0 ? void 0 : _42.$in;
435
452
  if (Array.isArray(soundFormatTypeOfIn)) {
436
453
  andConditions.push({
437
454
  'soundFormat.typeOf': {
@@ -586,6 +603,7 @@ class MongoRepository {
586
603
  const _a = params.attributes, { typeOf } = _a, updateFields = __rest(_a, ["typeOf"]);
587
604
  doc = yield this.eventModel.findOneAndUpdate({
588
605
  _id: params.id,
606
+ 'project.id': { $eq: params.project.id },
589
607
  typeOf: params.attributes.typeOf
590
608
  }, {
591
609
  $set: updateFields
@@ -688,6 +706,7 @@ class MongoRepository {
688
706
  const _a = params.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
689
707
  const id = uniqid();
690
708
  doc = yield this.eventModel.findOneAndUpdate({
709
+ 'project.id': { $eq: params.attributes.project.id },
691
710
  typeOf: params.attributes.typeOf,
692
711
  // 追加特性をキーに更新
693
712
  additionalProperty: {
@@ -711,14 +730,16 @@ class MongoRepository {
711
730
  return doc.toObject();
712
731
  });
713
732
  }
714
- count(params) {
715
- return __awaiter(this, void 0, void 0, function* () {
716
- const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
717
- return this.eventModel.countDocuments({ $and: conditions })
718
- .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
719
- .exec();
720
- });
721
- }
733
+ // public async count<T extends factory.eventType>(
734
+ // params: ISearchConditions<T>
735
+ // ): Promise<number> {
736
+ // const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
737
+ // return this.eventModel.countDocuments(
738
+ // { $and: conditions }
739
+ // )
740
+ // .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
741
+ // .exec();
742
+ // }
722
743
  /**
723
744
  * イベントを検索する
724
745
  */
@@ -766,24 +787,39 @@ class MongoRepository {
766
787
  .exec();
767
788
  });
768
789
  }
769
- findById(params, projection) {
770
- return __awaiter(this, void 0, void 0, function* () {
771
- const positiveProjectionExists = (projection !== undefined && projection !== null)
772
- ? Object.values(projection)
773
- .some((value) => value !== 0)
774
- : false;
775
- const doc = yield this.eventModel.findOne({ _id: params.id },
776
- // :1対応(2023-01-25~)
777
- (positiveProjectionExists)
778
- ? projection
779
- : Object.assign(Object.assign({}, projection), { __v: 0, createdAt: 0, updatedAt: 0 }))
780
- .exec();
781
- if (doc === null) {
782
- throw new factory.errors.NotFound(this.eventModel.modelName);
783
- }
784
- return doc.toObject();
785
- });
786
- }
790
+ // searchに置き換え(2023-07-13~)
791
+ // public async findById<T extends factory.eventType>(
792
+ // params: {
793
+ // project: { id: string };
794
+ // id: string;
795
+ // },
796
+ // projection?: IProjection
797
+ // ): Promise<factory.event.IEvent<T>> {
798
+ // const positiveProjectionExists: boolean = (projection !== undefined && projection !== null)
799
+ // ? Object.values(projection)
800
+ // .some((value) => value !== 0)
801
+ // : false;
802
+ // const doc = await this.eventModel.findOne(
803
+ // {
804
+ // _id: params.id,
805
+ // 'project.id': { $eq: params.project.id }
806
+ // },
807
+ // // :1対応(2023-01-25~)
808
+ // (positiveProjectionExists)
809
+ // ? projection
810
+ // : {
811
+ // ...projection,
812
+ // __v: 0,
813
+ // createdAt: 0,
814
+ // updatedAt: 0
815
+ // }
816
+ // )
817
+ // .exec();
818
+ // if (doc === null) {
819
+ // throw new factory.errors.NotFound(this.eventModel.modelName);
820
+ // }
821
+ // return doc.toObject();
822
+ // }
787
823
  findMinimizedIndividualEventById(params) {
788
824
  return __awaiter(this, void 0, void 0, function* () {
789
825
  const doc = yield this.eventModel.findOne({ _id: params.id }, exports.PROJECTION_MINIMIZED_EVENT)
@@ -799,13 +835,39 @@ class MongoRepository {
799
835
  */
800
836
  cancel(params) {
801
837
  return __awaiter(this, void 0, void 0, function* () {
802
- yield this.eventModel.findOneAndUpdate({ _id: params.id }, { eventStatus: factory.eventStatusType.EventCancelled })
838
+ yield this.eventModel.findOneAndUpdate({
839
+ _id: params.id,
840
+ 'project.id': { $eq: params.project.id }
841
+ }, { eventStatus: factory.eventStatusType.EventCancelled })
803
842
  .exec();
804
843
  });
805
844
  }
806
845
  deleteById(params) {
807
846
  return __awaiter(this, void 0, void 0, function* () {
808
- yield this.eventModel.findOneAndDelete({ _id: params.id })
847
+ yield this.eventModel.findOneAndDelete({
848
+ _id: params.id,
849
+ 'project.id': { $eq: params.project.id }
850
+ })
851
+ .exec();
852
+ });
853
+ }
854
+ deleteScreeningEventsByMovieTheaterBranchCode(params) {
855
+ return __awaiter(this, void 0, void 0, function* () {
856
+ return this.eventModel.deleteMany({
857
+ typeOf: { $eq: factory.eventType.ScreeningEvent },
858
+ 'project.id': { $eq: params.project.id },
859
+ 'superEvent.location.branchCode': { $exists: true, $eq: params.location.branchCode }
860
+ })
861
+ .exec();
862
+ });
863
+ }
864
+ deleteScreeningEventSeriesByMovieTheaterBranchCode(params) {
865
+ return __awaiter(this, void 0, void 0, function* () {
866
+ return this.eventModel.deleteMany({
867
+ typeOf: { $eq: factory.eventType.ScreeningEventSeries },
868
+ 'project.id': { $eq: params.project.id },
869
+ 'location.branchCode': { $exists: true, $eq: params.location.branchCode }
870
+ })
809
871
  .exec();
810
872
  });
811
873
  }
@@ -25,7 +25,7 @@
25
25
  import { Schema } from 'mongoose';
26
26
  declare const modelName = "Event";
27
27
  /**
28
- * イベント(公演など)スキーマ
28
+ * イベントスキーマ
29
29
  */
30
30
  declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
31
31
  collection: string;
@@ -53,11 +53,12 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
53
53
  };
54
54
  }, {
55
55
  typeOf: string;
56
+ project: any;
57
+ organizer: any;
56
58
  checkInCount: number;
57
59
  attendeeCount: number;
58
60
  _id?: string | undefined;
59
61
  name?: any;
60
- project?: any;
61
62
  alternateName?: any;
62
63
  description?: any;
63
64
  additionalProperty?: any;
@@ -86,11 +87,12 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
86
87
  kanaName?: string | undefined;
87
88
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
88
89
  typeOf: string;
90
+ project: any;
91
+ organizer: any;
89
92
  checkInCount: number;
90
93
  attendeeCount: number;
91
94
  _id?: string | undefined;
92
95
  name?: any;
93
- project?: any;
94
96
  alternateName?: any;
95
97
  description?: any;
96
98
  additionalProperty?: any;
@@ -119,11 +121,12 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
119
121
  kanaName?: string | undefined;
120
122
  }>> & Omit<import("mongoose").FlatRecord<{
121
123
  typeOf: string;
124
+ project: any;
125
+ organizer: any;
122
126
  checkInCount: number;
123
127
  attendeeCount: number;
124
128
  _id?: string | undefined;
125
129
  name?: any;
126
- project?: any;
127
130
  alternateName?: any;
128
131
  description?: any;
129
132
  additionalProperty?: any;
@@ -7,10 +7,17 @@ const factory = require("../../../factory");
7
7
  const modelName = 'Event';
8
8
  exports.modelName = modelName;
9
9
  /**
10
- * イベント(公演など)スキーマ
10
+ * イベントスキーマ
11
11
  */
12
12
  const schema = new mongoose_1.Schema({
13
- project: mongoose_1.SchemaTypes.Mixed,
13
+ project: {
14
+ type: mongoose_1.SchemaTypes.Mixed,
15
+ required: true
16
+ },
17
+ organizer: {
18
+ type: mongoose_1.SchemaTypes.Mixed,
19
+ required: true
20
+ },
14
21
  _id: String,
15
22
  typeOf: {
16
23
  type: String,
@@ -78,6 +85,12 @@ schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
78
85
  schema.index({ 'project.id': 1, startDate: 1 }, {
79
86
  name: 'searchByProjectId-v20220721'
80
87
  });
88
+ schema.index({ 'organizer.id': 1, startDate: 1 }, {
89
+ name: 'searchByOrganizerId',
90
+ partialFilterExpression: {
91
+ 'organizer.id': { $exists: true }
92
+ }
93
+ });
81
94
  schema.index({ typeOf: 1, startDate: 1 }, { name: 'searchByTypeOf' });
82
95
  schema.index({ eventStatus: 1, startDate: 1 }, { name: 'searchByEventStatus' });
83
96
  schema.index({ name: 1, startDate: 1 }, { name: 'searchByName' });
@@ -53,13 +53,14 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
53
53
  };
54
54
  }, {
55
55
  typeOf: string;
56
+ project: any;
56
57
  additionalProperty: any[];
58
+ parentOrganization: any;
57
59
  containsPlace: any[];
58
60
  hasEntranceGate: any[];
59
61
  hasPOS: any[];
60
62
  name?: any;
61
63
  url?: string | undefined;
62
- project?: any;
63
64
  alternateName?: any;
64
65
  description?: any;
65
66
  offers?: any;
@@ -72,18 +73,18 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
72
73
  openingHoursSpecification?: any;
73
74
  smokingAllowed?: boolean | undefined;
74
75
  sameAs?: string | undefined;
75
- parentOrganization?: any;
76
76
  openSeatingAllowed?: any;
77
77
  amenityFeature?: any;
78
78
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
79
79
  typeOf: string;
80
+ project: any;
80
81
  additionalProperty: any[];
82
+ parentOrganization: any;
81
83
  containsPlace: any[];
82
84
  hasEntranceGate: any[];
83
85
  hasPOS: any[];
84
86
  name?: any;
85
87
  url?: string | undefined;
86
- project?: any;
87
88
  alternateName?: any;
88
89
  description?: any;
89
90
  offers?: any;
@@ -96,18 +97,18 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
96
97
  openingHoursSpecification?: any;
97
98
  smokingAllowed?: boolean | undefined;
98
99
  sameAs?: string | undefined;
99
- parentOrganization?: any;
100
100
  openSeatingAllowed?: any;
101
101
  amenityFeature?: any;
102
102
  }>> & Omit<import("mongoose").FlatRecord<{
103
103
  typeOf: string;
104
+ project: any;
104
105
  additionalProperty: any[];
106
+ parentOrganization: any;
105
107
  containsPlace: any[];
106
108
  hasEntranceGate: any[];
107
109
  hasPOS: any[];
108
110
  name?: any;
109
111
  url?: string | undefined;
110
- project?: any;
111
112
  alternateName?: any;
112
113
  description?: any;
113
114
  offers?: any;
@@ -120,7 +121,6 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
120
121
  openingHoursSpecification?: any;
121
122
  smokingAllowed?: boolean | undefined;
122
123
  sameAs?: string | undefined;
123
- parentOrganization?: any;
124
124
  openSeatingAllowed?: any;
125
125
  amenityFeature?: any;
126
126
  }> & {
@@ -9,7 +9,15 @@ exports.modelName = modelName;
9
9
  * 場所スキーマ
10
10
  */
11
11
  const schema = new mongoose_1.Schema({
12
- project: mongoose_1.SchemaTypes.Mixed,
12
+ project: {
13
+ type: mongoose_1.SchemaTypes.Mixed,
14
+ required: true
15
+ },
16
+ // 必須化(2023-07-14~)
17
+ parentOrganization: {
18
+ type: mongoose_1.SchemaTypes.Mixed,
19
+ required: true
20
+ },
13
21
  typeOf: {
14
22
  type: String,
15
23
  required: true
@@ -32,7 +40,6 @@ const schema = new mongoose_1.Schema({
32
40
  kanaName: String,
33
41
  offers: mongoose_1.SchemaTypes.Mixed,
34
42
  additionalProperty: [mongoose_1.SchemaTypes.Mixed],
35
- parentOrganization: mongoose_1.SchemaTypes.Mixed,
36
43
  // ↓ルームの施設からの分離に伴い属性追加(2023-06-22~)
37
44
  openSeatingAllowed: mongoose_1.SchemaTypes.Mixed,
38
45
  amenityFeature: mongoose_1.SchemaTypes.Mixed