@chevre/domain 21.29.0-alpha.8 → 21.29.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.
- package/example/src/chevre/migrateCancelReservationObject.ts +71 -0
- package/example/src/chevre/{migrateOrderAcceptedOfferSerialNumber.ts → migrateOrderAcceptedOfferReservedTicketIdentifier.ts} +27 -16
- package/example/src/chevre/migratePayTransactionReservedTicketIdentifier.ts +95 -0
- package/example/src/chevre/searchAssetTransactions.ts +38 -0
- package/example/src/chevre/searchOrders.ts +6 -1
- package/lib/chevre/repo/acceptedOffer.d.ts +7 -2
- package/lib/chevre/repo/acceptedOffer.js +8 -4
- package/lib/chevre/repo/account.js +1 -1
- package/lib/chevre/repo/aggregateOffer.js +1 -1
- package/lib/chevre/repo/assetTransaction.d.ts +24 -3
- package/lib/chevre/repo/assetTransaction.js +96 -72
- package/lib/chevre/repo/creativeWork.js +1 -1
- package/lib/chevre/repo/event.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +31 -23
- package/lib/chevre/repo/mongoose/schemas/order.js +12 -3
- package/lib/chevre/repo/order.js +14 -5
- package/lib/chevre/repo/paymentServiceProvider.js +1 -1
- package/lib/chevre/repo/product.js +1 -1
- package/lib/chevre/repo/productModel.d.ts +22 -3
- package/lib/chevre/repo/productModel.js +40 -3
- package/lib/chevre/repo/seller.js +1 -1
- package/lib/chevre/repo/serviceOutput.js +1 -1
- package/lib/chevre/repo/transaction.js +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +8 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions/createPayObjectServiceOutput.d.ts +4 -0
- package/lib/chevre/service/assetTransaction/pay/potentialActions/createPayObjectServiceOutput.js +36 -28
- package/lib/chevre/service/payment/any/factory.d.ts +1 -0
- package/lib/chevre/service/payment/any/factory.js +2 -1
- package/lib/chevre/service/payment/any.js +2 -1
- package/lib/chevre/service/report/telemetry.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated/onCategoryCodeUpdated.d.ts +15 -0
- package/lib/chevre/service/task/onResourceUpdated/onCategoryCodeUpdated.js +26 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +9 -0
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.d.ts +15 -0
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +54 -0
- package/lib/chevre/service/task/onResourceUpdated.js +11 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +25 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -5
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +94 -57
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +18 -0
- package/lib/chevre/service/validation/validateOrder.js +13 -1
- package/lib/chevre/settings.d.ts +1 -4
- package/lib/chevre/settings.js +2 -8
- package/package.json +2 -2
- package/example/src/chevre/migrateOrderSeller.ts +0 -65
- package/example/src/chevre/migrateScreeningEventSeriesOffers.ts +0 -87
- package/example/src/chevre/playAroundProductModel.ts +0 -64
|
@@ -24,7 +24,7 @@ class MongoRepository {
|
|
|
24
24
|
}
|
|
25
25
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
26
26
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
27
|
-
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;
|
|
27
|
+
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;
|
|
28
28
|
const andConditions = [
|
|
29
29
|
{
|
|
30
30
|
typeOf: params.typeOf
|
|
@@ -97,11 +97,11 @@ class MongoRepository {
|
|
|
97
97
|
}
|
|
98
98
|
const transactionNumberEq = (_c = params.transactionNumber) === null || _c === void 0 ? void 0 : _c.$eq;
|
|
99
99
|
if (typeof transactionNumberEq === 'string') {
|
|
100
|
-
andConditions.push({ transactionNumber: { $
|
|
100
|
+
andConditions.push({ transactionNumber: { $eq: transactionNumberEq } });
|
|
101
101
|
}
|
|
102
102
|
const transactionNumberIn = (_d = params.transactionNumber) === null || _d === void 0 ? void 0 : _d.$in;
|
|
103
103
|
if (Array.isArray(transactionNumberIn)) {
|
|
104
|
-
andConditions.push({ transactionNumber: { $
|
|
104
|
+
andConditions.push({ transactionNumber: { $in: transactionNumberIn } });
|
|
105
105
|
}
|
|
106
106
|
if (Array.isArray(params.tasksExportationStatuses)) {
|
|
107
107
|
andConditions.push({
|
|
@@ -112,16 +112,15 @@ class MongoRepository {
|
|
|
112
112
|
case factory.assetTransactionType.Pay:
|
|
113
113
|
const objectAccountIdEq = (_f = (_e = params.object) === null || _e === void 0 ? void 0 : _e.accountId) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
114
114
|
if (typeof objectAccountIdEq === 'string') {
|
|
115
|
-
andConditions.push({
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
});
|
|
115
|
+
andConditions.push({ 'object.accountId': { $exists: true, $eq: objectAccountIdEq } });
|
|
116
|
+
}
|
|
117
|
+
const objectTypeOfEq = (_h = (_g = params.object) === null || _g === void 0 ? void 0 : _g.typeOf) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
118
|
+
if (typeof objectTypeOfEq === 'string') {
|
|
119
|
+
andConditions.push({ 'object.typeOf': { $exists: true, $eq: objectTypeOfEq } });
|
|
121
120
|
}
|
|
122
121
|
break;
|
|
123
122
|
case factory.assetTransactionType.Refund:
|
|
124
|
-
const objectAccountIdEq4refund = (
|
|
123
|
+
const objectAccountIdEq4refund = (_k = (_j = params.object) === null || _j === void 0 ? void 0 : _j.accountId) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
125
124
|
if (typeof objectAccountIdEq4refund === 'string') {
|
|
126
125
|
andConditions.push({
|
|
127
126
|
'object.accountId': {
|
|
@@ -130,13 +129,13 @@ class MongoRepository {
|
|
|
130
129
|
}
|
|
131
130
|
});
|
|
132
131
|
}
|
|
133
|
-
const objectPaymentMethodIdEq4refund = (
|
|
132
|
+
const objectPaymentMethodIdEq4refund = (_m = (_l = params.object) === null || _l === void 0 ? void 0 : _l.paymentMethodId) === null || _m === void 0 ? void 0 : _m.$eq;
|
|
134
133
|
if (typeof objectPaymentMethodIdEq4refund === 'string') {
|
|
135
134
|
andConditions.push({
|
|
136
135
|
'object.paymentMethodId': { $exists: true, $eq: objectPaymentMethodIdEq4refund }
|
|
137
136
|
});
|
|
138
137
|
}
|
|
139
|
-
const objectPaymentMethodIdIn4refund = (
|
|
138
|
+
const objectPaymentMethodIdIn4refund = (_p = (_o = params.object) === null || _o === void 0 ? void 0 : _o.paymentMethodId) === null || _p === void 0 ? void 0 : _p.$in;
|
|
140
139
|
if (Array.isArray(objectPaymentMethodIdIn4refund)) {
|
|
141
140
|
andConditions.push({
|
|
142
141
|
'object.paymentMethodId': { $exists: true, $in: objectPaymentMethodIdIn4refund }
|
|
@@ -144,7 +143,7 @@ class MongoRepository {
|
|
|
144
143
|
}
|
|
145
144
|
break;
|
|
146
145
|
case factory.assetTransactionType.MoneyTransfer:
|
|
147
|
-
const fromLocationIdentifierEq = (
|
|
146
|
+
const fromLocationIdentifierEq = (_s = (_r = (_q = params.object) === null || _q === void 0 ? void 0 : _q.fromLocation) === null || _r === void 0 ? void 0 : _r.identifier) === null || _s === void 0 ? void 0 : _s.$eq;
|
|
148
147
|
if (typeof fromLocationIdentifierEq === 'string') {
|
|
149
148
|
andConditions.push({
|
|
150
149
|
'object.fromLocation.identifier': {
|
|
@@ -153,7 +152,7 @@ class MongoRepository {
|
|
|
153
152
|
}
|
|
154
153
|
});
|
|
155
154
|
}
|
|
156
|
-
const toLocationIdentifierEq = (
|
|
155
|
+
const toLocationIdentifierEq = (_v = (_u = (_t = params.object) === null || _t === void 0 ? void 0 : _t.toLocation) === null || _u === void 0 ? void 0 : _u.identifier) === null || _v === void 0 ? void 0 : _v.$eq;
|
|
157
156
|
if (typeof toLocationIdentifierEq === 'string') {
|
|
158
157
|
andConditions.push({
|
|
159
158
|
'object.toLocation.identifier': {
|
|
@@ -162,7 +161,7 @@ class MongoRepository {
|
|
|
162
161
|
}
|
|
163
162
|
});
|
|
164
163
|
}
|
|
165
|
-
const pendingTransactionIdentifierEq = (
|
|
164
|
+
const pendingTransactionIdentifierEq = (_y = (_x = (_w = params.object) === null || _w === void 0 ? void 0 : _w.pendingTransaction) === null || _x === void 0 ? void 0 : _x.identifier) === null || _y === void 0 ? void 0 : _y.$eq;
|
|
166
165
|
if (typeof pendingTransactionIdentifierEq === 'string') {
|
|
167
166
|
andConditions.push({
|
|
168
167
|
'object.pendingTransaction.identifier': {
|
|
@@ -173,13 +172,25 @@ class MongoRepository {
|
|
|
173
172
|
}
|
|
174
173
|
break;
|
|
175
174
|
case factory.assetTransactionType.CancelReservation:
|
|
175
|
+
const objectReservationNumberIn4cancelReservation = (_0 = (_z = params.object) === null || _z === void 0 ? void 0 : _z.reservationNumber) === null || _0 === void 0 ? void 0 : _0.$in;
|
|
176
|
+
if (Array.isArray(objectReservationNumberIn4cancelReservation)) {
|
|
177
|
+
andConditions.push({
|
|
178
|
+
'object.reservationNumber': { $exists: true, $in: objectReservationNumberIn4cancelReservation }
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
const objectReservationNumberEq4cancelReservation = (_2 = (_1 = params.object) === null || _1 === void 0 ? void 0 : _1.reservationNumber) === null || _2 === void 0 ? void 0 : _2.$eq;
|
|
182
|
+
if (typeof objectReservationNumberEq4cancelReservation === 'string') {
|
|
183
|
+
andConditions.push({
|
|
184
|
+
'object.reservationNumber': { $exists: true, $eq: objectReservationNumberEq4cancelReservation }
|
|
185
|
+
});
|
|
186
|
+
}
|
|
176
187
|
break;
|
|
177
188
|
case factory.assetTransactionType.Reserve:
|
|
178
|
-
const objectProviderIdEq = (
|
|
189
|
+
const objectProviderIdEq = (_5 = (_4 = (_3 = params.object) === null || _3 === void 0 ? void 0 : _3.provider) === null || _4 === void 0 ? void 0 : _4.id) === null || _5 === void 0 ? void 0 : _5.$eq;
|
|
179
190
|
if (typeof objectProviderIdEq === 'string') {
|
|
180
191
|
andConditions.push({ 'object.provider.id': { $exists: true, $eq: objectProviderIdEq } });
|
|
181
192
|
}
|
|
182
|
-
const objectReservationForIdEq = (
|
|
193
|
+
const objectReservationForIdEq = (_8 = (_7 = (_6 = params.object) === null || _6 === void 0 ? void 0 : _6.reservationFor) === null || _7 === void 0 ? void 0 : _7.id) === null || _8 === void 0 ? void 0 : _8.$eq;
|
|
183
194
|
if (typeof objectReservationForIdEq === 'string') {
|
|
184
195
|
andConditions.push({
|
|
185
196
|
'object.reservationFor.id': {
|
|
@@ -188,25 +199,19 @@ class MongoRepository {
|
|
|
188
199
|
}
|
|
189
200
|
});
|
|
190
201
|
}
|
|
191
|
-
const objectReservationNumberIn = (
|
|
202
|
+
const objectReservationNumberIn = (_10 = (_9 = params.object) === null || _9 === void 0 ? void 0 : _9.reservationNumber) === null || _10 === void 0 ? void 0 : _10.$in;
|
|
192
203
|
if (Array.isArray(objectReservationNumberIn)) {
|
|
193
204
|
andConditions.push({
|
|
194
|
-
'object.reservationNumber': {
|
|
195
|
-
$exists: true,
|
|
196
|
-
$in: objectReservationNumberIn
|
|
197
|
-
}
|
|
205
|
+
'object.reservationNumber': { $exists: true, $in: objectReservationNumberIn }
|
|
198
206
|
});
|
|
199
207
|
}
|
|
200
|
-
const objectReservationNumberEq = (
|
|
208
|
+
const objectReservationNumberEq = (_12 = (_11 = params.object) === null || _11 === void 0 ? void 0 : _11.reservationNumber) === null || _12 === void 0 ? void 0 : _12.$eq;
|
|
201
209
|
if (typeof objectReservationNumberEq === 'string') {
|
|
202
210
|
andConditions.push({
|
|
203
|
-
'object.reservationNumber': {
|
|
204
|
-
$exists: true,
|
|
205
|
-
$eq: objectReservationNumberEq
|
|
206
|
-
}
|
|
211
|
+
'object.reservationNumber': { $exists: true, $eq: objectReservationNumberEq }
|
|
207
212
|
});
|
|
208
213
|
}
|
|
209
|
-
const objectSubReservationIdIn = (
|
|
214
|
+
const objectSubReservationIdIn = (_15 = (_14 = (_13 = params.object) === null || _13 === void 0 ? void 0 : _13.reservations) === null || _14 === void 0 ? void 0 : _14.id) === null || _15 === void 0 ? void 0 : _15.$in;
|
|
210
215
|
if (Array.isArray(objectSubReservationIdIn)) {
|
|
211
216
|
andConditions.push({
|
|
212
217
|
'object.subReservation.id': {
|
|
@@ -241,7 +246,7 @@ class MongoRepository {
|
|
|
241
246
|
}
|
|
242
247
|
}
|
|
243
248
|
}
|
|
244
|
-
const objectUnderNameIdEq = (
|
|
249
|
+
const objectUnderNameIdEq = (_18 = (_17 = (_16 = params.object) === null || _16 === void 0 ? void 0 : _16.underName) === null || _17 === void 0 ? void 0 : _17.id) === null || _18 === void 0 ? void 0 : _18.$eq;
|
|
245
250
|
if (typeof objectUnderNameIdEq === 'string') {
|
|
246
251
|
andConditions.push({
|
|
247
252
|
'object.underName.id': {
|
|
@@ -250,7 +255,7 @@ class MongoRepository {
|
|
|
250
255
|
}
|
|
251
256
|
});
|
|
252
257
|
}
|
|
253
|
-
const objectSubReservationSeatNumberEq = (
|
|
258
|
+
const objectSubReservationSeatNumberEq = (_23 = (_22 = (_21 = (_20 = (_19 = params.object) === null || _19 === void 0 ? void 0 : _19.reservations) === null || _20 === void 0 ? void 0 : _20.reservedTicket) === null || _21 === void 0 ? void 0 : _21.ticketedSeat) === null || _22 === void 0 ? void 0 : _22.seatNumber) === null || _23 === void 0 ? void 0 : _23.$eq;
|
|
254
259
|
if (typeof objectSubReservationSeatNumberEq === 'string') {
|
|
255
260
|
andConditions.push({
|
|
256
261
|
'object.subReservation.reservedTicket.ticketedSeat.seatNumber': {
|
|
@@ -261,7 +266,7 @@ class MongoRepository {
|
|
|
261
266
|
}
|
|
262
267
|
break;
|
|
263
268
|
case factory.assetTransactionType.RegisterService:
|
|
264
|
-
const objectItemOfferedServiceOutputIdentifierEq = (
|
|
269
|
+
const objectItemOfferedServiceOutputIdentifierEq = (_27 = (_26 = (_25 = (_24 = params.object) === null || _24 === void 0 ? void 0 : _24.itemOffered) === null || _25 === void 0 ? void 0 : _25.serviceOutput) === null || _26 === void 0 ? void 0 : _26.identifier) === null || _27 === void 0 ? void 0 : _27.$eq;
|
|
265
270
|
if (typeof objectItemOfferedServiceOutputIdentifierEq === 'string') {
|
|
266
271
|
andConditions.push({
|
|
267
272
|
'object.itemOffered.serviceOutput.identifier': {
|
|
@@ -270,7 +275,7 @@ class MongoRepository {
|
|
|
270
275
|
}
|
|
271
276
|
});
|
|
272
277
|
}
|
|
273
|
-
const objectItemOfferedServiceOutputIdentifierIn = (
|
|
278
|
+
const objectItemOfferedServiceOutputIdentifierIn = (_31 = (_30 = (_29 = (_28 = params.object) === null || _28 === void 0 ? void 0 : _28.itemOffered) === null || _29 === void 0 ? void 0 : _29.serviceOutput) === null || _30 === void 0 ? void 0 : _30.identifier) === null || _31 === void 0 ? void 0 : _31.$in;
|
|
274
279
|
if (Array.isArray(objectItemOfferedServiceOutputIdentifierIn)) {
|
|
275
280
|
andConditions.push({
|
|
276
281
|
'object.itemOffered.serviceOutput.identifier': {
|
|
@@ -311,7 +316,7 @@ class MongoRepository {
|
|
|
311
316
|
findByTransactionNumber(params) {
|
|
312
317
|
return __awaiter(this, void 0, void 0, function* () {
|
|
313
318
|
const doc = yield this.transactionModel.findOne({
|
|
314
|
-
transactionNumber: { $
|
|
319
|
+
transactionNumber: { $eq: params.transactionNumber },
|
|
315
320
|
typeOf: params.typeOf
|
|
316
321
|
})
|
|
317
322
|
.exec();
|
|
@@ -569,7 +574,7 @@ class MongoRepository {
|
|
|
569
574
|
const endDate = new Date();
|
|
570
575
|
// 進行中ステータスの取引を中止する
|
|
571
576
|
const doc = yield this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign({ typeOf: { $eq: params.typeOf } }, (typeof params.id === 'string') ? { _id: { $eq: params.id } } : undefined), (typeof params.transactionNumber === 'string')
|
|
572
|
-
? { transactionNumber: { $
|
|
577
|
+
? { transactionNumber: { $eq: params.transactionNumber } }
|
|
573
578
|
: undefined), { status: { $eq: factory.transactionStatusType.InProgress } }), {
|
|
574
579
|
status: factory.transactionStatusType.Canceled,
|
|
575
580
|
endDate: endDate
|
|
@@ -688,6 +693,21 @@ class MongoRepository {
|
|
|
688
693
|
.exec();
|
|
689
694
|
});
|
|
690
695
|
}
|
|
696
|
+
/**
|
|
697
|
+
* 終了日時を一定期間過ぎたアクションを削除する
|
|
698
|
+
*/
|
|
699
|
+
deleteEndDatePassedCertainPeriod(params) {
|
|
700
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
701
|
+
yield this.transactionModel.deleteMany({
|
|
702
|
+
// 終了日時を一定期間過ぎたもの
|
|
703
|
+
endDate: {
|
|
704
|
+
$exists: true,
|
|
705
|
+
$lt: params.$lt
|
|
706
|
+
}
|
|
707
|
+
})
|
|
708
|
+
.exec();
|
|
709
|
+
});
|
|
710
|
+
}
|
|
691
711
|
/**
|
|
692
712
|
* 特定の取引を更新する(汎用)
|
|
693
713
|
*/
|
|
@@ -706,55 +726,59 @@ class MongoRepository {
|
|
|
706
726
|
});
|
|
707
727
|
});
|
|
708
728
|
}
|
|
709
|
-
|
|
729
|
+
/**
|
|
730
|
+
* 互換性維持対応
|
|
731
|
+
*/
|
|
732
|
+
migrateObjectReservationNumber(params) {
|
|
710
733
|
return __awaiter(this, void 0, void 0, function* () {
|
|
711
734
|
return this.transactionModel.findOneAndUpdate({
|
|
712
|
-
typeOf: { $eq: factory.assetTransactionType.
|
|
713
|
-
|
|
714
|
-
}, {
|
|
735
|
+
typeOf: { $eq: factory.assetTransactionType.CancelReservation },
|
|
736
|
+
_id: { $eq: params.id }
|
|
737
|
+
}, {
|
|
738
|
+
$set: {
|
|
739
|
+
'object.reservationNumber': params.object.reservationNumber,
|
|
740
|
+
'object.typeOf': factory.reservationType.ReservationPackage
|
|
741
|
+
}
|
|
742
|
+
}, {
|
|
743
|
+
timestamps: false,
|
|
715
744
|
new: true,
|
|
716
745
|
projection: { _id: 1 }
|
|
717
746
|
})
|
|
718
747
|
.exec()
|
|
719
748
|
.then((doc) => {
|
|
720
749
|
if (doc === null) {
|
|
721
|
-
throw new factory.errors.
|
|
750
|
+
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
722
751
|
}
|
|
723
752
|
return doc.toObject();
|
|
724
753
|
});
|
|
725
754
|
});
|
|
726
755
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
// // }
|
|
754
|
-
// // }
|
|
755
|
-
// ])
|
|
756
|
-
// .exec();
|
|
757
|
-
// }
|
|
756
|
+
/**
|
|
757
|
+
* 互換性維持対応専用
|
|
758
|
+
*/
|
|
759
|
+
fixReservedTicketIdentifier(params) {
|
|
760
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
761
|
+
const doc = yield this.transactionModel.findOneAndUpdate({
|
|
762
|
+
transactionNumber: { $eq: params.transactionNumber },
|
|
763
|
+
'project.id': { $eq: params.project.id },
|
|
764
|
+
typeOf: { $eq: factory.assetTransactionType.Pay }
|
|
765
|
+
}, {
|
|
766
|
+
$set: {
|
|
767
|
+
'object.paymentMethod.movieTickets': params.object.paymentMethod.movieTickets
|
|
768
|
+
}
|
|
769
|
+
}, {
|
|
770
|
+
timestamps: false,
|
|
771
|
+
new: true,
|
|
772
|
+
projection: {
|
|
773
|
+
_id: 1
|
|
774
|
+
}
|
|
775
|
+
})
|
|
776
|
+
.exec();
|
|
777
|
+
if (doc === null) {
|
|
778
|
+
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
}
|
|
758
782
|
findByIdAndDelete(params) {
|
|
759
783
|
return __awaiter(this, void 0, void 0, function* () {
|
|
760
784
|
yield this.transactionModel.findByIdAndDelete(params.id)
|
|
@@ -763,8 +787,8 @@ class MongoRepository {
|
|
|
763
787
|
}
|
|
764
788
|
getCursor(conditions, projection) {
|
|
765
789
|
return this.transactionModel.find(conditions, projection)
|
|
766
|
-
.sort({ startDate: factory.sortType.Ascending })
|
|
767
|
-
|
|
790
|
+
// .sort({ startDate: factory.sortType.Ascending })
|
|
791
|
+
.sort({ startDate: factory.sortType.Descending })
|
|
768
792
|
.cursor();
|
|
769
793
|
}
|
|
770
794
|
aggregateAssetTransaction(params) {
|
|
@@ -271,7 +271,7 @@ class MongoRepository {
|
|
|
271
271
|
}
|
|
272
272
|
unsetUnnecessaryFields(params) {
|
|
273
273
|
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
-
return this.creativeWorkModel.updateMany(params.filter, { $unset: params.$unset })
|
|
274
|
+
return this.creativeWorkModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
275
275
|
.exec();
|
|
276
276
|
});
|
|
277
277
|
}
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -1136,7 +1136,7 @@ class MongoRepository {
|
|
|
1136
1136
|
}
|
|
1137
1137
|
unsetUnnecessaryFields(params) {
|
|
1138
1138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1139
|
-
return this.eventModel.updateMany(params.filter, { $unset: params.$unset })
|
|
1139
|
+
return this.eventModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
1140
1140
|
.exec();
|
|
1141
1141
|
});
|
|
1142
1142
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Schema } from 'mongoose';
|
|
2
2
|
declare const modelName = "AssetTransaction";
|
|
3
|
-
declare function createSchema(): Schema;
|
|
4
3
|
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
4
|
+
declare function createSchema(): Schema;
|
|
5
5
|
export { modelName, indexes, createSchema };
|
|
@@ -7,10 +7,10 @@ const settings_1 = require("../../../settings");
|
|
|
7
7
|
const modelName = 'AssetTransaction';
|
|
8
8
|
exports.modelName = modelName;
|
|
9
9
|
const schemaDefinition = {
|
|
10
|
-
project: mongoose_1.SchemaTypes.Mixed,
|
|
11
|
-
status: String,
|
|
12
|
-
typeOf: String,
|
|
13
|
-
transactionNumber: String,
|
|
10
|
+
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
11
|
+
status: { type: String, required: true },
|
|
12
|
+
typeOf: { type: String, required: true },
|
|
13
|
+
transactionNumber: { type: String, required: true },
|
|
14
14
|
agent: mongoose_1.SchemaTypes.Mixed,
|
|
15
15
|
recipient: mongoose_1.SchemaTypes.Mixed,
|
|
16
16
|
seller: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -53,17 +53,6 @@ const schemaOptions = {
|
|
|
53
53
|
versionKey: false
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
/**
|
|
57
|
-
* 資産取引スキーマ
|
|
58
|
-
*/
|
|
59
|
-
let schema;
|
|
60
|
-
function createSchema() {
|
|
61
|
-
if (schema === undefined) {
|
|
62
|
-
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
63
|
-
}
|
|
64
|
-
return schema;
|
|
65
|
-
}
|
|
66
|
-
exports.createSchema = createSchema;
|
|
67
56
|
const indexes = [
|
|
68
57
|
[
|
|
69
58
|
{ createdAt: 1 },
|
|
@@ -77,18 +66,12 @@ const indexes = [
|
|
|
77
66
|
{ transactionNumber: 1 },
|
|
78
67
|
{
|
|
79
68
|
unique: true,
|
|
80
|
-
|
|
81
|
-
transactionNumber: { $exists: true }
|
|
82
|
-
}
|
|
69
|
+
name: 'uniqueTransactionNumber'
|
|
83
70
|
}
|
|
84
71
|
],
|
|
85
72
|
[
|
|
86
73
|
{ transactionNumber: 1, startDate: -1 },
|
|
87
|
-
{
|
|
88
|
-
partialFilterExpression: {
|
|
89
|
-
transactionNumber: { $exists: true }
|
|
90
|
-
}
|
|
91
|
-
}
|
|
74
|
+
{ name: 'searchByTransactionNumber' }
|
|
92
75
|
],
|
|
93
76
|
[
|
|
94
77
|
{ 'project.id': 1, startDate: -1 },
|
|
@@ -290,6 +273,15 @@ const indexes = [
|
|
|
290
273
|
}
|
|
291
274
|
}
|
|
292
275
|
],
|
|
276
|
+
[
|
|
277
|
+
{ 'object.typeOf': 1, startDate: -1 },
|
|
278
|
+
{
|
|
279
|
+
name: 'searchByObjectTypeOf',
|
|
280
|
+
partialFilterExpression: {
|
|
281
|
+
'object.typeOf': { $exists: true }
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
],
|
|
293
285
|
[
|
|
294
286
|
{ typeOf: 1, status: 1, tasksExportationStatus: 1 },
|
|
295
287
|
{ name: 'startExportTasks' }
|
|
@@ -304,3 +296,19 @@ const indexes = [
|
|
|
304
296
|
]
|
|
305
297
|
];
|
|
306
298
|
exports.indexes = indexes;
|
|
299
|
+
/**
|
|
300
|
+
* 資産取引スキーマ
|
|
301
|
+
*/
|
|
302
|
+
let schema;
|
|
303
|
+
function createSchema() {
|
|
304
|
+
if (schema === undefined) {
|
|
305
|
+
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
306
|
+
if (settings_1.MONGO_AUTO_INDEX) {
|
|
307
|
+
indexes.forEach((indexParams) => {
|
|
308
|
+
schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return schema;
|
|
313
|
+
}
|
|
314
|
+
exports.createSchema = createSchema;
|
|
@@ -21,15 +21,15 @@ const schemaDefinition = {
|
|
|
21
21
|
priceCurrency: String,
|
|
22
22
|
acceptedOffers: [mongoose_1.SchemaTypes.Mixed],
|
|
23
23
|
paymentMethods: [mongoose_1.SchemaTypes.Mixed],
|
|
24
|
-
discounts:
|
|
24
|
+
// discounts: SchemaTypes.Mixed, // 廃止(2024-04-17~)
|
|
25
25
|
url: String,
|
|
26
26
|
orderStatus: String,
|
|
27
27
|
previousOrderStatus: String,
|
|
28
28
|
orderDate: Date,
|
|
29
29
|
isGift: Boolean,
|
|
30
30
|
dateReturned: Date,
|
|
31
|
-
orderedItem: [mongoose_1.SchemaTypes.Mixed]
|
|
32
|
-
additionalProperty:
|
|
31
|
+
orderedItem: [mongoose_1.SchemaTypes.Mixed] // 追加(2022-04-15~)
|
|
32
|
+
// additionalProperty: SchemaTypes.Mixed // 廃止(2024-04-17~)
|
|
33
33
|
};
|
|
34
34
|
const schemaOptions = {
|
|
35
35
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -434,6 +434,15 @@ const indexes = [
|
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
],
|
|
437
|
+
[
|
|
438
|
+
{ 'acceptedOffers.itemOffered.reservedTicket.identifier': 1, orderDate: -1 },
|
|
439
|
+
{
|
|
440
|
+
name: 'searchByReservedTicketIdentifier',
|
|
441
|
+
partialFilterExpression: {
|
|
442
|
+
'acceptedOffers.itemOffered.reservedTicket.identifier': { $exists: true }
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
],
|
|
437
446
|
[
|
|
438
447
|
{ 'acceptedOffers.serialNumber': 1, orderDate: -1 },
|
|
439
448
|
{
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -23,7 +23,7 @@ class MongoRepository {
|
|
|
23
23
|
}
|
|
24
24
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
25
25
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
26
|
-
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;
|
|
26
|
+
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
27
|
const andConditions = [
|
|
28
28
|
{ typeOf: { $eq: factory.order.OrderType.Order } }
|
|
29
29
|
];
|
|
@@ -412,6 +412,15 @@ class MongoRepository {
|
|
|
412
412
|
}
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
|
+
const itemOfferedReservedTicketIdentifierEq = (_18 = (_17 = (_16 = (_15 = params.acceptedOffers) === null || _15 === void 0 ? void 0 : _15.itemOffered) === null || _16 === void 0 ? void 0 : _16.reservedTicket) === null || _17 === void 0 ? void 0 : _17.identifier) === null || _18 === void 0 ? void 0 : _18.$eq;
|
|
416
|
+
if (typeof itemOfferedReservedTicketIdentifierEq === 'string') {
|
|
417
|
+
andConditions.push({
|
|
418
|
+
'acceptedOffers.itemOffered.reservedTicket.identifier': {
|
|
419
|
+
$exists: true,
|
|
420
|
+
$eq: itemOfferedReservedTicketIdentifierEq
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
}
|
|
415
424
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
416
425
|
/* istanbul ignore else */
|
|
417
426
|
if (params.acceptedOffers !== undefined) {
|
|
@@ -565,11 +574,11 @@ class MongoRepository {
|
|
|
565
574
|
}
|
|
566
575
|
}
|
|
567
576
|
}
|
|
568
|
-
const paymentMethodIdentifierIn = (
|
|
577
|
+
const paymentMethodIdentifierIn = (_21 = (_20 = (_19 = params.paymentMethods) === null || _19 === void 0 ? void 0 : _19.paymentMethod) === null || _20 === void 0 ? void 0 : _20.identifier) === null || _21 === void 0 ? void 0 : _21.$in;
|
|
569
578
|
if (Array.isArray(paymentMethodIdentifierIn)) {
|
|
570
579
|
andConditions.push({ 'paymentMethods.paymentMethod.identifier': { $exists: true, $in: paymentMethodIdentifierIn } });
|
|
571
580
|
}
|
|
572
|
-
const paymentMethodsTypeOfIn = (
|
|
581
|
+
const paymentMethodsTypeOfIn = (_22 = params.paymentMethods) === null || _22 === void 0 ? void 0 : _22.typeOfs;
|
|
573
582
|
if (Array.isArray(paymentMethodsTypeOfIn)) {
|
|
574
583
|
// paymentMethod.identifierで検索(2023-11-15~)
|
|
575
584
|
// andConditions.push({ 'paymentMethods.typeOf': { $exists: true, $in: paymentMethodsTypeOfIn } });
|
|
@@ -599,7 +608,7 @@ class MongoRepository {
|
|
|
599
608
|
});
|
|
600
609
|
}
|
|
601
610
|
}
|
|
602
|
-
const paymentMethodAdditionalPropertyAll = (
|
|
611
|
+
const paymentMethodAdditionalPropertyAll = (_24 = (_23 = params.paymentMethods) === null || _23 === void 0 ? void 0 : _23.additionalProperty) === null || _24 === void 0 ? void 0 : _24.$all;
|
|
603
612
|
if (Array.isArray(paymentMethodAdditionalPropertyAll)) {
|
|
604
613
|
andConditions.push({
|
|
605
614
|
'paymentMethods.additionalProperty': {
|
|
@@ -608,7 +617,7 @@ class MongoRepository {
|
|
|
608
617
|
}
|
|
609
618
|
});
|
|
610
619
|
}
|
|
611
|
-
const paymentMethodAdditionalPropertyIn = (
|
|
620
|
+
const paymentMethodAdditionalPropertyIn = (_26 = (_25 = params.paymentMethods) === null || _25 === void 0 ? void 0 : _25.additionalProperty) === null || _26 === void 0 ? void 0 : _26.$in;
|
|
612
621
|
if (Array.isArray(paymentMethodAdditionalPropertyIn)) {
|
|
613
622
|
andConditions.push({
|
|
614
623
|
'paymentMethods.additionalProperty': {
|
|
@@ -230,7 +230,7 @@ class MongoRepository {
|
|
|
230
230
|
}
|
|
231
231
|
unsetUnnecessaryFields(params) {
|
|
232
232
|
return __awaiter(this, void 0, void 0, function* () {
|
|
233
|
-
return this.paymentServiceModel.updateMany(params.filter, { $unset: params.$unset })
|
|
233
|
+
return this.paymentServiceModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
234
234
|
.exec();
|
|
235
235
|
});
|
|
236
236
|
}
|
|
@@ -344,7 +344,7 @@ class MongoRepository {
|
|
|
344
344
|
}
|
|
345
345
|
unsetUnnecessaryFields(params) {
|
|
346
346
|
return __awaiter(this, void 0, void 0, function* () {
|
|
347
|
-
return this.productModel.updateMany(params.filter, { $unset: params.$unset })
|
|
347
|
+
return this.productModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
348
348
|
.exec();
|
|
349
349
|
});
|
|
350
350
|
}
|
|
@@ -7,7 +7,13 @@ interface IProductModel {
|
|
|
7
7
|
typeOf: factory.organizationType.Project;
|
|
8
8
|
};
|
|
9
9
|
typeOf: 'ProductModel';
|
|
10
|
-
category: Pick<factory.categoryCode.ICategoryCode, 'codeValue' | 'inCodeSet'
|
|
10
|
+
category: Pick<factory.categoryCode.ICategoryCode, 'codeValue' | 'inCodeSet'> & {
|
|
11
|
+
/**
|
|
12
|
+
* 区分ID
|
|
13
|
+
* 削除時同期に必要
|
|
14
|
+
*/
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
11
17
|
name: factory.multilingualString;
|
|
12
18
|
offers: {
|
|
13
19
|
typeOf: factory.offerType.Offer;
|
|
@@ -52,8 +58,21 @@ export declare class MongoRepository {
|
|
|
52
58
|
}): Promise<{
|
|
53
59
|
id: string;
|
|
54
60
|
}>;
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
/**
|
|
62
|
+
* 区分から同期する
|
|
63
|
+
*/
|
|
64
|
+
upsertByCategory(params: {
|
|
65
|
+
category: Pick<factory.categoryCode.ICategoryCode, 'codeValue' | 'inCodeSet' | 'name' | 'project'> & {
|
|
66
|
+
id: string;
|
|
67
|
+
};
|
|
68
|
+
}): Promise<{
|
|
69
|
+
id: string;
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* 区分から削除する
|
|
73
|
+
*/
|
|
74
|
+
deleteByCategory(params: {
|
|
75
|
+
category: Pick<factory.categoryCode.ICategoryCode, 'project'> & {
|
|
57
76
|
id: string;
|
|
58
77
|
};
|
|
59
78
|
}): Promise<void>;
|