@chevre/domain 20.2.0-alpha.2 → 20.2.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/aggregateEventReservation.ts +37 -0
- package/example/src/chevre/aggregation/aggregateSystem.ts +82 -0
- package/example/src/chevre/importEventsFromCOA.ts +8 -1
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +90 -0
- package/example/src/chevre/migrateEventOffersItemOfferedTypeOf.ts +0 -5
- package/example/src/chevre/migratePaymentServicePaymentUrlExpiresInSeconds.ts +77 -0
- package/lib/chevre/repo/action.d.ts +58 -0
- package/lib/chevre/repo/action.js +187 -0
- package/lib/chevre/repo/aggregation.d.ts +34 -0
- package/lib/chevre/repo/aggregation.js +64 -0
- package/lib/chevre/repo/event.d.ts +0 -1
- package/lib/chevre/repo/event.js +124 -105
- package/lib/chevre/repo/mongoose/model/aggregation.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/aggregation.js +47 -0
- package/lib/chevre/repo/mongoose/model/event.js +2 -2
- package/lib/chevre/repo/mongoose/model/telemetry.js +4 -28
- package/lib/chevre/repo/order.d.ts +9 -0
- package/lib/chevre/repo/order.js +49 -0
- package/lib/chevre/repo/place.d.ts +15 -1
- package/lib/chevre/repo/place.js +205 -52
- package/lib/chevre/repo/product.d.ts +1 -0
- package/lib/chevre/repo/product.js +5 -0
- package/lib/chevre/repo/reservation.d.ts +0 -6
- package/lib/chevre/repo/reservation.js +106 -66
- package/lib/chevre/repo/transaction.d.ts +29 -0
- package/lib/chevre/repo/transaction.js +133 -0
- package/lib/chevre/repo/trip.js +33 -27
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +34 -13
- package/lib/chevre/service/aggregation/system.d.ts +74 -0
- package/lib/chevre/service/aggregation/system.js +266 -0
- package/lib/chevre/service/aggregation.d.ts +2 -0
- package/lib/chevre/service/aggregation.js +3 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +2 -4
- package/lib/chevre/service/assetTransaction/pay.d.ts +19 -4
- package/lib/chevre/service/assetTransaction/pay.js +65 -32
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +3 -0
- package/lib/chevre/service/assetTransaction/reserve/factory.js +33 -2
- package/lib/chevre/service/assetTransaction/reserve.d.ts +7 -2
- package/lib/chevre/service/assetTransaction/reserve.js +33 -51
- package/lib/chevre/service/delivery/factory.js +1 -0
- package/lib/chevre/service/event.d.ts +2 -4
- package/lib/chevre/service/event.js +21 -10
- package/lib/chevre/service/offer/event/cancel.js +0 -1
- package/lib/chevre/service/offer/event/factory.js +25 -5
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +116 -4
- package/lib/chevre/service/offer/event/voidTransaction.js +0 -2
- package/lib/chevre/service/offer.js +28 -20
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +2 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +2 -1
- package/lib/chevre/service/order/placeOrder.js +16 -0
- package/lib/chevre/service/payment/any.d.ts +5 -0
- package/lib/chevre/service/reserve/confirmReservation.js +7 -10
- package/lib/chevre/service/reserve/useReservation.js +2 -1
- package/lib/chevre/service/task/confirmPayTransaction.js +20 -1
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +4 -0
- package/lib/chevre/service/task/confirmReserveTransaction.js +5 -5
- package/lib/chevre/service/task/importEventsFromCOA.js +3 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +42 -27
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +7 -2
- package/package.json +3 -3
- package/example/src/chevre/aggregateReservationOnProject.ts +0 -32
- package/example/src/chevre/migrateEventProjectAttributes.ts +0 -57
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +0 -162
package/lib/chevre/repo/place.js
CHANGED
|
@@ -32,15 +32,89 @@ class MongoRepository {
|
|
|
32
32
|
this.placeModel = connection.model(place_1.modelName);
|
|
33
33
|
}
|
|
34
34
|
// tslint:disable-next-line:max-func-body-length
|
|
35
|
+
static CREATE_BUS_STOP_MONGO_CONDITIONS(params) {
|
|
36
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
37
|
+
const andConditions = [{ typeOf: { $eq: factory.placeType.BusStop } }];
|
|
38
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
39
|
+
if (typeof projectIdEq === 'string') {
|
|
40
|
+
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
41
|
+
}
|
|
42
|
+
const branchCodeEq = (_c = params.branchCode) === null || _c === void 0 ? void 0 : _c.$eq;
|
|
43
|
+
if (typeof branchCodeEq === 'string') {
|
|
44
|
+
andConditions.push({
|
|
45
|
+
branchCode: {
|
|
46
|
+
$exists: true,
|
|
47
|
+
$eq: branchCodeEq
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const branchCodeRegex = (_d = params.branchCode) === null || _d === void 0 ? void 0 : _d.$regex;
|
|
52
|
+
if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
|
|
53
|
+
andConditions.push({
|
|
54
|
+
branchCode: {
|
|
55
|
+
$exists: true,
|
|
56
|
+
$regex: new RegExp(branchCodeRegex)
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const branchCodeIn = (_e = params.branchCode) === null || _e === void 0 ? void 0 : _e.$in;
|
|
61
|
+
if (Array.isArray(branchCodeIn)) {
|
|
62
|
+
andConditions.push({
|
|
63
|
+
branchCode: {
|
|
64
|
+
$exists: true,
|
|
65
|
+
$in: branchCodeIn
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
70
|
+
/* istanbul ignore else */
|
|
71
|
+
const idEq = (_f = params.id) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
72
|
+
if (typeof idEq === 'string') {
|
|
73
|
+
andConditions.push({
|
|
74
|
+
_id: {
|
|
75
|
+
$eq: idEq
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const idIn = (_g = params.id) === null || _g === void 0 ? void 0 : _g.$in;
|
|
80
|
+
if (Array.isArray(idIn)) {
|
|
81
|
+
andConditions.push({
|
|
82
|
+
_id: {
|
|
83
|
+
$in: idIn
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const nameRegex = (_h = params.name) === null || _h === void 0 ? void 0 : _h.$regex;
|
|
88
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
89
|
+
/* istanbul ignore else */
|
|
90
|
+
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
91
|
+
andConditions.push({
|
|
92
|
+
$or: [
|
|
93
|
+
{
|
|
94
|
+
'name.ja': {
|
|
95
|
+
$exists: true,
|
|
96
|
+
$regex: new RegExp(nameRegex)
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
'name.en': {
|
|
101
|
+
$exists: true,
|
|
102
|
+
$regex: new RegExp(nameRegex)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return andConditions;
|
|
109
|
+
}
|
|
110
|
+
// tslint:disable-next-line:max-func-body-length
|
|
35
111
|
static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params) {
|
|
36
112
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
37
113
|
// MongoDB検索条件
|
|
38
114
|
const andConditions = [{ typeOf: { $eq: factory.placeType.MovieTheater } }];
|
|
39
115
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
40
116
|
if (typeof projectIdEq === 'string') {
|
|
41
|
-
andConditions.push({
|
|
42
|
-
'project.id': { $eq: projectIdEq }
|
|
43
|
-
});
|
|
117
|
+
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
44
118
|
}
|
|
45
119
|
const branchCodeEq = (_c = params.branchCode) === null || _c === void 0 ? void 0 : _c.$eq;
|
|
46
120
|
if (typeof branchCodeEq === 'string') {
|
|
@@ -173,6 +247,7 @@ class MongoRepository {
|
|
|
173
247
|
findMovieTheaterByBranchCode(params) {
|
|
174
248
|
return __awaiter(this, void 0, void 0, function* () {
|
|
175
249
|
return this.placeModel.findOne({
|
|
250
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
176
251
|
'project.id': { $eq: params.project.id },
|
|
177
252
|
branchCode: { $eq: params.branchCode }
|
|
178
253
|
})
|
|
@@ -185,14 +260,12 @@ class MongoRepository {
|
|
|
185
260
|
});
|
|
186
261
|
});
|
|
187
262
|
}
|
|
188
|
-
countMovieTheaters(params) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
});
|
|
195
|
-
}
|
|
263
|
+
// public async countMovieTheaters(params: factory.place.movieTheater.ISearchConditions): Promise<number> {
|
|
264
|
+
// const conditions = MongoRepository.CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params);
|
|
265
|
+
// return this.placeModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
266
|
+
// .setOptions({ maxTimeMS: 10000 })
|
|
267
|
+
// .exec();
|
|
268
|
+
// }
|
|
196
269
|
/**
|
|
197
270
|
* 施設検索
|
|
198
271
|
*/
|
|
@@ -226,7 +299,10 @@ class MongoRepository {
|
|
|
226
299
|
*/
|
|
227
300
|
findById(params, projection) {
|
|
228
301
|
return __awaiter(this, void 0, void 0, function* () {
|
|
229
|
-
const doc = yield this.placeModel.findOne({
|
|
302
|
+
const doc = yield this.placeModel.findOne({
|
|
303
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
304
|
+
_id: { $eq: params.id }
|
|
305
|
+
}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection))
|
|
230
306
|
.exec();
|
|
231
307
|
if (doc === null) {
|
|
232
308
|
throw new factory.errors.NotFound(this.placeModel.modelName);
|
|
@@ -237,7 +313,8 @@ class MongoRepository {
|
|
|
237
313
|
deleteMovieTheaterById(params) {
|
|
238
314
|
return __awaiter(this, void 0, void 0, function* () {
|
|
239
315
|
yield this.placeModel.findOneAndDelete({
|
|
240
|
-
|
|
316
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
317
|
+
_id: { $eq: params.id }
|
|
241
318
|
})
|
|
242
319
|
.exec()
|
|
243
320
|
.then((doc) => {
|
|
@@ -435,22 +512,17 @@ class MongoRepository {
|
|
|
435
512
|
}
|
|
436
513
|
// tslint:disable-next-line:max-func-body-length
|
|
437
514
|
searchScreeningRoomSections(searchConditions) {
|
|
438
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
515
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
439
516
|
return __awaiter(this, void 0, void 0, function* () {
|
|
440
|
-
const matchStages = [];
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
'project.id': { $eq: searchConditions.project.id.$eq }
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
}
|
|
517
|
+
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.MovieTheater } } }];
|
|
518
|
+
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
519
|
+
if (typeof projectIdEq === 'string') {
|
|
520
|
+
matchStages.push({
|
|
521
|
+
$match: { 'project.id': { $eq: projectIdEq } }
|
|
522
|
+
});
|
|
451
523
|
}
|
|
452
524
|
// 施設コード
|
|
453
|
-
const movieTheaterBranchCodeEq = (
|
|
525
|
+
const movieTheaterBranchCodeEq = (_e = (_d = (_c = searchConditions.containedInPlace) === null || _c === void 0 ? void 0 : _c.containedInPlace) === null || _d === void 0 ? void 0 : _d.branchCode) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
454
526
|
if (typeof movieTheaterBranchCodeEq === 'string') {
|
|
455
527
|
matchStages.push({
|
|
456
528
|
$match: {
|
|
@@ -462,7 +534,7 @@ class MongoRepository {
|
|
|
462
534
|
});
|
|
463
535
|
}
|
|
464
536
|
// スクリーンコード
|
|
465
|
-
const containedInPlaceBranchCodeEq = (
|
|
537
|
+
const containedInPlaceBranchCodeEq = (_g = (_f = searchConditions.containedInPlace) === null || _f === void 0 ? void 0 : _f.branchCode) === null || _g === void 0 ? void 0 : _g.$eq;
|
|
466
538
|
if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
467
539
|
matchStages.push({
|
|
468
540
|
$match: {
|
|
@@ -474,7 +546,7 @@ class MongoRepository {
|
|
|
474
546
|
});
|
|
475
547
|
}
|
|
476
548
|
// セクションコード
|
|
477
|
-
const sectionBranchCodeEq = (
|
|
549
|
+
const sectionBranchCodeEq = (_h = searchConditions === null || searchConditions === void 0 ? void 0 : searchConditions.branchCode) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
478
550
|
if (typeof sectionBranchCodeEq === 'string') {
|
|
479
551
|
matchStages.push({
|
|
480
552
|
$match: {
|
|
@@ -485,7 +557,7 @@ class MongoRepository {
|
|
|
485
557
|
}
|
|
486
558
|
});
|
|
487
559
|
}
|
|
488
|
-
const nameCodeRegex = (
|
|
560
|
+
const nameCodeRegex = (_j = searchConditions.name) === null || _j === void 0 ? void 0 : _j.$regex;
|
|
489
561
|
if (typeof nameCodeRegex === 'string') {
|
|
490
562
|
matchStages.push({
|
|
491
563
|
$match: {
|
|
@@ -506,7 +578,7 @@ class MongoRepository {
|
|
|
506
578
|
}
|
|
507
579
|
});
|
|
508
580
|
}
|
|
509
|
-
const branchCodeRegex = (
|
|
581
|
+
const branchCodeRegex = (_k = searchConditions.branchCode) === null || _k === void 0 ? void 0 : _k.$regex;
|
|
510
582
|
if (typeof branchCodeRegex === 'string') {
|
|
511
583
|
matchStages.push({
|
|
512
584
|
$match: {
|
|
@@ -517,7 +589,7 @@ class MongoRepository {
|
|
|
517
589
|
}
|
|
518
590
|
});
|
|
519
591
|
}
|
|
520
|
-
const additionalPropertyElemMatch = (
|
|
592
|
+
const additionalPropertyElemMatch = (_l = searchConditions.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
|
|
521
593
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
522
594
|
matchStages.push({
|
|
523
595
|
$match: {
|
|
@@ -543,7 +615,7 @@ class MongoRepository {
|
|
|
543
615
|
branchCode: '$branchCode',
|
|
544
616
|
name: '$name'
|
|
545
617
|
}
|
|
546
|
-
}, additionalProperty: '$containsPlace.containsPlace.additionalProperty' }, (((
|
|
618
|
+
}, additionalProperty: '$containsPlace.containsPlace.additionalProperty' }, (((_m = searchConditions.$projection) === null || _m === void 0 ? void 0 : _m.seatCount) === 1)
|
|
547
619
|
? {
|
|
548
620
|
seatCount: {
|
|
549
621
|
$cond: {
|
|
@@ -595,7 +667,7 @@ class MongoRepository {
|
|
|
595
667
|
searchScreeningRooms(searchConditions) {
|
|
596
668
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
597
669
|
return __awaiter(this, void 0, void 0, function* () {
|
|
598
|
-
const matchStages = [];
|
|
670
|
+
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.MovieTheater } } }];
|
|
599
671
|
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
600
672
|
if (typeof projectIdEq === 'string') {
|
|
601
673
|
matchStages.push({
|
|
@@ -855,21 +927,16 @@ class MongoRepository {
|
|
|
855
927
|
}
|
|
856
928
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
857
929
|
searchSeats(params) {
|
|
858
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
930
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
859
931
|
return __awaiter(this, void 0, void 0, function* () {
|
|
860
|
-
const matchStages = [];
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
'project.id': { $eq: params.project.id.$eq }
|
|
867
|
-
}
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
}
|
|
932
|
+
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.MovieTheater } } }];
|
|
933
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
934
|
+
if (typeof projectIdEq === 'string') {
|
|
935
|
+
matchStages.push({
|
|
936
|
+
$match: { 'project.id': { $eq: projectIdEq } }
|
|
937
|
+
});
|
|
871
938
|
}
|
|
872
|
-
const containedInPlaceBranchCodeEq = (
|
|
939
|
+
const containedInPlaceBranchCodeEq = (_d = (_c = params.containedInPlace) === null || _c === void 0 ? void 0 : _c.branchCode) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
873
940
|
if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
874
941
|
matchStages.push({
|
|
875
942
|
$match: {
|
|
@@ -880,7 +947,7 @@ class MongoRepository {
|
|
|
880
947
|
}
|
|
881
948
|
});
|
|
882
949
|
}
|
|
883
|
-
const containedInPlaceBranchCodeIn = (
|
|
950
|
+
const containedInPlaceBranchCodeIn = (_f = (_e = params.containedInPlace) === null || _e === void 0 ? void 0 : _e.branchCode) === null || _f === void 0 ? void 0 : _f.$in;
|
|
884
951
|
if (Array.isArray(containedInPlaceBranchCodeIn)) {
|
|
885
952
|
matchStages.push({
|
|
886
953
|
$match: {
|
|
@@ -934,7 +1001,7 @@ class MongoRepository {
|
|
|
934
1001
|
});
|
|
935
1002
|
}
|
|
936
1003
|
}
|
|
937
|
-
const branchCodeIn = (
|
|
1004
|
+
const branchCodeIn = (_g = params.branchCode) === null || _g === void 0 ? void 0 : _g.$in;
|
|
938
1005
|
if (Array.isArray(branchCodeIn)) {
|
|
939
1006
|
matchStages.push({
|
|
940
1007
|
$match: {
|
|
@@ -945,7 +1012,7 @@ class MongoRepository {
|
|
|
945
1012
|
}
|
|
946
1013
|
});
|
|
947
1014
|
}
|
|
948
|
-
const branchCodeRegex = (
|
|
1015
|
+
const branchCodeRegex = (_h = params.branchCode) === null || _h === void 0 ? void 0 : _h.$regex;
|
|
949
1016
|
if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
|
|
950
1017
|
matchStages.push({
|
|
951
1018
|
$match: {
|
|
@@ -956,7 +1023,7 @@ class MongoRepository {
|
|
|
956
1023
|
}
|
|
957
1024
|
});
|
|
958
1025
|
}
|
|
959
|
-
const nameRegex = (
|
|
1026
|
+
const nameRegex = (_j = params.name) === null || _j === void 0 ? void 0 : _j.$regex;
|
|
960
1027
|
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
961
1028
|
matchStages.push({
|
|
962
1029
|
$match: {
|
|
@@ -977,7 +1044,7 @@ class MongoRepository {
|
|
|
977
1044
|
}
|
|
978
1045
|
});
|
|
979
1046
|
}
|
|
980
|
-
const seatingTypeEq = (
|
|
1047
|
+
const seatingTypeEq = (_k = params.seatingType) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
981
1048
|
if (typeof seatingTypeEq === 'string') {
|
|
982
1049
|
matchStages.push({
|
|
983
1050
|
$match: {
|
|
@@ -993,7 +1060,7 @@ class MongoRepository {
|
|
|
993
1060
|
&& params.$projection['containedInPlace.containedInPlace'] === 0) {
|
|
994
1061
|
includeScreeningRooms = false;
|
|
995
1062
|
}
|
|
996
|
-
const additionalPropertyElemMatch = (
|
|
1063
|
+
const additionalPropertyElemMatch = (_l = params.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
|
|
997
1064
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
998
1065
|
matchStages.push({
|
|
999
1066
|
$match: {
|
|
@@ -1078,6 +1145,92 @@ class MongoRepository {
|
|
|
1078
1145
|
.exec();
|
|
1079
1146
|
});
|
|
1080
1147
|
}
|
|
1148
|
+
saveBusStop(params) {
|
|
1149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1150
|
+
let doc;
|
|
1151
|
+
if (typeof params.id !== 'string' || params.id.length === 0) {
|
|
1152
|
+
doc = yield this.placeModel.create(params);
|
|
1153
|
+
}
|
|
1154
|
+
else {
|
|
1155
|
+
// 上書き禁止属性を除外(2022-08-24~)
|
|
1156
|
+
const { id, branchCode, project, typeOf } = params, updateFields = __rest(params, ["id", "branchCode", "project", "typeOf"]);
|
|
1157
|
+
doc = yield this.placeModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
|
|
1158
|
+
.exec();
|
|
1159
|
+
}
|
|
1160
|
+
if (doc === null) {
|
|
1161
|
+
throw new factory.errors.NotFound(this.placeModel.modelName);
|
|
1162
|
+
}
|
|
1163
|
+
return doc.toObject();
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
findBusStopByBranchCode(params) {
|
|
1167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1168
|
+
return this.placeModel.findOne({
|
|
1169
|
+
typeOf: { $eq: factory.placeType.BusStop },
|
|
1170
|
+
'project.id': { $eq: params.project.id },
|
|
1171
|
+
branchCode: { $eq: params.branchCode }
|
|
1172
|
+
})
|
|
1173
|
+
.exec()
|
|
1174
|
+
.then((doc) => {
|
|
1175
|
+
if (doc === null) {
|
|
1176
|
+
throw new factory.errors.NotFound(`${factory.placeType.BusStop} ${params.branchCode}`);
|
|
1177
|
+
}
|
|
1178
|
+
return doc.toObject();
|
|
1179
|
+
});
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
searchBusStops(params) {
|
|
1183
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1184
|
+
const conditions = MongoRepository.CREATE_BUS_STOP_MONGO_CONDITIONS(params);
|
|
1185
|
+
// containsPlaceを含めるとデータサイズが大きくなるので、検索結果には含めない
|
|
1186
|
+
const query = this.placeModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
|
|
1187
|
+
__v: 0,
|
|
1188
|
+
createdAt: 0,
|
|
1189
|
+
updatedAt: 0,
|
|
1190
|
+
containsPlace: 0
|
|
1191
|
+
});
|
|
1192
|
+
if (typeof params.limit === 'number') {
|
|
1193
|
+
const page = (typeof params.page === 'number') ? params.page : 1;
|
|
1194
|
+
query.limit(params.limit)
|
|
1195
|
+
.skip(params.limit * (page - 1));
|
|
1196
|
+
}
|
|
1197
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
1198
|
+
/* istanbul ignore else */
|
|
1199
|
+
if (params.sort !== undefined) {
|
|
1200
|
+
query.sort(params.sort);
|
|
1201
|
+
}
|
|
1202
|
+
return query.setOptions({ maxTimeMS: 10000 })
|
|
1203
|
+
.exec()
|
|
1204
|
+
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
findBusStopById(params, projection) {
|
|
1208
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1209
|
+
const doc = yield this.placeModel.findOne({
|
|
1210
|
+
typeOf: { $eq: factory.placeType.BusStop },
|
|
1211
|
+
_id: { $eq: params.id }
|
|
1212
|
+
}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection))
|
|
1213
|
+
.exec();
|
|
1214
|
+
if (doc === null) {
|
|
1215
|
+
throw new factory.errors.NotFound(this.placeModel.modelName);
|
|
1216
|
+
}
|
|
1217
|
+
return doc.toObject();
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
deleteBusStopById(params) {
|
|
1221
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1222
|
+
yield this.placeModel.findOneAndDelete({
|
|
1223
|
+
typeOf: { $eq: factory.placeType.BusStop },
|
|
1224
|
+
_id: { $eq: params.id }
|
|
1225
|
+
})
|
|
1226
|
+
.exec()
|
|
1227
|
+
.then((doc) => {
|
|
1228
|
+
if (doc === null) {
|
|
1229
|
+
throw new factory.errors.NotFound(this.placeModel.modelName);
|
|
1230
|
+
}
|
|
1231
|
+
});
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1081
1234
|
getCursor(conditions, projection) {
|
|
1082
1235
|
return this.placeModel.find(conditions, projection)
|
|
1083
1236
|
.sort({ branchCode: factory.sortType.Ascending })
|
|
@@ -251,5 +251,10 @@ class MongoRepository {
|
|
|
251
251
|
.exec();
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
|
+
getCursor(conditions, projection) {
|
|
255
|
+
return this.productModel.find(conditions, projection)
|
|
256
|
+
.sort({ productID: factory.sortType.Ascending })
|
|
257
|
+
.cursor();
|
|
258
|
+
}
|
|
254
259
|
}
|
|
255
260
|
exports.MongoRepository = MongoRepository;
|
|
@@ -30,12 +30,6 @@ export declare class MongoRepository {
|
|
|
30
30
|
/**
|
|
31
31
|
* 予約確定
|
|
32
32
|
*/
|
|
33
|
-
confirm<T extends factory.reservationType>(params: {
|
|
34
|
-
id: string;
|
|
35
|
-
previousReservationStatus: factory.reservationStatusType;
|
|
36
|
-
underName?: factory.reservation.IUnderName<T>;
|
|
37
|
-
reservedTicket?: factory.reservation.ITicket;
|
|
38
|
-
}): Promise<factory.reservation.IReservation<T>>;
|
|
39
33
|
confirmByReservationNumber(params: {
|
|
40
34
|
reservationNumber: string;
|
|
41
35
|
previousReservationStatus: factory.reservationStatusType;
|