@chevre/domain 21.4.0-alpha.8 → 21.4.0

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 (96) hide show
  1. package/example/src/chevre/cleanEventsByMovieTheater.ts +32 -0
  2. package/example/src/chevre/createDeleteTransactionTasksOfDeletedPeople.ts +126 -0
  3. package/example/src/chevre/iam/searchMemberOfIdsByMemberId.ts +31 -0
  4. package/example/src/chevre/iam/searchProjectIdsByMemberId.ts +32 -0
  5. package/example/src/chevre/importEventsFromCOA.ts +5 -4
  6. package/example/src/chevre/migrateEventOrganizer.ts +18 -5
  7. package/example/src/chevre/migrateIAMMemberMemberOf.ts +59 -0
  8. package/example/src/chevre/migrateReservationProvider.ts +119 -0
  9. package/example/src/chevre/migrateScreeningRoomOrganizer.ts +91 -0
  10. package/example/src/chevre/processReserve.ts +0 -1
  11. package/example/src/chevre/searchActions.ts +1 -1
  12. package/example/src/chevre/searchPermissions.ts +7 -15
  13. package/lib/chevre/factory/event.d.ts +1 -1
  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 +16 -0
  17. package/lib/chevre/repo/event.js +34 -1
  18. package/lib/chevre/repo/member.d.ts +77 -5
  19. package/lib/chevre/repo/member.js +115 -97
  20. package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
  21. package/lib/chevre/repo/mongoose/schemas/member.d.ts +7 -7
  22. package/lib/chevre/repo/mongoose/schemas/member.js +22 -8
  23. package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -6
  24. package/lib/chevre/repo/mongoose/schemas/place.js +9 -2
  25. package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
  26. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +6 -3
  27. package/lib/chevre/repo/mongoose/schemas/reservation.js +10 -4
  28. package/lib/chevre/repo/order.d.ts +21 -0
  29. package/lib/chevre/repo/order.js +54 -62
  30. package/lib/chevre/repo/place.d.ts +57 -16
  31. package/lib/chevre/repo/place.js +112 -167
  32. package/lib/chevre/repo/product.d.ts +2 -4
  33. package/lib/chevre/repo/product.js +52 -7
  34. package/lib/chevre/repo/project.d.ts +5 -3
  35. package/lib/chevre/repo/project.js +48 -8
  36. package/lib/chevre/repo/reservation.d.ts +33 -21
  37. package/lib/chevre/repo/reservation.js +97 -79
  38. package/lib/chevre/repo/role.d.ts +0 -4
  39. package/lib/chevre/repo/role.js +0 -46
  40. package/lib/chevre/repo/seller.d.ts +18 -5
  41. package/lib/chevre/repo/seller.js +53 -46
  42. package/lib/chevre/repo/stockHolder.d.ts +2 -77
  43. package/lib/chevre/repo/stockHolder.js +200 -476
  44. package/lib/chevre/repo/task.d.ts +1 -1
  45. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -2
  46. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
  47. package/lib/chevre/service/aggregation/project.js +5 -1
  48. package/lib/chevre/service/assetTransaction/cancelReservation.js +10 -2
  49. package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
  50. package/lib/chevre/service/assetTransaction/pay.js +9 -1
  51. package/lib/chevre/service/assetTransaction/registerService.js +7 -3
  52. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +6 -1
  53. package/lib/chevre/service/assetTransaction/reserve/factory.js +15 -38
  54. package/lib/chevre/service/assetTransaction/reserve.d.ts +0 -1
  55. package/lib/chevre/service/assetTransaction/reserve.js +7 -22
  56. package/lib/chevre/service/event/createEvent.d.ts +11 -0
  57. package/lib/chevre/service/event/createEvent.js +112 -0
  58. package/lib/chevre/service/event.d.ts +2 -0
  59. package/lib/chevre/service/event.js +8 -4
  60. package/lib/chevre/service/iam.d.ts +5 -0
  61. package/lib/chevre/service/iam.js +7 -19
  62. package/lib/chevre/service/moneyTransfer.js +6 -2
  63. package/lib/chevre/service/notification.js +5 -1
  64. package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
  65. package/lib/chevre/service/offer/event/authorize.js +6 -2
  66. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +1 -1
  67. package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
  68. package/lib/chevre/service/order/returnOrder.js +8 -1
  69. package/lib/chevre/service/order/sendOrder.js +8 -1
  70. package/lib/chevre/service/payment/creditCard.js +14 -2
  71. package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
  72. package/lib/chevre/service/payment/movieTicket.js +19 -2
  73. package/lib/chevre/service/payment/paymentCard.js +6 -4
  74. package/lib/chevre/service/reserve/cancelReservation.js +15 -28
  75. package/lib/chevre/service/reserve/confirmReservation.js +14 -30
  76. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
  77. package/lib/chevre/service/reserve/verifyToken4reservation.js +3 -1
  78. package/lib/chevre/service/task/{syncScreeningRooms.d.ts → createEvent.d.ts} +1 -1
  79. package/lib/chevre/service/task/{syncScreeningRooms.js → createEvent.js} +11 -3
  80. package/lib/chevre/service/task/onAuthorizationCreated.js +1 -0
  81. package/lib/chevre/service/task/returnPayTransaction.js +1 -0
  82. package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
  83. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +6 -2
  84. package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
  85. package/lib/chevre/service/transaction/returnOrder.js +9 -3
  86. package/lib/chevre/settings.d.ts +0 -2
  87. package/lib/chevre/settings.js +7 -7
  88. package/package.json +3 -3
  89. package/example/src/chevre/findByOrderNumberAndReservationId.ts +0 -20
  90. package/example/src/chevre/findScreeningRoomsByBranchCode.ts +0 -27
  91. package/example/src/chevre/searchHoldReservations.ts +0 -38
  92. package/example/src/chevre/searchScreeningRooms.ts +0 -33
  93. package/example/src/chevre/syncScreeningRooms.ts +0 -21
  94. package/example/src/chevre/syncScreeningRoomsAll.ts +0 -41
  95. package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +0 -75
  96. package/lib/chevre/repo/mongoose/schemas/holdReservation.js +0 -93
@@ -34,7 +34,7 @@ class MongoRepository {
34
34
  }
35
35
  // tslint:disable-next-line:max-func-body-length
36
36
  static CREATE_MONGO_CONDITIONS(params) {
37
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
37
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
38
38
  // MongoDB検索条件
39
39
  const andConditions = [];
40
40
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
@@ -45,6 +45,11 @@ class MongoRepository {
45
45
  if (typeof idEq === 'string') {
46
46
  andConditions.push({ _id: { $eq: idEq } });
47
47
  }
48
+ // メンバー条件追加(2023-07-24~)
49
+ const memberMemberOfIdIn = (_f = (_e = (_d = params.member) === null || _d === void 0 ? void 0 : _d.memberOf) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$in;
50
+ if (Array.isArray(memberMemberOfIdIn)) {
51
+ andConditions.push({ _id: { $in: memberMemberOfIdIn } });
52
+ }
48
53
  const nameRegex = params.name;
49
54
  if (typeof nameRegex === 'string' && nameRegex.length > 0) {
50
55
  andConditions.push({
@@ -64,7 +69,7 @@ class MongoRepository {
64
69
  ]
65
70
  });
66
71
  }
67
- const branchCodeEq = (_d = params.branchCode) === null || _d === void 0 ? void 0 : _d.$eq;
72
+ const branchCodeEq = (_g = params.branchCode) === null || _g === void 0 ? void 0 : _g.$eq;
68
73
  if (typeof branchCodeEq === 'string') {
69
74
  andConditions.push({
70
75
  branchCode: {
@@ -72,7 +77,7 @@ class MongoRepository {
72
77
  }
73
78
  });
74
79
  }
75
- const branchCodeRegex = (_e = params.branchCode) === null || _e === void 0 ? void 0 : _e.$regex;
80
+ const branchCodeRegex = (_h = params.branchCode) === null || _h === void 0 ? void 0 : _h.$regex;
76
81
  if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
77
82
  andConditions.push({
78
83
  branchCode: {
@@ -80,7 +85,7 @@ class MongoRepository {
80
85
  }
81
86
  });
82
87
  }
83
- const additionalPropertyAll = (_f = params.additionalProperty) === null || _f === void 0 ? void 0 : _f.$all;
88
+ const additionalPropertyAll = (_j = params.additionalProperty) === null || _j === void 0 ? void 0 : _j.$all;
84
89
  if (Array.isArray(additionalPropertyAll)) {
85
90
  andConditions.push({
86
91
  additionalProperty: {
@@ -89,7 +94,7 @@ class MongoRepository {
89
94
  }
90
95
  });
91
96
  }
92
- const additionalPropertyIn = (_g = params.additionalProperty) === null || _g === void 0 ? void 0 : _g.$in;
97
+ const additionalPropertyIn = (_k = params.additionalProperty) === null || _k === void 0 ? void 0 : _k.$in;
93
98
  if (Array.isArray(additionalPropertyIn)) {
94
99
  andConditions.push({
95
100
  additionalProperty: {
@@ -98,7 +103,7 @@ class MongoRepository {
98
103
  }
99
104
  });
100
105
  }
101
- const additionalPropertyNin = (_h = params.additionalProperty) === null || _h === void 0 ? void 0 : _h.$nin;
106
+ const additionalPropertyNin = (_l = params.additionalProperty) === null || _l === void 0 ? void 0 : _l.$nin;
102
107
  if (Array.isArray(additionalPropertyNin)) {
103
108
  andConditions.push({
104
109
  additionalProperty: {
@@ -106,7 +111,7 @@ class MongoRepository {
106
111
  }
107
112
  });
108
113
  }
109
- const additionalPropertyElemMatch = (_j = params.additionalProperty) === null || _j === void 0 ? void 0 : _j.$elemMatch;
114
+ const additionalPropertyElemMatch = (_m = params.additionalProperty) === null || _m === void 0 ? void 0 : _m.$elemMatch;
110
115
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
111
116
  andConditions.push({
112
117
  additionalProperty: {
@@ -115,7 +120,7 @@ class MongoRepository {
115
120
  }
116
121
  });
117
122
  }
118
- const hasMerchantReturnPolicyItemConditionIdEq = (_m = (_l = (_k = params.hasMerchantReturnPolicy) === null || _k === void 0 ? void 0 : _k.itemCondition) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$eq;
123
+ const hasMerchantReturnPolicyItemConditionIdEq = (_q = (_p = (_o = params.hasMerchantReturnPolicy) === null || _o === void 0 ? void 0 : _o.itemCondition) === null || _p === void 0 ? void 0 : _p.id) === null || _q === void 0 ? void 0 : _q.$eq;
119
124
  if (typeof hasMerchantReturnPolicyItemConditionIdEq === 'string') {
120
125
  andConditions.push({
121
126
  'hasMerchantReturnPolicy.itemCondition.id': {
@@ -128,37 +133,39 @@ class MongoRepository {
128
133
  }
129
134
  /**
130
135
  * 特定販売者検索
136
+ * searchに置き換え(2023-07-13~)
131
137
  */
132
- findById(conditions,
133
- // projection?: any
134
- inclusion, exclusion) {
135
- return __awaiter(this, void 0, void 0, function* () {
136
- let projection = {};
137
- if (Array.isArray(inclusion) && inclusion.length > 0) {
138
- inclusion.forEach((field) => {
139
- projection[field] = 1;
140
- });
141
- }
142
- else {
143
- projection = {
144
- __v: 0,
145
- createdAt: 0,
146
- updatedAt: 0
147
- };
148
- if (Array.isArray(exclusion) && exclusion.length > 0) {
149
- exclusion.forEach((field) => {
150
- projection[field] = 0;
151
- });
152
- }
153
- }
154
- const doc = yield this.organizationModel.findOne({ _id: conditions.id }, projection)
155
- .exec();
156
- if (doc === null) {
157
- throw new factory.errors.NotFound(this.organizationModel.modelName);
158
- }
159
- return doc.toObject();
160
- });
161
- }
138
+ // public async findById(
139
+ // conditions: {
140
+ // id: string;
141
+ // },
142
+ // inclusion: string[],
143
+ // exclusion: string[]
144
+ // ): Promise<ISeller> {
145
+ // let projection: { [key: string]: number } = {};
146
+ // if (Array.isArray(inclusion) && inclusion.length > 0) {
147
+ // inclusion.forEach((field) => {
148
+ // projection[field] = 1;
149
+ // });
150
+ // } else {
151
+ // projection = {
152
+ // __v: 0,
153
+ // createdAt: 0,
154
+ // updatedAt: 0
155
+ // };
156
+ // if (Array.isArray(exclusion) && exclusion.length > 0) {
157
+ // exclusion.forEach((field) => {
158
+ // projection[field] = 0;
159
+ // });
160
+ // }
161
+ // }
162
+ // const doc = await this.organizationModel.findOne({ _id: conditions.id }, projection)
163
+ // .exec();
164
+ // if (doc === null) {
165
+ // throw new factory.errors.NotFound(this.organizationModel.modelName);
166
+ // }
167
+ // return doc.toObject();
168
+ // }
162
169
  /**
163
170
  * 販売者を保管する
164
171
  */
@@ -172,7 +179,10 @@ class MongoRepository {
172
179
  else {
173
180
  // 上書き禁止属性を除外(2022-08-24~)
174
181
  const _a = params.attributes, { id, branchCode, project, typeOf } = _a, updateFields = __rest(_a, ["id", "branchCode", "project", "typeOf"]);
175
- const doc = yield this.organizationModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
182
+ const doc = yield this.organizationModel.findOneAndUpdate({
183
+ _id: params.id,
184
+ 'project.id': { $eq: project.id }
185
+ }, updateFields, { upsert: false, new: true })
176
186
  .exec();
177
187
  if (doc === null) {
178
188
  throw new factory.errors.NotFound(this.organizationModel.modelName);
@@ -182,12 +192,6 @@ class MongoRepository {
182
192
  return organization;
183
193
  });
184
194
  }
185
- // public async count(params: factory.seller.ISearchConditions): Promise<number> {
186
- // const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
187
- // return this.organizationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
188
- // .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
189
- // .exec();
190
- // }
191
195
  /**
192
196
  * 販売者検索
193
197
  */
@@ -270,7 +274,10 @@ class MongoRepository {
270
274
  */
271
275
  deleteById(params) {
272
276
  return __awaiter(this, void 0, void 0, function* () {
273
- yield this.organizationModel.findOneAndRemove({ _id: params.id })
277
+ yield this.organizationModel.findOneAndRemove({
278
+ _id: params.id,
279
+ 'project.id': { $eq: params.project.id }
280
+ })
274
281
  .exec();
275
282
  });
276
283
  }
@@ -85,10 +85,8 @@ export declare class StockHolderRepository {
85
85
  static KEY_PREFIX_NEW: string;
86
86
  static KEY_PREFIX: string;
87
87
  private readonly redisClient;
88
- private readonly holdReservationModel;
89
- constructor(redisClient: RedisClientType, connection: Connection);
88
+ constructor(redisClient: RedisClientType, __: Connection);
90
89
  private static offer2field;
91
- private static offer2subReservation;
92
90
  private static createKey;
93
91
  /**
94
92
  * 新リポジトリを使用するかどうか
@@ -101,12 +99,7 @@ export declare class StockHolderRepository {
101
99
  /**
102
100
  * 座席をロックする
103
101
  */
104
- lock(lockKey: ILockKey & {
105
- /**
106
- * テスト目的の強制オプション
107
- */
108
- useMongooseForcibly?: boolean;
109
- }): Promise<void>;
102
+ lock(lockKey: ILockKey & {}): Promise<void>;
110
103
  /**
111
104
  * 座席ロックを解除する
112
105
  */
@@ -128,10 +121,6 @@ export declare class StockHolderRepository {
128
121
  * 保持者を取得する
129
122
  */
130
123
  getHolder(params: Omit<IUnlockKey, 'holder'>): Promise<string | null | undefined>;
131
- /**
132
- * 在庫状況を検索する
133
- * offers.lengthが0だと"ERR wrong number of arguments for 'hmget' command"となるので注意
134
- */
135
124
  searchHolders(params: {
136
125
  project: {
137
126
  id: string;
@@ -144,72 +133,8 @@ export declare class StockHolderRepository {
144
133
  /**
145
134
  * 汎用的な検索(mongooseのみ対応)
146
135
  */
147
- search(params: {
148
- limit?: number;
149
- page?: number;
150
- sort?: {
151
- 'reservationFor.startDate': factory.sortType;
152
- };
153
- project?: {
154
- id?: {
155
- $eq?: string;
156
- };
157
- };
158
- reservationFor?: {
159
- id?: {
160
- $eq?: string;
161
- };
162
- };
163
- reservationNumber?: {
164
- $eq?: string;
165
- };
166
- id?: {
167
- $eq?: string;
168
- };
169
- identifier?: {
170
- $eq?: string;
171
- };
172
- reservedTicket?: {
173
- ticketedSeat?: {
174
- seatNumber?: {
175
- $eq?: string;
176
- };
177
- seatSection?: {
178
- $eq?: string;
179
- };
180
- };
181
- };
182
- }): Promise<ISearchResult[]>;
183
136
  /**
184
137
  * 汎用的な集計(mongooseのみ対応)
185
138
  */
186
- aggregateByReservationFor(params: {
187
- limit?: number;
188
- page?: number;
189
- project?: {
190
- id?: {
191
- $eq?: string;
192
- };
193
- };
194
- reservationFor?: {
195
- id?: {
196
- $eq?: string;
197
- };
198
- };
199
- }): Promise<{
200
- typeOf: 'AggregateReservation';
201
- reservationCount: number;
202
- reservationFor: {
203
- id: string;
204
- startDate: Date;
205
- };
206
- reservationPackageCount: number;
207
- objectSize: number;
208
- }[]>;
209
139
  private checkIfConflicted;
210
- private initializeHoldReservation;
211
- /**
212
- * 仮で追加したholdReservationsが重複していないかどうか検証する
213
- */
214
- private checkIfAlreadyInUse;
215
140
  }