@chevre/domain 20.1.0-alpha.2 → 20.1.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.
- package/example/src/chevre/deleteEvents.ts +9 -1
- package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +139 -0
- package/example/src/chevre/migrateEventSeriesAdditionalProperties.ts +96 -0
- package/example/src/chevre/migrateSellerMakesOfferTransactionDuration.ts +71 -0
- package/example/src/chevre/searchEvents.ts +36 -16
- package/lib/chevre/repo/action.js +42 -31
- package/lib/chevre/repo/additionalProperty.d.ts +35 -0
- package/lib/chevre/repo/additionalProperty.js +211 -0
- package/lib/chevre/repo/event.d.ts +9 -4
- package/lib/chevre/repo/event.js +59 -47
- package/lib/chevre/repo/mongoose/model/action.js +9 -1
- package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/additionalProperty.js +81 -0
- package/lib/chevre/repo/mongoose/model/event.js +53 -0
- package/lib/chevre/repo/mongoose/model/place.js +18 -0
- package/lib/chevre/repo/place.d.ts +1 -0
- package/lib/chevre/repo/place.js +5 -0
- package/lib/chevre/repo/transaction.js +20 -5
- package/lib/chevre/repository.d.ts +6 -0
- package/lib/chevre/repository.js +8 -1
- package/lib/chevre/service/account.d.ts +0 -4
- package/lib/chevre/service/account.js +24 -22
- package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/deposit.js +3 -3
- package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/transfer.js +3 -3
- package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +11 -20
- package/lib/chevre/service/delivery/factory.js +2 -1
- package/lib/chevre/service/event.js +10 -0
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
- package/lib/chevre/service/offer/event/authorize.js +46 -10
- package/lib/chevre/service/offer/factory.js +7 -20
- package/lib/chevre/service/offer.js +6 -6
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +5 -3
- package/lib/chevre/service/order/onOrderStatusChanged.js +5 -4
- package/lib/chevre/service/order/placeOrder.js +17 -7
- package/lib/chevre/service/order/returnOrder.js +2 -1
- package/lib/chevre/service/order/sendOrder.js +4 -2
- package/lib/chevre/service/transaction/orderProgramMembership.js +6 -8
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +6 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +4 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
- package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +4 -5
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +6 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +4 -6
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -1
- package/lib/chevre/service/transaction/returnOrder.js +10 -1
- package/lib/chevre/service/transaction.js +1 -14
- package/package.json +3 -3
- package/example/src/chevre/accountBlanceTest.ts +0 -24
- package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
- package/example/src/chevre/createSeats.ts +0 -59
- package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
- package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
- package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
- package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
- package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
- package/example/src/chevre/publishConfirmationNumber.ts +0 -30
- package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
- package/example/src/chevre/publishTransactionNumber.ts +0 -28
- package/example/src/chevre/renameTransaction.ts +0 -22
- package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
- package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
- package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
- package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmReservation.d.ts +0 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmReservation.js +0 -187
package/lib/chevre/repo/event.js
CHANGED
|
@@ -24,6 +24,7 @@ exports.MongoRepository = void 0;
|
|
|
24
24
|
const uniqid = require("uniqid");
|
|
25
25
|
const factory = require("../factory");
|
|
26
26
|
const event_1 = require("./mongoose/model/event");
|
|
27
|
+
const USE_DEPRECATED_EVENT_SEARCH_CONDITIONS = process.env.USE_DEPRECATED_EVENT_SEARCH_CONDITIONS === '1';
|
|
27
28
|
/**
|
|
28
29
|
* イベントリポジトリ
|
|
29
30
|
*/
|
|
@@ -33,7 +34,7 @@ class MongoRepository {
|
|
|
33
34
|
}
|
|
34
35
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
35
36
|
static CREATE_MONGO_CONDITIONS(conditions) {
|
|
36
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
37
|
+
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;
|
|
37
38
|
const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
|
|
38
39
|
const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
39
40
|
if (typeof projectIdEq === 'string') {
|
|
@@ -144,7 +145,7 @@ class MongoRepository {
|
|
|
144
145
|
}
|
|
145
146
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
146
147
|
/* istanbul ignore else */
|
|
147
|
-
const superEventLocationIdEq = (_k = (_j = (_h =
|
|
148
|
+
const superEventLocationIdEq = (_k = (_j = (_h = params.superEvent) === null || _h === void 0 ? void 0 : _h.location) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
148
149
|
if (typeof superEventLocationIdEq === 'string') {
|
|
149
150
|
andConditions.push({
|
|
150
151
|
'superEvent.location.id': {
|
|
@@ -190,45 +191,47 @@ class MongoRepository {
|
|
|
190
191
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
191
192
|
/* istanbul ignore else */
|
|
192
193
|
if (params.offers !== undefined) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
194
|
+
if (USE_DEPRECATED_EVENT_SEARCH_CONDITIONS) {
|
|
195
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
196
|
+
/* istanbul ignore else */
|
|
197
|
+
if (params.offers.availableFrom instanceof Date) {
|
|
198
|
+
andConditions.push({
|
|
199
|
+
'offers.availabilityEnds': {
|
|
200
|
+
$exists: true,
|
|
201
|
+
$gte: params.offers.availableFrom
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
206
|
+
/* istanbul ignore else */
|
|
207
|
+
if (params.offers.availableThrough instanceof Date) {
|
|
208
|
+
andConditions.push({
|
|
209
|
+
'offers.availabilityStarts': {
|
|
210
|
+
$exists: true,
|
|
211
|
+
$lte: params.offers.availableThrough
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
216
|
+
/* istanbul ignore else */
|
|
217
|
+
if (params.offers.validFrom instanceof Date) {
|
|
218
|
+
andConditions.push({
|
|
219
|
+
'offers.validThrough': {
|
|
220
|
+
$exists: true,
|
|
221
|
+
$gte: params.offers.validFrom
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
226
|
+
/* istanbul ignore else */
|
|
227
|
+
if (params.offers.validThrough instanceof Date) {
|
|
228
|
+
andConditions.push({
|
|
229
|
+
'offers.validFrom': {
|
|
230
|
+
$exists: true,
|
|
231
|
+
$lte: params.offers.validThrough
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
232
235
|
}
|
|
233
236
|
const itemOfferedIdIn = (_m = (_l = params.offers.itemOffered) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$in;
|
|
234
237
|
if (Array.isArray(itemOfferedIdIn)) {
|
|
@@ -280,6 +283,15 @@ class MongoRepository {
|
|
|
280
283
|
}
|
|
281
284
|
}
|
|
282
285
|
}
|
|
286
|
+
const sellerMakesOfferElemMatch = (_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;
|
|
287
|
+
if (typeof ((_r = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _r === void 0 ? void 0 : _r.$eq) === 'string') {
|
|
288
|
+
andConditions.push({
|
|
289
|
+
'offers.seller.makesOffer': {
|
|
290
|
+
$exists: true,
|
|
291
|
+
$elemMatch: sellerMakesOfferElemMatch
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
283
295
|
break;
|
|
284
296
|
case factory.eventType.ScreeningEventSeries:
|
|
285
297
|
params = conditions;
|
|
@@ -309,7 +321,7 @@ class MongoRepository {
|
|
|
309
321
|
]
|
|
310
322
|
});
|
|
311
323
|
}
|
|
312
|
-
const locationIdEq = (
|
|
324
|
+
const locationIdEq = (_t = (_s = params.location) === null || _s === void 0 ? void 0 : _s.id) === null || _t === void 0 ? void 0 : _t.$eq;
|
|
313
325
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
314
326
|
/* istanbul ignore else */
|
|
315
327
|
if (typeof locationIdEq === 'string') {
|
|
@@ -331,7 +343,7 @@ class MongoRepository {
|
|
|
331
343
|
});
|
|
332
344
|
}
|
|
333
345
|
}
|
|
334
|
-
const workPerformedIdentifierIn = (
|
|
346
|
+
const workPerformedIdentifierIn = (_u = params.workPerformed) === null || _u === void 0 ? void 0 : _u.identifiers;
|
|
335
347
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
336
348
|
/* istanbul ignore else */
|
|
337
349
|
if (Array.isArray(workPerformedIdentifierIn)) {
|
|
@@ -342,7 +354,7 @@ class MongoRepository {
|
|
|
342
354
|
}
|
|
343
355
|
});
|
|
344
356
|
}
|
|
345
|
-
const videoFormatTypeOfEq = (
|
|
357
|
+
const videoFormatTypeOfEq = (_w = (_v = params.videoFormat) === null || _v === void 0 ? void 0 : _v.typeOf) === null || _w === void 0 ? void 0 : _w.$eq;
|
|
346
358
|
if (typeof videoFormatTypeOfEq === 'string') {
|
|
347
359
|
andConditions.push({
|
|
348
360
|
'videoFormat.typeOf': {
|
|
@@ -351,7 +363,7 @@ class MongoRepository {
|
|
|
351
363
|
}
|
|
352
364
|
});
|
|
353
365
|
}
|
|
354
|
-
const videoFormatTypeOfIn = (
|
|
366
|
+
const videoFormatTypeOfIn = (_y = (_x = params.videoFormat) === null || _x === void 0 ? void 0 : _x.typeOf) === null || _y === void 0 ? void 0 : _y.$in;
|
|
355
367
|
if (Array.isArray(videoFormatTypeOfIn)) {
|
|
356
368
|
andConditions.push({
|
|
357
369
|
'videoFormat.typeOf': {
|
|
@@ -360,7 +372,7 @@ class MongoRepository {
|
|
|
360
372
|
}
|
|
361
373
|
});
|
|
362
374
|
}
|
|
363
|
-
const soundFormatTypeOfEq = (
|
|
375
|
+
const soundFormatTypeOfEq = (_0 = (_z = params.soundFormat) === null || _z === void 0 ? void 0 : _z.typeOf) === null || _0 === void 0 ? void 0 : _0.$eq;
|
|
364
376
|
if (typeof soundFormatTypeOfEq === 'string') {
|
|
365
377
|
andConditions.push({
|
|
366
378
|
'soundFormat.typeOf': {
|
|
@@ -369,7 +381,7 @@ class MongoRepository {
|
|
|
369
381
|
}
|
|
370
382
|
});
|
|
371
383
|
}
|
|
372
|
-
const soundFormatTypeOfIn = (
|
|
384
|
+
const soundFormatTypeOfIn = (_2 = (_1 = params.soundFormat) === null || _1 === void 0 ? void 0 : _1.typeOf) === null || _2 === void 0 ? void 0 : _2.$in;
|
|
373
385
|
if (Array.isArray(soundFormatTypeOfIn)) {
|
|
374
386
|
andConditions.push({
|
|
375
387
|
'soundFormat.typeOf': {
|
|
@@ -12,6 +12,7 @@ const schema = new mongoose.Schema({
|
|
|
12
12
|
project: mongoose.SchemaTypes.Mixed,
|
|
13
13
|
actionStatus: String,
|
|
14
14
|
typeOf: String,
|
|
15
|
+
description: String,
|
|
15
16
|
agent: mongoose.SchemaTypes.Mixed,
|
|
16
17
|
recipient: mongoose.SchemaTypes.Mixed,
|
|
17
18
|
result: mongoose.SchemaTypes.Mixed,
|
|
@@ -32,7 +33,8 @@ const schema = new mongoose.Schema({
|
|
|
32
33
|
id: true,
|
|
33
34
|
read: 'primaryPreferred',
|
|
34
35
|
writeConcern: writeConcern,
|
|
35
|
-
|
|
36
|
+
// true化(2022-11-12~)
|
|
37
|
+
strict: true,
|
|
36
38
|
useNestedStrict: true,
|
|
37
39
|
timestamps: {
|
|
38
40
|
createdAt: 'createdAt',
|
|
@@ -66,6 +68,12 @@ schema.index({ endDate: -1, startDate: -1 }, {
|
|
|
66
68
|
endDate: { $exists: true }
|
|
67
69
|
}
|
|
68
70
|
});
|
|
71
|
+
schema.index({ 'location.id': 1, startDate: -1 }, {
|
|
72
|
+
name: 'searchByLocationId',
|
|
73
|
+
partialFilterExpression: {
|
|
74
|
+
'location.id': { $exists: true }
|
|
75
|
+
}
|
|
76
|
+
});
|
|
69
77
|
schema.index({ 'location.identifier': 1, startDate: -1 }, {
|
|
70
78
|
name: 'searchByLocationIdentifier',
|
|
71
79
|
partialFilterExpression: {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as mongoose from 'mongoose';
|
|
2
|
+
declare const modelName = "AdditionalProperty";
|
|
3
|
+
/**
|
|
4
|
+
* 追加特性スキーマ
|
|
5
|
+
*/
|
|
6
|
+
declare const schema: mongoose.Schema<mongoose.Document<any, any, any>, mongoose.Model<mongoose.Document<any, any, any>, any, any>, undefined, {}>;
|
|
7
|
+
export { modelName, schema };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schema = exports.modelName = void 0;
|
|
4
|
+
const mongoose = require("mongoose");
|
|
5
|
+
const modelName = 'AdditionalProperty';
|
|
6
|
+
exports.modelName = modelName;
|
|
7
|
+
const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
|
|
8
|
+
/**
|
|
9
|
+
* 追加特性スキーマ
|
|
10
|
+
*/
|
|
11
|
+
const schema = new mongoose.Schema({
|
|
12
|
+
project: mongoose.SchemaTypes.Mixed,
|
|
13
|
+
typeOf: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
codeValue: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
inCodeSet: mongoose.SchemaTypes.Mixed,
|
|
22
|
+
name: mongoose.SchemaTypes.Mixed
|
|
23
|
+
}, {
|
|
24
|
+
collection: 'additionalProperties',
|
|
25
|
+
id: true,
|
|
26
|
+
read: 'primaryPreferred',
|
|
27
|
+
writeConcern: writeConcern,
|
|
28
|
+
strict: true,
|
|
29
|
+
useNestedStrict: true,
|
|
30
|
+
timestamps: {
|
|
31
|
+
createdAt: 'createdAt',
|
|
32
|
+
updatedAt: 'updatedAt'
|
|
33
|
+
},
|
|
34
|
+
toJSON: {
|
|
35
|
+
getters: false,
|
|
36
|
+
virtuals: false,
|
|
37
|
+
minimize: false,
|
|
38
|
+
versionKey: false
|
|
39
|
+
},
|
|
40
|
+
toObject: {
|
|
41
|
+
getters: false,
|
|
42
|
+
virtuals: true,
|
|
43
|
+
minimize: false,
|
|
44
|
+
versionKey: false
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
exports.schema = schema;
|
|
48
|
+
schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
|
|
49
|
+
schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
|
|
50
|
+
schema.index({ codeValue: 1 }, { name: 'searchByCodeValue' });
|
|
51
|
+
schema.index({ 'project.id': 1, codeValue: 1 }, {
|
|
52
|
+
name: 'searchByProjectId'
|
|
53
|
+
});
|
|
54
|
+
schema.index({ 'inCodeSet.identifier': 1, codeValue: 1 }, {
|
|
55
|
+
name: 'searchByInCodeSetIdentifier',
|
|
56
|
+
partialFilterExpression: {
|
|
57
|
+
'inCodeSet.identifier': { $exists: true }
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
schema.index({ 'name.ja': 1, codeValue: 1 }, {
|
|
61
|
+
name: 'searchByNameJa',
|
|
62
|
+
partialFilterExpression: {
|
|
63
|
+
'name.ja': { $exists: true }
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
schema.index({ 'name.en': 1, codeValue: 1 }, {
|
|
67
|
+
name: 'searchByNameEn',
|
|
68
|
+
partialFilterExpression: {
|
|
69
|
+
'name.en': { $exists: true }
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
mongoose.model(modelName, schema)
|
|
73
|
+
.on('index',
|
|
74
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
75
|
+
/* istanbul ignore next */
|
|
76
|
+
(error) => {
|
|
77
|
+
if (error !== undefined) {
|
|
78
|
+
// tslint:disable-next-line:no-console
|
|
79
|
+
console.error(error);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
@@ -185,6 +185,59 @@ schema.index({
|
|
|
185
185
|
},
|
|
186
186
|
name: 'searchByOffersItemOfferedId'
|
|
187
187
|
});
|
|
188
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
189
|
+
// TODO add index
|
|
190
|
+
schema.index({ 'offers.seller.makesOffer': 1, startDate: 1 }, {
|
|
191
|
+
name: 'searchBySellerMakesOffer',
|
|
192
|
+
partialFilterExpression: {
|
|
193
|
+
'offers.seller.makesOffer': { $exists: true }
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
// schema.index(
|
|
197
|
+
// { 'offers.seller.makesOffer.availableAtOrFrom.id': 1, startDate: 1 },
|
|
198
|
+
// {
|
|
199
|
+
// name: 'searchBySellerMakesOfferAvailableAtOrFromId',
|
|
200
|
+
// partialFilterExpression: {
|
|
201
|
+
// 'offers.seller.makesOffer.availableAtOrFrom.id': { $exists: true }
|
|
202
|
+
// }
|
|
203
|
+
// }
|
|
204
|
+
// );
|
|
205
|
+
// schema.index(
|
|
206
|
+
// { 'offers.seller.makesOffer.availabilityEnds': 1, startDate: 1 },
|
|
207
|
+
// {
|
|
208
|
+
// name: 'searchBySellerMakesOfferAvailabilityEnds',
|
|
209
|
+
// partialFilterExpression: {
|
|
210
|
+
// 'offers.seller.makesOffer.availabilityEnds': { $exists: true }
|
|
211
|
+
// }
|
|
212
|
+
// }
|
|
213
|
+
// );
|
|
214
|
+
// schema.index(
|
|
215
|
+
// { 'offers.seller.makesOffer.availabilityStarts': 1, startDate: 1 },
|
|
216
|
+
// {
|
|
217
|
+
// name: 'searchBySellerMakesOfferAvailabilityStarts',
|
|
218
|
+
// partialFilterExpression: {
|
|
219
|
+
// 'offers.seller.makesOffer.availabilityStarts': { $exists: true }
|
|
220
|
+
// }
|
|
221
|
+
// }
|
|
222
|
+
// );
|
|
223
|
+
// schema.index(
|
|
224
|
+
// { 'offers.seller.makesOffer.validThrough': 1, startDate: 1 },
|
|
225
|
+
// {
|
|
226
|
+
// name: 'searchBySellerMakesOfferValidThrough',
|
|
227
|
+
// partialFilterExpression: {
|
|
228
|
+
// 'offers.seller.makesOffer.validThrough': { $exists: true }
|
|
229
|
+
// }
|
|
230
|
+
// }
|
|
231
|
+
// );
|
|
232
|
+
// schema.index(
|
|
233
|
+
// { 'offers.seller.makesOffer.validFrom': 1, startDate: 1 },
|
|
234
|
+
// {
|
|
235
|
+
// name: 'searchBySellerMakesOfferValidFrom',
|
|
236
|
+
// partialFilterExpression: {
|
|
237
|
+
// 'offers.seller.makesOffer.validFrom': { $exists: true }
|
|
238
|
+
// }
|
|
239
|
+
// }
|
|
240
|
+
// );
|
|
188
241
|
schema.index({ 'videoFormat.typeOf': 1, startDate: 1 }, {
|
|
189
242
|
name: 'searchByVideoFormatTypeOf',
|
|
190
243
|
partialFilterExpression: {
|
|
@@ -89,6 +89,24 @@ schema.index({ 'parentOrganization.id': 1, branchCode: 1 }, {
|
|
|
89
89
|
'parentOrganization.id': { $exists: true }
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
+
schema.index({ 'containsPlace.branchCode': 1, branchCode: 1 }, {
|
|
93
|
+
name: 'searchByContainsPlaceBranchCode',
|
|
94
|
+
partialFilterExpression: {
|
|
95
|
+
'containsPlace.branchCode': { $exists: true }
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
schema.index({ 'containsPlace.containsPlace.branchCode': 1, branchCode: 1 }, {
|
|
99
|
+
name: 'searchByContainsPlaceContainsPlaceBranchCode',
|
|
100
|
+
partialFilterExpression: {
|
|
101
|
+
'containsPlace.containsPlace.branchCode': { $exists: true }
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
schema.index({ 'containsPlace.containsPlace.containsPlace.branchCode': 1, branchCode: 1 }, {
|
|
105
|
+
name: 'searchByContainsPlaceContainsPlaceContainsPlaceBranchCode',
|
|
106
|
+
partialFilterExpression: {
|
|
107
|
+
'containsPlace.containsPlace.containsPlace.branchCode': { $exists: true }
|
|
108
|
+
}
|
|
109
|
+
});
|
|
92
110
|
mongoose.model(modelName, schema)
|
|
93
111
|
.on('index',
|
|
94
112
|
// tslint:disable-next-line:no-single-line-block-comment
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -1036,5 +1036,10 @@ class MongoRepository {
|
|
|
1036
1036
|
.exec();
|
|
1037
1037
|
});
|
|
1038
1038
|
}
|
|
1039
|
+
getCursor(conditions, projection) {
|
|
1040
|
+
return this.placeModel.find(conditions, projection)
|
|
1041
|
+
.sort({ branchCode: factory.sortType.Ascending })
|
|
1042
|
+
.cursor();
|
|
1043
|
+
}
|
|
1039
1044
|
}
|
|
1040
1045
|
exports.MongoRepository = MongoRepository;
|
|
@@ -247,7 +247,24 @@ class MongoRepository {
|
|
|
247
247
|
*/
|
|
248
248
|
start(params) {
|
|
249
249
|
return __awaiter(this, void 0, void 0, function* () {
|
|
250
|
-
|
|
250
|
+
const startDate = new Date();
|
|
251
|
+
let expires;
|
|
252
|
+
if (params.typeOf === factory.transactionType.PlaceOrder
|
|
253
|
+
|| params.typeOf === factory.transactionType.ReturnOrder) {
|
|
254
|
+
// expiresInSecondsの指定があれば優先して適用する(2022-11-25~)
|
|
255
|
+
if (typeof params.expiresInSeconds === 'number' && params.expiresInSeconds > 0) {
|
|
256
|
+
expires = moment(startDate)
|
|
257
|
+
.add(params.expiresInSeconds, 'seconds')
|
|
258
|
+
.toDate();
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
throw new factory.errors.ArgumentNull('expiresInSeconds');
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
expires = params.expires;
|
|
266
|
+
}
|
|
267
|
+
return this.transactionModel.create(Object.assign(Object.assign({}, params), { typeOf: params.typeOf, status: factory.transactionStatusType.InProgress, startDate, endDate: undefined, expires, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported }))
|
|
251
268
|
.then((doc) => doc.toObject());
|
|
252
269
|
});
|
|
253
270
|
}
|
|
@@ -433,8 +450,7 @@ class MongoRepository {
|
|
|
433
450
|
return __awaiter(this, void 0, void 0, function* () {
|
|
434
451
|
yield this.transactionModel.findByIdAndUpdate(params.id, {
|
|
435
452
|
tasksExportationStatus: factory.transactionTasksExportationStatus.Exported,
|
|
436
|
-
tasksExportedAt:
|
|
437
|
-
.toDate()
|
|
453
|
+
tasksExportedAt: new Date()
|
|
438
454
|
})
|
|
439
455
|
.exec();
|
|
440
456
|
});
|
|
@@ -460,8 +476,7 @@ class MongoRepository {
|
|
|
460
476
|
*/
|
|
461
477
|
cancel(params) {
|
|
462
478
|
return __awaiter(this, void 0, void 0, function* () {
|
|
463
|
-
const endDate =
|
|
464
|
-
.toDate();
|
|
479
|
+
const endDate = new Date();
|
|
465
480
|
// 進行中ステータスの取引を中止する
|
|
466
481
|
const doc = yield this.transactionModel.findOneAndUpdate({
|
|
467
482
|
typeOf: params.typeOf,
|
|
@@ -7,6 +7,7 @@ import { MongoRepository as AccountingReportRepo } from './repo/accountingReport
|
|
|
7
7
|
import { MongoRepository as AccountTitleRepo } from './repo/accountTitle';
|
|
8
8
|
import { MongoRepository as AccountTransactionRepo } from './repo/accountTransaction';
|
|
9
9
|
import { MongoRepository as ActionRepo } from './repo/action';
|
|
10
|
+
import { MongoRepository as AdditionalPropertyRepo } from './repo/additionalProperty';
|
|
10
11
|
import { MongoRepository as AssetTransactionRepo } from './repo/assetTransaction';
|
|
11
12
|
import { MongoRepository as CategoryCodeRepo } from './repo/categoryCode';
|
|
12
13
|
import { MongoRepository as CodeRepo } from './repo/code';
|
|
@@ -65,6 +66,11 @@ export declare class AccountTransaction extends AccountTransactionRepo {
|
|
|
65
66
|
}
|
|
66
67
|
export declare class Action extends ActionRepo {
|
|
67
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* 追加特性リポジトリ
|
|
71
|
+
*/
|
|
72
|
+
export declare class AdditionalProperty extends AdditionalPropertyRepo {
|
|
73
|
+
}
|
|
68
74
|
export declare namespace action {
|
|
69
75
|
class RegisterServiceInProgress extends RegisterServiceActionInProgress {
|
|
70
76
|
}
|
package/lib/chevre/repository.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rateLimit = exports.itemAvailability = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.AccountAction = exports.Account = void 0;
|
|
3
|
+
exports.rateLimit = exports.itemAvailability = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.AccountAction = exports.Account = void 0;
|
|
4
4
|
// tslint:disable:max-classes-per-file completed-docs
|
|
5
5
|
/**
|
|
6
6
|
* リポジトリ
|
|
@@ -11,6 +11,7 @@ const accountingReport_1 = require("./repo/accountingReport");
|
|
|
11
11
|
const accountTitle_1 = require("./repo/accountTitle");
|
|
12
12
|
const accountTransaction_1 = require("./repo/accountTransaction");
|
|
13
13
|
const action_1 = require("./repo/action");
|
|
14
|
+
const additionalProperty_1 = require("./repo/additionalProperty");
|
|
14
15
|
const assetTransaction_1 = require("./repo/assetTransaction");
|
|
15
16
|
const categoryCode_1 = require("./repo/categoryCode");
|
|
16
17
|
const code_1 = require("./repo/code");
|
|
@@ -75,6 +76,12 @@ exports.AccountTransaction = AccountTransaction;
|
|
|
75
76
|
class Action extends action_1.MongoRepository {
|
|
76
77
|
}
|
|
77
78
|
exports.Action = Action;
|
|
79
|
+
/**
|
|
80
|
+
* 追加特性リポジトリ
|
|
81
|
+
*/
|
|
82
|
+
class AdditionalProperty extends additionalProperty_1.MongoRepository {
|
|
83
|
+
}
|
|
84
|
+
exports.AdditionalProperty = AdditionalProperty;
|
|
78
85
|
var action;
|
|
79
86
|
(function (action) {
|
|
80
87
|
class RegisterServiceInProgress extends registerServiceInProgress_1.RedisRepository {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as factory from '../factory';
|
|
6
6
|
import { MongoRepository as AccountRepo } from '../repo/account';
|
|
7
|
-
import { MongoRepository as AccountActionRepo } from '../repo/accountAction';
|
|
8
7
|
import { MongoRepository as AccountTransactionRepo } from '../repo/accountTransaction';
|
|
9
8
|
export declare type IOpenOperation<T> = (repos: {
|
|
10
9
|
account: AccountRepo;
|
|
@@ -52,8 +51,6 @@ export declare function close(params: {
|
|
|
52
51
|
*/
|
|
53
52
|
export declare function transferMoney(actionAttributes: factory.account.action.moneyTransfer.IAttributes): (repos: {
|
|
54
53
|
account: AccountRepo;
|
|
55
|
-
accountAction: AccountActionRepo;
|
|
56
|
-
accountTransaction: AccountTransactionRepo;
|
|
57
54
|
}) => Promise<void>;
|
|
58
55
|
/**
|
|
59
56
|
* 転送取消
|
|
@@ -66,6 +63,5 @@ export declare function cancelMoneyTransfer(params: {
|
|
|
66
63
|
};
|
|
67
64
|
}): (repos: {
|
|
68
65
|
account: AccountRepo;
|
|
69
|
-
accountAction: AccountActionRepo;
|
|
70
66
|
accountTransaction: AccountTransactionRepo;
|
|
71
67
|
}) => Promise<void>;
|
|
@@ -53,11 +53,13 @@ exports.close = close;
|
|
|
53
53
|
*/
|
|
54
54
|
function transferMoney(actionAttributes) {
|
|
55
55
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
|
|
56
|
+
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
57
|
+
// let action = await repos.accountAction.startByIdentifier<factory.actionType.MoneyTransfer>(actionAttributes);
|
|
57
58
|
// すでに完了していれば何もしない
|
|
58
|
-
if (action.actionStatus === factory.actionStatusType.CompletedActionStatus) {
|
|
59
|
-
|
|
60
|
-
}
|
|
59
|
+
// if (action.actionStatus === factory.actionStatusType.CompletedActionStatus) {
|
|
60
|
+
// return;
|
|
61
|
+
// }
|
|
62
|
+
const action = actionAttributes;
|
|
61
63
|
let fromAccountNumber;
|
|
62
64
|
let toAccountNumber;
|
|
63
65
|
try {
|
|
@@ -80,18 +82,17 @@ function transferMoney(actionAttributes) {
|
|
|
80
82
|
}
|
|
81
83
|
catch (error) {
|
|
82
84
|
// actionにエラー結果を追加
|
|
83
|
-
try {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
85
|
+
// try {
|
|
86
|
+
// const actionError = { ...error, message: error.message, name: error.name };
|
|
87
|
+
// await repos.accountAction.giveUp(action.typeOf, action.id, actionError);
|
|
88
|
+
// } catch (__) {
|
|
89
|
+
// // 失敗したら仕方ない
|
|
90
|
+
// }
|
|
90
91
|
throw error;
|
|
91
92
|
}
|
|
92
93
|
// アクション完了
|
|
93
|
-
const actionResult = {};
|
|
94
|
-
action =
|
|
94
|
+
// const actionResult: factory.account.action.moneyTransfer.IResult = {};
|
|
95
|
+
// action = await repos.accountAction.complete(action.typeOf, action.id, actionResult);
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
exports.transferMoney = transferMoney;
|
|
@@ -132,16 +133,17 @@ function cancelMoneyTransfer(params) {
|
|
|
132
133
|
: transaction.object.amount.value,
|
|
133
134
|
transactionId: transaction.id
|
|
134
135
|
});
|
|
136
|
+
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
135
137
|
// アクション取得
|
|
136
|
-
const actions =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}))
|
|
138
|
+
// const actions = await repos.accountAction.searchTransferActions({
|
|
139
|
+
// purpose: {
|
|
140
|
+
// typeOf: { $eq: transaction.typeOf },
|
|
141
|
+
// id: { $eq: transaction.id }
|
|
142
|
+
// }
|
|
143
|
+
// });
|
|
144
|
+
// await Promise.all(actions.map(async (action) => {
|
|
145
|
+
// await repos.accountAction.cancel(action.typeOf, action.id);
|
|
146
|
+
// }));
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
149
|
exports.cancelMoneyTransfer = cancelMoneyTransfer;
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as factory from '../../factory';
|
|
5
5
|
import { MongoRepository as AccountRepo } from '../../repo/account';
|
|
6
|
-
import { MongoRepository as AccountActionRepo } from '../../repo/accountAction';
|
|
7
6
|
import { MongoRepository as AccountTransactionRepo } from '../../repo/accountTransaction';
|
|
8
7
|
export declare type IStartOperation<T> = (repos: {
|
|
9
8
|
account: AccountRepo;
|
|
10
|
-
accountAction: AccountActionRepo;
|
|
11
9
|
accountTransaction: AccountTransactionRepo;
|
|
12
10
|
}) => Promise<T>;
|
|
13
11
|
/**
|
|
@@ -14,7 +14,6 @@ exports.start = void 0;
|
|
|
14
14
|
* 入金取引サービス
|
|
15
15
|
*/
|
|
16
16
|
const factory = require("../../factory");
|
|
17
|
-
const factory_1 = require("./factory");
|
|
18
17
|
/**
|
|
19
18
|
* 取引開始
|
|
20
19
|
*/
|
|
@@ -64,9 +63,10 @@ function start(params) {
|
|
|
64
63
|
accountNumber: params.object.toLocation.accountNumber,
|
|
65
64
|
transaction: pendingTransaction
|
|
66
65
|
});
|
|
66
|
+
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
67
67
|
// アクション開始
|
|
68
|
-
const moneyTransferActionAttributes =
|
|
69
|
-
|
|
68
|
+
// const moneyTransferActionAttributes = createMoneyTransferActionAttributes({ transaction });
|
|
69
|
+
// await repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
|
|
70
70
|
// 結果返却
|
|
71
71
|
return transaction;
|
|
72
72
|
});
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as factory from '../../factory';
|
|
5
5
|
import { MongoRepository as AccountRepo } from '../../repo/account';
|
|
6
|
-
import { MongoRepository as AccountActionRepo } from '../../repo/accountAction';
|
|
7
6
|
import { MongoRepository as AccountTransactionRepo } from '../../repo/accountTransaction';
|
|
8
7
|
export declare type IStartOperation<T> = (repos: {
|
|
9
8
|
account: AccountRepo;
|
|
10
|
-
accountAction: AccountActionRepo;
|
|
11
9
|
accountTransaction: AccountTransactionRepo;
|
|
12
10
|
}) => Promise<T>;
|
|
13
11
|
/**
|