@chevre/domain 20.2.0-alpha.8 → 20.2.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/aggregateEventReservation.ts +37 -0
- package/example/src/chevre/aggregation/aggregateSystem.ts +116 -0
- package/example/src/chevre/attendIfNotAttended.ts +22 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +209 -0
- package/example/src/chevre/findByOrderNumberAndReservationId.ts +20 -0
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +27 -0
- package/example/src/chevre/importEventsFromCOA.ts +8 -1
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +2 -1
- package/example/src/chevre/migrateOwnershipInfos2newUserPool.ts +1 -1
- package/example/src/chevre/migrateProjectSubscription.ts +51 -0
- package/example/src/chevre/ownershipInfosCsv2peopleJson.ts +2 -2
- package/example/src/chevre/processReserve.ts +2 -0
- package/example/src/chevre/searchEventIds.ts +24 -0
- package/example/src/chevre/searchEventTicketOffers.ts +5 -4
- package/example/src/chevre/searchEvents.ts +20 -41
- package/example/src/chevre/searchOffersByCatalog.ts +27 -0
- package/example/src/chevre/updateTransaction.ts +38 -0
- package/lib/chevre/factory/event.d.ts +2 -0
- package/lib/chevre/factory/event.js +2 -0
- package/lib/chevre/repo/action.d.ts +77 -1
- package/lib/chevre/repo/action.js +249 -6
- package/lib/chevre/repo/aggregation.d.ts +38 -0
- package/lib/chevre/repo/aggregation.js +68 -0
- package/lib/chevre/repo/assetTransaction.d.ts +32 -0
- package/lib/chevre/repo/assetTransaction.js +148 -0
- package/lib/chevre/repo/code.d.ts +13 -16
- package/lib/chevre/repo/code.js +33 -19
- package/lib/chevre/repo/creativeWork.js +13 -12
- package/lib/chevre/repo/event.d.ts +64 -17
- package/lib/chevre/repo/event.js +456 -156
- 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 +4 -3
- package/lib/chevre/repo/mongoose/model/offer.js +2 -1
- package/lib/chevre/repo/mongoose/model/project.js +7 -1
- package/lib/chevre/repo/mongoose/model/telemetry.js +4 -28
- package/lib/chevre/repo/offer.d.ts +10 -0
- package/lib/chevre/repo/offer.js +47 -16
- package/lib/chevre/repo/order.d.ts +6 -0
- package/lib/chevre/repo/order.js +53 -7
- package/lib/chevre/repo/place.d.ts +26 -1
- package/lib/chevre/repo/place.js +216 -12
- package/lib/chevre/repo/product.d.ts +1 -0
- package/lib/chevre/repo/product.js +5 -0
- package/lib/chevre/repo/project.d.ts +7 -1
- package/lib/chevre/repo/project.js +15 -6
- package/lib/chevre/repo/reservation.d.ts +7 -8
- package/lib/chevre/repo/reservation.js +181 -76
- package/lib/chevre/repo/task.d.ts +31 -4
- package/lib/chevre/repo/task.js +146 -33
- package/lib/chevre/repo/transaction.d.ts +57 -5
- package/lib/chevre/repo/transaction.js +228 -34
- 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.js +86 -68
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +5 -8
- package/lib/chevre/service/aggregation/system.d.ts +100 -0
- package/lib/chevre/service/aggregation/system.js +409 -0
- package/lib/chevre/service/aggregation.d.ts +2 -0
- package/lib/chevre/service/aggregation.js +3 -1
- package/lib/chevre/service/assetTransaction/pay/movieTicket/validation.js +5 -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/registerService.js +4 -1
- 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/validateStartRequest.d.ts +16 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +84 -0
- package/lib/chevre/service/assetTransaction/reserve.d.ts +38 -6
- package/lib/chevre/service/assetTransaction/reserve.js +120 -94
- package/lib/chevre/service/assetTransaction.d.ts +1 -1
- package/lib/chevre/service/code.d.ts +2 -3
- package/lib/chevre/service/delivery/factory.d.ts +1 -1
- package/lib/chevre/service/delivery/product/factory.js +9 -3
- package/lib/chevre/service/event.d.ts +2 -4
- package/lib/chevre/service/event.js +35 -14
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -7
- package/lib/chevre/service/offer/event/authorize.js +33 -87
- package/lib/chevre/service/offer/event/cancel.js +0 -1
- package/lib/chevre/service/offer/event/factory.d.ts +3 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +14 -7
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +95 -53
- package/lib/chevre/service/offer/event/voidTransaction.js +0 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA.js +10 -2
- package/lib/chevre/service/offer/factory.js +10 -3
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +1 -0
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/offer/product.d.ts +1 -0
- package/lib/chevre/service/offer/product.js +7 -2
- package/lib/chevre/service/offer.d.ts +13 -2
- package/lib/chevre/service/offer.js +68 -46
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +25 -27
- package/lib/chevre/service/order/onOrderStatusChanged.js +2 -1
- package/lib/chevre/service/order/placeOrder.js +16 -0
- package/lib/chevre/service/order/returnOrder.js +6 -4
- package/lib/chevre/service/order/sendOrder.js +4 -2
- package/lib/chevre/service/payment/any.d.ts +9 -0
- package/lib/chevre/service/payment/any.js +16 -1
- package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket.js +8 -2
- package/lib/chevre/service/product.js +5 -3
- package/lib/chevre/service/report/telemetry.js +1 -1
- package/lib/chevre/service/reserve/checkInReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.js +7 -10
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +32 -35
- package/lib/chevre/service/reserve/useReservation.d.ts +0 -3
- package/lib/chevre/service/reserve/useReservation.js +58 -32
- 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/task/returnPayTransaction.js +10 -4
- package/lib/chevre/service/task.js +6 -9
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.d.ts +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +6 -6
- package/lib/chevre/service/transaction/placeOrder.js +5 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +0 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +2 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +3 -8
- package/lib/chevre/service/transaction/placeOrderInProgress.js +92 -107
- package/lib/chevre/service/transaction/returnOrder.js +8 -6
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +20 -12
- package/package.json +3 -3
- package/CHANGELOG.md +0 -2030
- package/example/.gitignore +0 -1
- package/example/src/chevre/.gitignore +0 -1
- package/example/src/chevre/aggregateReservationOnProject.ts +0 -32
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +0 -162
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmPay.d.ts +0 -6
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmPay.js +0 -65
package/lib/chevre/repo/place.js
CHANGED
|
@@ -32,6 +32,82 @@ 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検索条件
|
|
@@ -171,8 +247,13 @@ class MongoRepository {
|
|
|
171
247
|
findMovieTheaterByBranchCode(params) {
|
|
172
248
|
return __awaiter(this, void 0, void 0, function* () {
|
|
173
249
|
return this.placeModel.findOne({
|
|
250
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
174
251
|
'project.id': { $eq: params.project.id },
|
|
175
252
|
branchCode: { $eq: params.branchCode }
|
|
253
|
+
}, {
|
|
254
|
+
__v: 0,
|
|
255
|
+
createdAt: 0,
|
|
256
|
+
updatedAt: 0
|
|
176
257
|
})
|
|
177
258
|
.exec()
|
|
178
259
|
.then((doc) => {
|
|
@@ -183,14 +264,6 @@ class MongoRepository {
|
|
|
183
264
|
});
|
|
184
265
|
});
|
|
185
266
|
}
|
|
186
|
-
countMovieTheaters(params) {
|
|
187
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
-
const conditions = MongoRepository.CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params);
|
|
189
|
-
return this.placeModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
190
|
-
.setOptions({ maxTimeMS: 10000 })
|
|
191
|
-
.exec();
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
267
|
/**
|
|
195
268
|
* 施設検索
|
|
196
269
|
*/
|
|
@@ -224,7 +297,10 @@ class MongoRepository {
|
|
|
224
297
|
*/
|
|
225
298
|
findById(params, projection) {
|
|
226
299
|
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
-
const doc = yield this.placeModel.findOne({
|
|
300
|
+
const doc = yield this.placeModel.findOne({
|
|
301
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
302
|
+
_id: { $eq: params.id }
|
|
303
|
+
}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection))
|
|
228
304
|
.exec();
|
|
229
305
|
if (doc === null) {
|
|
230
306
|
throw new factory.errors.NotFound(this.placeModel.modelName);
|
|
@@ -235,7 +311,8 @@ class MongoRepository {
|
|
|
235
311
|
deleteMovieTheaterById(params) {
|
|
236
312
|
return __awaiter(this, void 0, void 0, function* () {
|
|
237
313
|
yield this.placeModel.findOneAndDelete({
|
|
238
|
-
|
|
314
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
315
|
+
_id: { $eq: params.id }
|
|
239
316
|
})
|
|
240
317
|
.exec()
|
|
241
318
|
.then((doc) => {
|
|
@@ -454,7 +531,7 @@ class MongoRepository {
|
|
|
454
531
|
}
|
|
455
532
|
});
|
|
456
533
|
}
|
|
457
|
-
//
|
|
534
|
+
// ルームコード
|
|
458
535
|
const containedInPlaceBranchCodeEq = (_g = (_f = searchConditions.containedInPlace) === null || _f === void 0 ? void 0 : _f.branchCode) === null || _g === void 0 ? void 0 : _g.$eq;
|
|
459
536
|
if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
460
537
|
matchStages.push({
|
|
@@ -619,7 +696,7 @@ class MongoRepository {
|
|
|
619
696
|
}
|
|
620
697
|
}
|
|
621
698
|
}
|
|
622
|
-
//
|
|
699
|
+
// ルームコード
|
|
623
700
|
if (searchConditions.branchCode !== undefined) {
|
|
624
701
|
if (typeof searchConditions.branchCode.$eq === 'string') {
|
|
625
702
|
matchStages.push({
|
|
@@ -735,6 +812,47 @@ class MongoRepository {
|
|
|
735
812
|
return aggregate.exec();
|
|
736
813
|
});
|
|
737
814
|
}
|
|
815
|
+
findScreeningRoomsByBranchCode(params) {
|
|
816
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
817
|
+
const matchStages = [
|
|
818
|
+
{ $match: { typeOf: { $eq: factory.placeType.MovieTheater } } },
|
|
819
|
+
{
|
|
820
|
+
$match: { _id: { $eq: mongoose_1.Types.ObjectId(params.containedInPlace.id.$eq) } }
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
$match: { 'containsPlace.branchCode': { $exists: true, $eq: params.branchCode.$eq } }
|
|
824
|
+
}
|
|
825
|
+
];
|
|
826
|
+
const aggregate = this.placeModel.aggregate([
|
|
827
|
+
{ $unwind: '$containsPlace' },
|
|
828
|
+
...matchStages,
|
|
829
|
+
{
|
|
830
|
+
$project: {
|
|
831
|
+
_id: 0,
|
|
832
|
+
typeOf: '$containsPlace.typeOf',
|
|
833
|
+
branchCode: '$containsPlace.branchCode',
|
|
834
|
+
name: '$containsPlace.name',
|
|
835
|
+
// address: '$containsPlace.address',
|
|
836
|
+
// containedInPlace: {
|
|
837
|
+
// id: '$_id',
|
|
838
|
+
// typeOf: '$typeOf',
|
|
839
|
+
// branchCode: '$branchCode',
|
|
840
|
+
// name: '$name'
|
|
841
|
+
// },
|
|
842
|
+
// openSeatingAllowed: '$containsPlace.openSeatingAllowed',
|
|
843
|
+
// additionalProperty: '$containsPlace.additionalProperty',
|
|
844
|
+
containsPlace: '$containsPlace.containsPlace'
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
]);
|
|
848
|
+
const docs = yield aggregate.limit(1)
|
|
849
|
+
.exec();
|
|
850
|
+
if (docs.length < 1) {
|
|
851
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
852
|
+
}
|
|
853
|
+
return docs[0];
|
|
854
|
+
});
|
|
855
|
+
}
|
|
738
856
|
createSeat(seat) {
|
|
739
857
|
var _a, _b;
|
|
740
858
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1066,6 +1184,92 @@ class MongoRepository {
|
|
|
1066
1184
|
.exec();
|
|
1067
1185
|
});
|
|
1068
1186
|
}
|
|
1187
|
+
saveBusStop(params) {
|
|
1188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1189
|
+
let doc;
|
|
1190
|
+
if (typeof params.id !== 'string' || params.id.length === 0) {
|
|
1191
|
+
doc = yield this.placeModel.create(params);
|
|
1192
|
+
}
|
|
1193
|
+
else {
|
|
1194
|
+
// 上書き禁止属性を除外(2022-08-24~)
|
|
1195
|
+
const { id, branchCode, project, typeOf } = params, updateFields = __rest(params, ["id", "branchCode", "project", "typeOf"]);
|
|
1196
|
+
doc = yield this.placeModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
|
|
1197
|
+
.exec();
|
|
1198
|
+
}
|
|
1199
|
+
if (doc === null) {
|
|
1200
|
+
throw new factory.errors.NotFound(this.placeModel.modelName);
|
|
1201
|
+
}
|
|
1202
|
+
return doc.toObject();
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
findBusStopByBranchCode(params) {
|
|
1206
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1207
|
+
return this.placeModel.findOne({
|
|
1208
|
+
typeOf: { $eq: factory.placeType.BusStop },
|
|
1209
|
+
'project.id': { $eq: params.project.id },
|
|
1210
|
+
branchCode: { $eq: params.branchCode }
|
|
1211
|
+
})
|
|
1212
|
+
.exec()
|
|
1213
|
+
.then((doc) => {
|
|
1214
|
+
if (doc === null) {
|
|
1215
|
+
throw new factory.errors.NotFound(`${factory.placeType.BusStop} ${params.branchCode}`);
|
|
1216
|
+
}
|
|
1217
|
+
return doc.toObject();
|
|
1218
|
+
});
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
searchBusStops(params) {
|
|
1222
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1223
|
+
const conditions = MongoRepository.CREATE_BUS_STOP_MONGO_CONDITIONS(params);
|
|
1224
|
+
// containsPlaceを含めるとデータサイズが大きくなるので、検索結果には含めない
|
|
1225
|
+
const query = this.placeModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
|
|
1226
|
+
__v: 0,
|
|
1227
|
+
createdAt: 0,
|
|
1228
|
+
updatedAt: 0,
|
|
1229
|
+
containsPlace: 0
|
|
1230
|
+
});
|
|
1231
|
+
if (typeof params.limit === 'number') {
|
|
1232
|
+
const page = (typeof params.page === 'number') ? params.page : 1;
|
|
1233
|
+
query.limit(params.limit)
|
|
1234
|
+
.skip(params.limit * (page - 1));
|
|
1235
|
+
}
|
|
1236
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
1237
|
+
/* istanbul ignore else */
|
|
1238
|
+
if (params.sort !== undefined) {
|
|
1239
|
+
query.sort(params.sort);
|
|
1240
|
+
}
|
|
1241
|
+
return query.setOptions({ maxTimeMS: 10000 })
|
|
1242
|
+
.exec()
|
|
1243
|
+
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
findBusStopById(params, projection) {
|
|
1247
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1248
|
+
const doc = yield this.placeModel.findOne({
|
|
1249
|
+
typeOf: { $eq: factory.placeType.BusStop },
|
|
1250
|
+
_id: { $eq: params.id }
|
|
1251
|
+
}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection))
|
|
1252
|
+
.exec();
|
|
1253
|
+
if (doc === null) {
|
|
1254
|
+
throw new factory.errors.NotFound(this.placeModel.modelName);
|
|
1255
|
+
}
|
|
1256
|
+
return doc.toObject();
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
deleteBusStopById(params) {
|
|
1260
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1261
|
+
yield this.placeModel.findOneAndDelete({
|
|
1262
|
+
typeOf: { $eq: factory.placeType.BusStop },
|
|
1263
|
+
_id: { $eq: params.id }
|
|
1264
|
+
})
|
|
1265
|
+
.exec()
|
|
1266
|
+
.then((doc) => {
|
|
1267
|
+
if (doc === null) {
|
|
1268
|
+
throw new factory.errors.NotFound(this.placeModel.modelName);
|
|
1269
|
+
}
|
|
1270
|
+
});
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1069
1273
|
getCursor(conditions, projection) {
|
|
1070
1274
|
return this.placeModel.find(conditions, projection)
|
|
1071
1275
|
.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;
|
|
@@ -10,7 +10,9 @@ export declare class MongoRepository {
|
|
|
10
10
|
findById(conditions: {
|
|
11
11
|
id: string;
|
|
12
12
|
}, projection?: any): Promise<factory.project.IProject>;
|
|
13
|
-
|
|
13
|
+
findAlternateNameById(params: {
|
|
14
|
+
id: string;
|
|
15
|
+
}): Promise<Pick<factory.project.IProject, 'alternateName'>>;
|
|
14
16
|
/**
|
|
15
17
|
* プロジェクト検索
|
|
16
18
|
*/
|
|
@@ -24,6 +26,9 @@ export declare class MongoRepository {
|
|
|
24
26
|
settings?: {
|
|
25
27
|
sendgridApiKey?: string;
|
|
26
28
|
};
|
|
29
|
+
subscription?: {
|
|
30
|
+
useEventServiceAsProduct?: boolean;
|
|
31
|
+
};
|
|
27
32
|
}): Promise<void>;
|
|
28
33
|
updateAggregateReservation(params: {
|
|
29
34
|
id: string;
|
|
@@ -32,4 +37,5 @@ export declare class MongoRepository {
|
|
|
32
37
|
deleteById(params: {
|
|
33
38
|
id: string;
|
|
34
39
|
}): Promise<void>;
|
|
40
|
+
getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
|
|
35
41
|
}
|
|
@@ -61,12 +61,14 @@ class MongoRepository {
|
|
|
61
61
|
return doc.toObject();
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
findAlternateNameById(params) {
|
|
65
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
const
|
|
67
|
-
return this.projectModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
68
|
-
.setOptions({ maxTimeMS: 10000 })
|
|
66
|
+
const doc = yield this.projectModel.findOne({ _id: params.id }, { alternateName: 1 })
|
|
69
67
|
.exec();
|
|
68
|
+
if (doc === null) {
|
|
69
|
+
throw new factory.errors.NotFound(this.projectModel.modelName);
|
|
70
|
+
}
|
|
71
|
+
return doc.toObject();
|
|
70
72
|
});
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
@@ -98,12 +100,14 @@ class MongoRepository {
|
|
|
98
100
|
});
|
|
99
101
|
}
|
|
100
102
|
findByIdAndIUpdate(params) {
|
|
101
|
-
var _a;
|
|
103
|
+
var _a, _b;
|
|
102
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
|
|
105
|
+
yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
|
|
104
106
|
? { alternateName: params.alternateName }
|
|
105
107
|
: undefined), (typeof params.name === 'string' && params.name.length > 0) ? { name: params.name } : undefined), (typeof params.logo === 'string' && params.logo.length > 0) ? { logo: params.logo } : undefined), (typeof ((_a = params.settings) === null || _a === void 0 ? void 0 : _a.sendgridApiKey) === 'string')
|
|
106
108
|
? { 'settings.sendgridApiKey': params.settings.sendgridApiKey }
|
|
109
|
+
: undefined), (typeof ((_b = params.subscription) === null || _b === void 0 ? void 0 : _b.useEventServiceAsProduct) === 'boolean')
|
|
110
|
+
? { 'subscription.useEventServiceAsProduct': params.subscription.useEventServiceAsProduct }
|
|
107
111
|
: undefined), {
|
|
108
112
|
// ↓customerUserPoolは廃止
|
|
109
113
|
$unset: {
|
|
@@ -131,5 +135,10 @@ class MongoRepository {
|
|
|
131
135
|
.exec();
|
|
132
136
|
});
|
|
133
137
|
}
|
|
138
|
+
getCursor(conditions, projection) {
|
|
139
|
+
return this.projectModel.find(conditions, projection)
|
|
140
|
+
.sort({ _id: factory.sortType.Ascending })
|
|
141
|
+
.cursor();
|
|
142
|
+
}
|
|
134
143
|
}
|
|
135
144
|
exports.MongoRepository = MongoRepository;
|
|
@@ -26,16 +26,12 @@ export declare class MongoRepository {
|
|
|
26
26
|
search<T extends factory.reservationType>(params: factory.reservation.ISearchConditions<T>, projection?: any): Promise<factory.reservation.IReservation<factory.reservationType.EventReservation>[]>;
|
|
27
27
|
findById<T extends factory.reservationType>(params: {
|
|
28
28
|
id: string;
|
|
29
|
+
inclusion?: string[];
|
|
30
|
+
exclusion?: string[];
|
|
29
31
|
}): Promise<factory.reservation.IReservation<T>>;
|
|
30
32
|
/**
|
|
31
33
|
* 予約確定
|
|
32
34
|
*/
|
|
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
35
|
confirmByReservationNumber(params: {
|
|
40
36
|
reservationNumber: string;
|
|
41
37
|
previousReservationStatus: factory.reservationStatusType;
|
|
@@ -60,7 +56,7 @@ export declare class MongoRepository {
|
|
|
60
56
|
/**
|
|
61
57
|
* 発券する
|
|
62
58
|
*/
|
|
63
|
-
|
|
59
|
+
checkInIfNot(params: {
|
|
64
60
|
id?: string | {
|
|
65
61
|
$in?: string[];
|
|
66
62
|
};
|
|
@@ -72,10 +68,13 @@ export declare class MongoRepository {
|
|
|
72
68
|
*/
|
|
73
69
|
now: Date;
|
|
74
70
|
}): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* 発券する
|
|
73
|
+
*/
|
|
75
74
|
/**
|
|
76
75
|
* 入場する
|
|
77
76
|
*/
|
|
78
|
-
|
|
77
|
+
attendIfNotAttended(params: {
|
|
79
78
|
id: string;
|
|
80
79
|
/**
|
|
81
80
|
* modifiedTime
|