@chevre/domain 20.2.0-alpha.9 → 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 +72 -60
- 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 +0 -3
- 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 +23 -26
- 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 -33
- 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/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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as mongoose from 'mongoose';
|
|
2
|
+
declare const modelName = "Aggregation";
|
|
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,47 @@
|
|
|
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 = 'Aggregation';
|
|
6
|
+
exports.modelName = modelName;
|
|
7
|
+
const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
|
|
8
|
+
/**
|
|
9
|
+
* 集計スキーマ
|
|
10
|
+
*/
|
|
11
|
+
const schema = new mongoose.Schema({}, {
|
|
12
|
+
collection: 'aggregations',
|
|
13
|
+
id: true,
|
|
14
|
+
read: 'primaryPreferred',
|
|
15
|
+
writeConcern: writeConcern,
|
|
16
|
+
strict: false,
|
|
17
|
+
useNestedStrict: true,
|
|
18
|
+
timestamps: {
|
|
19
|
+
createdAt: 'createdAt',
|
|
20
|
+
updatedAt: 'updatedAt'
|
|
21
|
+
},
|
|
22
|
+
toJSON: {
|
|
23
|
+
getters: false,
|
|
24
|
+
virtuals: false,
|
|
25
|
+
minimize: false,
|
|
26
|
+
versionKey: false
|
|
27
|
+
},
|
|
28
|
+
toObject: {
|
|
29
|
+
getters: false,
|
|
30
|
+
virtuals: true,
|
|
31
|
+
minimize: false,
|
|
32
|
+
versionKey: false
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
exports.schema = schema;
|
|
36
|
+
schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
|
|
37
|
+
schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
|
|
38
|
+
mongoose.model(modelName, schema)
|
|
39
|
+
.on('index',
|
|
40
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
41
|
+
/* istanbul ignore next */
|
|
42
|
+
(error) => {
|
|
43
|
+
if (error !== undefined) {
|
|
44
|
+
// tslint:disable-next-line:no-console
|
|
45
|
+
console.error(error);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
@@ -30,12 +30,13 @@ const schema = new mongoose.Schema({
|
|
|
30
30
|
startDate: Date,
|
|
31
31
|
workPerformed: mongoose.SchemaTypes.Mixed,
|
|
32
32
|
superEvent: mongoose.SchemaTypes.Mixed,
|
|
33
|
-
videoFormat:
|
|
34
|
-
soundFormat:
|
|
33
|
+
videoFormat: mongoose.SchemaTypes.Mixed,
|
|
34
|
+
soundFormat: mongoose.SchemaTypes.Mixed,
|
|
35
35
|
subtitleLanguage: mongoose.SchemaTypes.Mixed,
|
|
36
36
|
dubLanguage: mongoose.SchemaTypes.Mixed,
|
|
37
37
|
kanaName: String,
|
|
38
|
-
|
|
38
|
+
// 不要なので廃止(2023-01-23~)
|
|
39
|
+
// hasOfferCatalog: mongoose.SchemaTypes.Mixed,
|
|
39
40
|
offers: mongoose.SchemaTypes.Mixed,
|
|
40
41
|
maximumAttendeeCapacity: { type: Number },
|
|
41
42
|
remainingAttendeeCapacity: { type: Number },
|
|
@@ -41,7 +41,8 @@ const schema = new mongoose.Schema({
|
|
|
41
41
|
eligibleRegion: mongoose.SchemaTypes.Mixed,
|
|
42
42
|
eligibleSeatingType: mongoose.SchemaTypes.Mixed,
|
|
43
43
|
eligibleSubReservation: mongoose.SchemaTypes.Mixed,
|
|
44
|
-
//
|
|
44
|
+
// settings追加(2023-01-26~)
|
|
45
|
+
settings: mongoose.SchemaTypes.Mixed,
|
|
45
46
|
validFrom: Date,
|
|
46
47
|
validThrough: Date,
|
|
47
48
|
validRateLimit: mongoose.SchemaTypes.Mixed
|
|
@@ -10,6 +10,12 @@ const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
|
|
|
10
10
|
*/
|
|
11
11
|
const schema = new mongoose.Schema({
|
|
12
12
|
_id: String,
|
|
13
|
+
aggregateReservation: mongoose.SchemaTypes.Mixed,
|
|
14
|
+
alternateName: String,
|
|
15
|
+
logo: String,
|
|
16
|
+
name: String,
|
|
17
|
+
settings: mongoose.SchemaTypes.Mixed,
|
|
18
|
+
subscription: mongoose.SchemaTypes.Mixed,
|
|
13
19
|
typeOf: {
|
|
14
20
|
type: String,
|
|
15
21
|
required: true
|
|
@@ -19,7 +25,7 @@ const schema = new mongoose.Schema({
|
|
|
19
25
|
id: true,
|
|
20
26
|
read: 'primaryPreferred',
|
|
21
27
|
writeConcern: writeConcern,
|
|
22
|
-
strict:
|
|
28
|
+
strict: true,
|
|
23
29
|
useNestedStrict: true,
|
|
24
30
|
timestamps: {
|
|
25
31
|
createdAt: 'createdAt',
|
|
@@ -5,41 +5,17 @@ const mongoose = require("mongoose");
|
|
|
5
5
|
const modelName = 'Telemetry';
|
|
6
6
|
exports.modelName = modelName;
|
|
7
7
|
const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
|
|
8
|
-
const purposeSchema = new mongoose.Schema({
|
|
9
|
-
typeOf: String
|
|
10
|
-
}, {
|
|
11
|
-
id: false,
|
|
12
|
-
_id: false,
|
|
13
|
-
strict: false
|
|
14
|
-
});
|
|
15
|
-
const objectSchema = new mongoose.Schema({
|
|
16
|
-
measuredAt: Date
|
|
17
|
-
}, {
|
|
18
|
-
id: false,
|
|
19
|
-
_id: false,
|
|
20
|
-
strict: false
|
|
21
|
-
});
|
|
22
|
-
const resultSchema = new mongoose.Schema({}, {
|
|
23
|
-
id: false,
|
|
24
|
-
_id: false,
|
|
25
|
-
strict: false
|
|
26
|
-
});
|
|
27
|
-
const errorSchema = new mongoose.Schema({}, {
|
|
28
|
-
id: false,
|
|
29
|
-
_id: false,
|
|
30
|
-
strict: false
|
|
31
|
-
});
|
|
32
8
|
/**
|
|
33
9
|
* 測定スキーマ
|
|
34
10
|
*/
|
|
35
11
|
const schema = new mongoose.Schema({
|
|
36
12
|
project: mongoose.SchemaTypes.Mixed,
|
|
37
|
-
result:
|
|
38
|
-
error:
|
|
39
|
-
object:
|
|
13
|
+
result: mongoose.SchemaTypes.Mixed,
|
|
14
|
+
error: mongoose.SchemaTypes.Mixed,
|
|
15
|
+
object: mongoose.SchemaTypes.Mixed,
|
|
40
16
|
startDate: Date,
|
|
41
17
|
endDate: Date,
|
|
42
|
-
purpose:
|
|
18
|
+
purpose: mongoose.SchemaTypes.Mixed
|
|
43
19
|
}, {
|
|
44
20
|
collection: 'telemetries',
|
|
45
21
|
id: true,
|
|
@@ -13,9 +13,19 @@ export declare class MongoRepository {
|
|
|
13
13
|
* カタログに登録されたオファーの順序は保証される
|
|
14
14
|
*/
|
|
15
15
|
findOffersByOfferCatalogId(params: {
|
|
16
|
+
/**
|
|
17
|
+
* 指定したIDのオファーだけ取得する場合
|
|
18
|
+
*/
|
|
19
|
+
ids?: string[];
|
|
16
20
|
offerCatalog: {
|
|
17
21
|
id: string;
|
|
18
22
|
};
|
|
23
|
+
availableAtOrFrom?: {
|
|
24
|
+
id?: string;
|
|
25
|
+
};
|
|
26
|
+
limit?: number;
|
|
27
|
+
page?: number;
|
|
28
|
+
sort: boolean;
|
|
19
29
|
}): Promise<factory.unitPriceOffer.IUnitPriceOffer[]>;
|
|
20
30
|
findById(params: {
|
|
21
31
|
id: string;
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -301,27 +301,58 @@ class MongoRepository {
|
|
|
301
301
|
* カタログに登録されたオファーの順序は保証される
|
|
302
302
|
*/
|
|
303
303
|
findOffersByOfferCatalogId(params) {
|
|
304
|
+
var _a;
|
|
304
305
|
return __awaiter(this, void 0, void 0, function* () {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
306
|
+
// aggregateで再実装(2023-01-26~)
|
|
307
|
+
const matchStages = [{ $match: { _id: { $eq: params.offerCatalog.id } } }];
|
|
308
|
+
if (Array.isArray(params.ids)) {
|
|
309
|
+
matchStages.push({
|
|
310
|
+
$match: { 'itemListElement.id': { $exists: true, $in: params.ids } }
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
const aggregate = this.offerCatalogModel.aggregate([
|
|
314
|
+
{ $unwind: '$itemListElement' },
|
|
315
|
+
...matchStages,
|
|
316
|
+
{
|
|
317
|
+
$project: {
|
|
318
|
+
_id: 0,
|
|
319
|
+
id: '$itemListElement.id'
|
|
320
|
+
}
|
|
314
321
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
const sortedOfferIds = (Array.isArray(
|
|
318
|
-
?
|
|
322
|
+
]);
|
|
323
|
+
const itemListElements = yield aggregate.exec();
|
|
324
|
+
const sortedOfferIds = (Array.isArray(itemListElements))
|
|
325
|
+
? itemListElements.map((element) => element.id)
|
|
319
326
|
: [];
|
|
327
|
+
// const offerCatalog = await this.offerCatalogModel.findById(
|
|
328
|
+
// params.offerCatalog.id,
|
|
329
|
+
// {
|
|
330
|
+
// itemListElement: 1
|
|
331
|
+
// }
|
|
332
|
+
// )
|
|
333
|
+
// .exec()
|
|
334
|
+
// .then((doc) => {
|
|
335
|
+
// if (doc === null) {
|
|
336
|
+
// throw new factory.errors.NotFound(this.offerCatalogModel.modelName);
|
|
337
|
+
// }
|
|
338
|
+
// return <Pick<factory.offerCatalog.IOfferCatalog, 'itemListElement'>>doc.toObject();
|
|
339
|
+
// });
|
|
340
|
+
// let sortedOfferIds: string[] = (Array.isArray(offerCatalog.itemListElement))
|
|
341
|
+
// ? offerCatalog.itemListElement.map((element) => element.id)
|
|
342
|
+
// : [];
|
|
343
|
+
// const filteredIds = params.ids;
|
|
344
|
+
// if (Array.isArray(filteredIds)) {
|
|
345
|
+
// sortedOfferIds = sortedOfferIds.filter((id) => filteredIds.includes(id));
|
|
346
|
+
// }
|
|
320
347
|
let offers = [];
|
|
321
348
|
if (sortedOfferIds.length > 0) {
|
|
322
|
-
offers = yield this.search({ id: { $in: sortedOfferIds } })
|
|
323
|
-
|
|
324
|
-
|
|
349
|
+
offers = yield this.search(Object.assign({ id: { $in: sortedOfferIds } }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
350
|
+
? { availableAtOrFrom: { id: { $eq: params.availableAtOrFrom.id } } }
|
|
351
|
+
: undefined));
|
|
352
|
+
if (params.sort) {
|
|
353
|
+
// sorting
|
|
354
|
+
offers = offers.sort((a, b) => sortedOfferIds.indexOf(String(a.id)) - sortedOfferIds.indexOf(String(b.id)));
|
|
355
|
+
}
|
|
325
356
|
}
|
|
326
357
|
return offers;
|
|
327
358
|
});
|
|
@@ -41,7 +41,13 @@ export declare class MongoRepository {
|
|
|
41
41
|
*/
|
|
42
42
|
findByOrderNumber(params: {
|
|
43
43
|
orderNumber: string;
|
|
44
|
+
inclusion: string[];
|
|
45
|
+
exclusion: string[];
|
|
44
46
|
}): Promise<factory.order.IOrder>;
|
|
47
|
+
findByOrderNumberAndReservationId(params: {
|
|
48
|
+
orderNumber: string;
|
|
49
|
+
reservationId: string;
|
|
50
|
+
}): Promise<Pick<factory.order.IOrder, 'orderNumber' | 'orderStatus' | 'typeOf'>>;
|
|
45
51
|
/**
|
|
46
52
|
* 注文番号で削除する
|
|
47
53
|
*/
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -693,7 +693,11 @@ class MongoRepository {
|
|
|
693
693
|
.exec();
|
|
694
694
|
// NotFoundであれば状態確認
|
|
695
695
|
if (doc === null) {
|
|
696
|
-
const order = yield this.findByOrderNumber(
|
|
696
|
+
const order = yield this.findByOrderNumber({
|
|
697
|
+
orderNumber: params.orderNumber,
|
|
698
|
+
inclusion: [],
|
|
699
|
+
exclusion: []
|
|
700
|
+
});
|
|
697
701
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
698
702
|
/* istanbul ignore next */
|
|
699
703
|
if (order.orderStatus === params.orderStatus) {
|
|
@@ -732,7 +736,11 @@ class MongoRepository {
|
|
|
732
736
|
.exec();
|
|
733
737
|
// NotFoundであれば状態確認
|
|
734
738
|
if (doc === null) {
|
|
735
|
-
const order = yield this.findByOrderNumber(
|
|
739
|
+
const order = yield this.findByOrderNumber({
|
|
740
|
+
orderNumber: params.orderNumber,
|
|
741
|
+
inclusion: [],
|
|
742
|
+
exclusion: []
|
|
743
|
+
});
|
|
736
744
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
737
745
|
/* istanbul ignore next */
|
|
738
746
|
if (order.orderStatus === factory.orderStatus.OrderReturned) {
|
|
@@ -771,11 +779,49 @@ class MongoRepository {
|
|
|
771
779
|
*/
|
|
772
780
|
findByOrderNumber(params) {
|
|
773
781
|
return __awaiter(this, void 0, void 0, function* () {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
782
|
+
let projection = {};
|
|
783
|
+
if (Array.isArray(params.inclusion) && params.inclusion.length > 0) {
|
|
784
|
+
params.inclusion.forEach((field) => {
|
|
785
|
+
projection[field] = 1;
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
else {
|
|
789
|
+
projection = {
|
|
790
|
+
__v: 0,
|
|
791
|
+
createdAt: 0,
|
|
792
|
+
updatedAt: 0
|
|
793
|
+
};
|
|
794
|
+
if (Array.isArray(params.exclusion) && params.exclusion.length > 0) {
|
|
795
|
+
params.exclusion.forEach((field) => {
|
|
796
|
+
projection[field] = 0;
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
const doc = yield this.orderModel.findOne({ orderNumber: params.orderNumber }, projection)
|
|
801
|
+
.exec();
|
|
802
|
+
if (doc === null) {
|
|
803
|
+
throw new factory.errors.NotFound(this.orderModel.modelName);
|
|
804
|
+
}
|
|
805
|
+
return doc.toObject();
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
findByOrderNumberAndReservationId(params) {
|
|
809
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
810
|
+
const projection = {
|
|
811
|
+
orderStatus: 1,
|
|
812
|
+
typeOf: 1,
|
|
813
|
+
orderNumber: 1,
|
|
814
|
+
_id: 0
|
|
815
|
+
};
|
|
816
|
+
const doc = yield this.orderModel.findOne({
|
|
817
|
+
orderNumber: { $eq: params.orderNumber },
|
|
818
|
+
acceptedOffers: {
|
|
819
|
+
$elemMatch: {
|
|
820
|
+
'itemOffered.typeOf': { $in: [factory.reservationType.BusReservation, factory.reservationType.EventReservation] },
|
|
821
|
+
'itemOffered.id': { $eq: params.reservationId }
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}, projection)
|
|
779
825
|
.exec();
|
|
780
826
|
if (doc === null) {
|
|
781
827
|
throw new factory.errors.NotFound(this.orderModel.modelName);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Connection } from 'mongoose';
|
|
2
2
|
import * as factory from '../factory';
|
|
3
3
|
declare type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
|
|
4
|
+
export declare type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace'>;
|
|
4
5
|
/**
|
|
5
6
|
* 施設リポジトリ
|
|
6
7
|
*/
|
|
7
8
|
export declare class MongoRepository {
|
|
8
9
|
private readonly placeModel;
|
|
9
10
|
constructor(connection: Connection);
|
|
11
|
+
static CREATE_BUS_STOP_MONGO_CONDITIONS(params: factory.place.busStop.ISearchConditions): any[];
|
|
10
12
|
static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params: factory.place.movieTheater.ISearchConditions): any[];
|
|
11
13
|
/**
|
|
12
14
|
* 施設を保管する
|
|
@@ -19,7 +21,6 @@ export declare class MongoRepository {
|
|
|
19
21
|
};
|
|
20
22
|
branchCode: string;
|
|
21
23
|
}): Promise<factory.place.movieTheater.IPlace>;
|
|
22
|
-
countMovieTheaters(params: factory.place.movieTheater.ISearchConditions): Promise<number>;
|
|
23
24
|
/**
|
|
24
25
|
* 施設検索
|
|
25
26
|
*/
|
|
@@ -79,6 +80,16 @@ export declare class MongoRepository {
|
|
|
79
80
|
};
|
|
80
81
|
}): Promise<void>;
|
|
81
82
|
searchScreeningRooms(searchConditions: factory.place.screeningRoom.ISearchConditions): Promise<Omit<factory.place.screeningRoom.IPlace, 'containsPlace'>[]>;
|
|
83
|
+
findScreeningRoomsByBranchCode(params: {
|
|
84
|
+
branchCode: {
|
|
85
|
+
$eq: string;
|
|
86
|
+
};
|
|
87
|
+
containedInPlace: {
|
|
88
|
+
id: {
|
|
89
|
+
$eq: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
}): Promise<IScreeningRoomFoundByBranchCode>;
|
|
82
93
|
createSeat(seat: factory.place.seat.IPlace): Promise<void>;
|
|
83
94
|
updateSeat(seat: factory.place.seat.IPlace, $unset: any): Promise<void>;
|
|
84
95
|
searchSeats(params: factory.place.seat.ISearchConditions): Promise<factory.place.seat.IPlace[]>;
|
|
@@ -114,6 +125,20 @@ export declare class MongoRepository {
|
|
|
114
125
|
id: string;
|
|
115
126
|
};
|
|
116
127
|
}): Promise<void>;
|
|
128
|
+
saveBusStop(params: factory.place.busStop.IPlace): Promise<factory.place.busStop.IPlace>;
|
|
129
|
+
findBusStopByBranchCode(params: {
|
|
130
|
+
project: {
|
|
131
|
+
id: string;
|
|
132
|
+
};
|
|
133
|
+
branchCode: string;
|
|
134
|
+
}): Promise<factory.place.movieTheater.IPlace>;
|
|
135
|
+
searchBusStops(params: factory.place.busStop.ISearchConditions): Promise<factory.place.busStop.IPlace[]>;
|
|
136
|
+
findBusStopById(params: {
|
|
137
|
+
id: string;
|
|
138
|
+
}, projection?: any): Promise<factory.place.busStop.IPlace>;
|
|
139
|
+
deleteBusStopById(params: {
|
|
140
|
+
id: string;
|
|
141
|
+
}): Promise<void>;
|
|
117
142
|
getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
|
|
118
143
|
}
|
|
119
144
|
export {};
|