@chevre/domain 21.4.0-alpha.8 → 21.4.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/cleanEventsByMovieTheater.ts +32 -0
- package/example/src/chevre/createDeleteTransactionTasksOfDeletedPeople.ts +126 -0
- package/example/src/chevre/iam/searchMemberOfIdsByMemberId.ts +31 -0
- package/example/src/chevre/iam/searchProjectIdsByMemberId.ts +32 -0
- package/example/src/chevre/importEventsFromCOA.ts +5 -4
- package/example/src/chevre/migrateEventOrganizer.ts +18 -5
- package/example/src/chevre/migrateIAMMemberMemberOf.ts +59 -0
- package/example/src/chevre/migrateReservationProvider.ts +119 -0
- package/example/src/chevre/migrateScreeningRoomOrganizer.ts +91 -0
- package/example/src/chevre/processReserve.ts +0 -1
- package/example/src/chevre/searchActions.ts +1 -1
- package/example/src/chevre/searchPermissions.ts +7 -15
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/repo/assetTransaction.d.ts +4 -1
- package/lib/chevre/repo/assetTransaction.js +6 -12
- package/lib/chevre/repo/event.d.ts +16 -0
- package/lib/chevre/repo/event.js +34 -1
- package/lib/chevre/repo/member.d.ts +77 -5
- package/lib/chevre/repo/member.js +115 -97
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +7 -7
- package/lib/chevre/repo/mongoose/schemas/member.js +22 -8
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -6
- package/lib/chevre/repo/mongoose/schemas/place.js +9 -2
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +6 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.js +10 -4
- package/lib/chevre/repo/order.d.ts +21 -0
- package/lib/chevre/repo/order.js +54 -62
- package/lib/chevre/repo/place.d.ts +57 -16
- package/lib/chevre/repo/place.js +112 -167
- package/lib/chevre/repo/product.d.ts +2 -4
- package/lib/chevre/repo/product.js +52 -7
- package/lib/chevre/repo/project.d.ts +5 -3
- package/lib/chevre/repo/project.js +48 -8
- package/lib/chevre/repo/reservation.d.ts +33 -21
- package/lib/chevre/repo/reservation.js +97 -79
- package/lib/chevre/repo/role.d.ts +0 -4
- package/lib/chevre/repo/role.js +0 -46
- package/lib/chevre/repo/seller.d.ts +18 -5
- package/lib/chevre/repo/seller.js +53 -46
- package/lib/chevre/repo/stockHolder.d.ts +2 -77
- package/lib/chevre/repo/stockHolder.js +200 -476
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
- package/lib/chevre/service/aggregation/project.js +5 -1
- package/lib/chevre/service/assetTransaction/cancelReservation.js +10 -2
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
- package/lib/chevre/service/assetTransaction/pay.js +9 -1
- package/lib/chevre/service/assetTransaction/registerService.js +7 -3
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +6 -1
- package/lib/chevre/service/assetTransaction/reserve/factory.js +15 -38
- package/lib/chevre/service/assetTransaction/reserve.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/reserve.js +7 -22
- package/lib/chevre/service/event/createEvent.d.ts +11 -0
- package/lib/chevre/service/event/createEvent.js +112 -0
- package/lib/chevre/service/event.d.ts +2 -0
- package/lib/chevre/service/event.js +8 -4
- package/lib/chevre/service/iam.d.ts +5 -0
- package/lib/chevre/service/iam.js +7 -19
- package/lib/chevre/service/moneyTransfer.js +6 -2
- package/lib/chevre/service/notification.js +5 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
- package/lib/chevre/service/offer/event/authorize.js +6 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +1 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +8 -1
- package/lib/chevre/service/order/sendOrder.js +8 -1
- package/lib/chevre/service/payment/creditCard.js +14 -2
- package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
- package/lib/chevre/service/payment/movieTicket.js +19 -2
- package/lib/chevre/service/payment/paymentCard.js +6 -4
- package/lib/chevre/service/reserve/cancelReservation.js +15 -28
- package/lib/chevre/service/reserve/confirmReservation.js +14 -30
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +3 -1
- package/lib/chevre/service/task/{syncScreeningRooms.d.ts → createEvent.d.ts} +1 -1
- package/lib/chevre/service/task/{syncScreeningRooms.js → createEvent.js} +11 -3
- package/lib/chevre/service/task/onAuthorizationCreated.js +1 -0
- package/lib/chevre/service/task/returnPayTransaction.js +1 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +6 -2
- package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
- package/lib/chevre/service/transaction/returnOrder.js +9 -3
- package/lib/chevre/settings.d.ts +0 -2
- package/lib/chevre/settings.js +7 -7
- package/package.json +3 -3
- package/example/src/chevre/findByOrderNumberAndReservationId.ts +0 -20
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +0 -27
- package/example/src/chevre/searchHoldReservations.ts +0 -38
- package/example/src/chevre/searchScreeningRooms.ts +0 -33
- package/example/src/chevre/syncScreeningRooms.ts +0 -21
- package/example/src/chevre/syncScreeningRoomsAll.ts +0 -41
- package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +0 -75
- package/lib/chevre/repo/mongoose/schemas/holdReservation.js +0 -93
|
@@ -53,13 +53,14 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
53
53
|
};
|
|
54
54
|
}, {
|
|
55
55
|
typeOf: string;
|
|
56
|
+
project: any;
|
|
56
57
|
additionalProperty: any[];
|
|
58
|
+
parentOrganization: any;
|
|
57
59
|
containsPlace: any[];
|
|
58
60
|
hasEntranceGate: any[];
|
|
59
61
|
hasPOS: any[];
|
|
60
62
|
name?: any;
|
|
61
63
|
url?: string | undefined;
|
|
62
|
-
project?: any;
|
|
63
64
|
alternateName?: any;
|
|
64
65
|
description?: any;
|
|
65
66
|
offers?: any;
|
|
@@ -72,18 +73,18 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
72
73
|
openingHoursSpecification?: any;
|
|
73
74
|
smokingAllowed?: boolean | undefined;
|
|
74
75
|
sameAs?: string | undefined;
|
|
75
|
-
parentOrganization?: any;
|
|
76
76
|
openSeatingAllowed?: any;
|
|
77
77
|
amenityFeature?: any;
|
|
78
78
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
79
79
|
typeOf: string;
|
|
80
|
+
project: any;
|
|
80
81
|
additionalProperty: any[];
|
|
82
|
+
parentOrganization: any;
|
|
81
83
|
containsPlace: any[];
|
|
82
84
|
hasEntranceGate: any[];
|
|
83
85
|
hasPOS: any[];
|
|
84
86
|
name?: any;
|
|
85
87
|
url?: string | undefined;
|
|
86
|
-
project?: any;
|
|
87
88
|
alternateName?: any;
|
|
88
89
|
description?: any;
|
|
89
90
|
offers?: any;
|
|
@@ -96,18 +97,18 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
96
97
|
openingHoursSpecification?: any;
|
|
97
98
|
smokingAllowed?: boolean | undefined;
|
|
98
99
|
sameAs?: string | undefined;
|
|
99
|
-
parentOrganization?: any;
|
|
100
100
|
openSeatingAllowed?: any;
|
|
101
101
|
amenityFeature?: any;
|
|
102
102
|
}>> & Omit<import("mongoose").FlatRecord<{
|
|
103
103
|
typeOf: string;
|
|
104
|
+
project: any;
|
|
104
105
|
additionalProperty: any[];
|
|
106
|
+
parentOrganization: any;
|
|
105
107
|
containsPlace: any[];
|
|
106
108
|
hasEntranceGate: any[];
|
|
107
109
|
hasPOS: any[];
|
|
108
110
|
name?: any;
|
|
109
111
|
url?: string | undefined;
|
|
110
|
-
project?: any;
|
|
111
112
|
alternateName?: any;
|
|
112
113
|
description?: any;
|
|
113
114
|
offers?: any;
|
|
@@ -120,7 +121,6 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
120
121
|
openingHoursSpecification?: any;
|
|
121
122
|
smokingAllowed?: boolean | undefined;
|
|
122
123
|
sameAs?: string | undefined;
|
|
123
|
-
parentOrganization?: any;
|
|
124
124
|
openSeatingAllowed?: any;
|
|
125
125
|
amenityFeature?: any;
|
|
126
126
|
}> & {
|
|
@@ -9,7 +9,15 @@ exports.modelName = modelName;
|
|
|
9
9
|
* 場所スキーマ
|
|
10
10
|
*/
|
|
11
11
|
const schema = new mongoose_1.Schema({
|
|
12
|
-
project:
|
|
12
|
+
project: {
|
|
13
|
+
type: mongoose_1.SchemaTypes.Mixed,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
// 必須化(2023-07-14~)
|
|
17
|
+
parentOrganization: {
|
|
18
|
+
type: mongoose_1.SchemaTypes.Mixed,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
13
21
|
typeOf: {
|
|
14
22
|
type: String,
|
|
15
23
|
required: true
|
|
@@ -32,7 +40,6 @@ const schema = new mongoose_1.Schema({
|
|
|
32
40
|
kanaName: String,
|
|
33
41
|
offers: mongoose_1.SchemaTypes.Mixed,
|
|
34
42
|
additionalProperty: [mongoose_1.SchemaTypes.Mixed],
|
|
35
|
-
parentOrganization: mongoose_1.SchemaTypes.Mixed,
|
|
36
43
|
// ↓ルームの施設からの分離に伴い属性追加(2023-06-22~)
|
|
37
44
|
openSeatingAllowed: mongoose_1.SchemaTypes.Mixed,
|
|
38
45
|
amenityFeature: mongoose_1.SchemaTypes.Mixed
|
|
@@ -54,9 +54,9 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
54
54
|
}, {
|
|
55
55
|
typeOf: string;
|
|
56
56
|
additionalProperty: any[];
|
|
57
|
+
provider: any[];
|
|
57
58
|
offers: any[];
|
|
58
59
|
productID: string;
|
|
59
|
-
provider: any[];
|
|
60
60
|
name?: any;
|
|
61
61
|
project?: any;
|
|
62
62
|
description?: any;
|
|
@@ -67,9 +67,9 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
67
67
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
68
68
|
typeOf: string;
|
|
69
69
|
additionalProperty: any[];
|
|
70
|
+
provider: any[];
|
|
70
71
|
offers: any[];
|
|
71
72
|
productID: string;
|
|
72
|
-
provider: any[];
|
|
73
73
|
name?: any;
|
|
74
74
|
project?: any;
|
|
75
75
|
description?: any;
|
|
@@ -80,9 +80,9 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
80
80
|
}>> & Omit<import("mongoose").FlatRecord<{
|
|
81
81
|
typeOf: string;
|
|
82
82
|
additionalProperty: any[];
|
|
83
|
+
provider: any[];
|
|
83
84
|
offers: any[];
|
|
84
85
|
productID: string;
|
|
85
|
-
provider: any[];
|
|
86
86
|
name?: any;
|
|
87
87
|
project?: any;
|
|
88
88
|
description?: any;
|
|
@@ -53,12 +53,13 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
53
53
|
};
|
|
54
54
|
}, {
|
|
55
55
|
typeOf: string;
|
|
56
|
+
project: any;
|
|
56
57
|
reservationNumber: string;
|
|
58
|
+
provider: any;
|
|
57
59
|
reservationStatus: string;
|
|
58
60
|
checkedIn: boolean;
|
|
59
61
|
attended: boolean;
|
|
60
62
|
_id?: string | undefined;
|
|
61
|
-
project?: any;
|
|
62
63
|
broker?: any;
|
|
63
64
|
price?: any;
|
|
64
65
|
priceCurrency?: string | undefined;
|
|
@@ -81,12 +82,13 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
81
82
|
previousReservationStatus?: string | undefined;
|
|
82
83
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
83
84
|
typeOf: string;
|
|
85
|
+
project: any;
|
|
84
86
|
reservationNumber: string;
|
|
87
|
+
provider: any;
|
|
85
88
|
reservationStatus: string;
|
|
86
89
|
checkedIn: boolean;
|
|
87
90
|
attended: boolean;
|
|
88
91
|
_id?: string | undefined;
|
|
89
|
-
project?: any;
|
|
90
92
|
broker?: any;
|
|
91
93
|
price?: any;
|
|
92
94
|
priceCurrency?: string | undefined;
|
|
@@ -109,12 +111,13 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
109
111
|
previousReservationStatus?: string | undefined;
|
|
110
112
|
}>> & Omit<import("mongoose").FlatRecord<{
|
|
111
113
|
typeOf: string;
|
|
114
|
+
project: any;
|
|
112
115
|
reservationNumber: string;
|
|
116
|
+
provider: any;
|
|
113
117
|
reservationStatus: string;
|
|
114
118
|
checkedIn: boolean;
|
|
115
119
|
attended: boolean;
|
|
116
120
|
_id?: string | undefined;
|
|
117
|
-
project?: any;
|
|
118
121
|
broker?: any;
|
|
119
122
|
price?: any;
|
|
120
123
|
priceCurrency?: string | undefined;
|
|
@@ -9,7 +9,14 @@ exports.modelName = modelName;
|
|
|
9
9
|
* 予約スキーマ
|
|
10
10
|
*/
|
|
11
11
|
const schema = new mongoose_1.Schema({
|
|
12
|
-
project:
|
|
12
|
+
project: {
|
|
13
|
+
type: mongoose_1.SchemaTypes.Mixed,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
provider: {
|
|
17
|
+
type: mongoose_1.SchemaTypes.Mixed,
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
13
20
|
_id: String,
|
|
14
21
|
typeOf: {
|
|
15
22
|
type: String,
|
|
@@ -74,9 +81,8 @@ exports.schema = schema;
|
|
|
74
81
|
schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
|
|
75
82
|
schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
|
|
76
83
|
schema.index({ bookingTime: -1 }, { name: 'searchByBookingTime-v3' });
|
|
77
|
-
schema.index({ 'project.id': 1, bookingTime: -1 }, {
|
|
78
|
-
|
|
79
|
-
});
|
|
84
|
+
schema.index({ 'project.id': 1, bookingTime: -1 }, { name: 'searchByProjectId-v20220721' });
|
|
85
|
+
schema.index({ 'provider.id': 1, bookingTime: -1 }, { name: 'searchByProviderId' });
|
|
80
86
|
schema.index({ typeOf: 1, bookingTime: -1 }, { name: 'searchByTypeOf-v3' });
|
|
81
87
|
schema.index({ reservationNumber: 1, bookingTime: -1 }, { name: 'searchByReservationNumber-v3' });
|
|
82
88
|
schema.index({ reservationStatus: 1, bookingTime: -1 }, { name: 'searchByReservationStatus-v3' });
|
|
@@ -39,6 +39,9 @@ export declare class MongoRepository {
|
|
|
39
39
|
* 注文ステータスを変更する
|
|
40
40
|
*/
|
|
41
41
|
changeStatus(params: {
|
|
42
|
+
project: {
|
|
43
|
+
id: string;
|
|
44
|
+
};
|
|
42
45
|
orderNumber: string;
|
|
43
46
|
orderStatus: factory.orderStatus;
|
|
44
47
|
previousOrderStatus: factory.orderStatus;
|
|
@@ -47,6 +50,9 @@ export declare class MongoRepository {
|
|
|
47
50
|
* 注文を返品する
|
|
48
51
|
*/
|
|
49
52
|
returnOrder(params: {
|
|
53
|
+
project: {
|
|
54
|
+
id: string;
|
|
55
|
+
};
|
|
50
56
|
orderNumber: string;
|
|
51
57
|
dateReturned: Date;
|
|
52
58
|
returner: factory.order.IReturner;
|
|
@@ -55,6 +61,9 @@ export declare class MongoRepository {
|
|
|
55
61
|
* 変更可能な属性を更新する
|
|
56
62
|
*/
|
|
57
63
|
updateChangeableAttributes(params: {
|
|
64
|
+
project: {
|
|
65
|
+
id: string;
|
|
66
|
+
};
|
|
58
67
|
additionalProperty?: factory.propertyValue.IPropertyValue<string>[];
|
|
59
68
|
name?: string;
|
|
60
69
|
orderNumber: string;
|
|
@@ -71,10 +80,22 @@ export declare class MongoRepository {
|
|
|
71
80
|
*/
|
|
72
81
|
findByOrderNumber(params: {
|
|
73
82
|
orderNumber: string;
|
|
83
|
+
project: {
|
|
84
|
+
id: string;
|
|
85
|
+
};
|
|
86
|
+
seller?: {
|
|
87
|
+
id?: string;
|
|
88
|
+
};
|
|
74
89
|
inclusion: string[];
|
|
75
90
|
exclusion: string[];
|
|
76
91
|
}): Promise<factory.order.IOrder>;
|
|
77
92
|
findByOrderNumberAndReservationId(params: {
|
|
93
|
+
project: {
|
|
94
|
+
id: string;
|
|
95
|
+
};
|
|
96
|
+
seller?: {
|
|
97
|
+
id?: string;
|
|
98
|
+
};
|
|
78
99
|
orderNumber: string;
|
|
79
100
|
reservationId: string;
|
|
80
101
|
}): Promise<Pick<factory.order.IOrder, 'orderNumber' | 'orderStatus' | 'typeOf'>>;
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -24,34 +24,25 @@ class MongoRepository {
|
|
|
24
24
|
}
|
|
25
25
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
26
26
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
27
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
|
|
28
28
|
const andConditions = [];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (params.project.id !== undefined && params.project.id !== null) {
|
|
33
|
-
if (typeof params.project.id.$eq === 'string') {
|
|
34
|
-
andConditions.push({
|
|
35
|
-
'project.id': {
|
|
36
|
-
$eq: params.project.id.$eq
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
29
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
30
|
+
if (typeof projectIdEq === 'string') {
|
|
31
|
+
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
41
32
|
}
|
|
42
|
-
const additionalPropertyAll = (
|
|
33
|
+
const additionalPropertyAll = (_c = params.additionalProperty) === null || _c === void 0 ? void 0 : _c.$all;
|
|
43
34
|
if (Array.isArray(additionalPropertyAll)) {
|
|
44
35
|
andConditions.push({ additionalProperty: { $exists: true, $all: additionalPropertyAll } });
|
|
45
36
|
}
|
|
46
|
-
const additionalPropertyIn = (
|
|
37
|
+
const additionalPropertyIn = (_d = params.additionalProperty) === null || _d === void 0 ? void 0 : _d.$in;
|
|
47
38
|
if (Array.isArray(additionalPropertyIn)) {
|
|
48
39
|
andConditions.push({ additionalProperty: { $exists: true, $in: additionalPropertyIn } });
|
|
49
40
|
}
|
|
50
|
-
const additionalPropertyNin = (
|
|
41
|
+
const additionalPropertyNin = (_e = params.additionalProperty) === null || _e === void 0 ? void 0 : _e.$nin;
|
|
51
42
|
if (Array.isArray(additionalPropertyNin)) {
|
|
52
43
|
andConditions.push({ additionalProperty: { $nin: additionalPropertyNin } });
|
|
53
44
|
}
|
|
54
|
-
const additionalPropertyElemMatch = (
|
|
45
|
+
const additionalPropertyElemMatch = (_f = params.additionalProperty) === null || _f === void 0 ? void 0 : _f.$elemMatch;
|
|
55
46
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
56
47
|
andConditions.push({ additionalProperty: { $exists: true, $elemMatch: additionalPropertyElemMatch } });
|
|
57
48
|
}
|
|
@@ -79,31 +70,22 @@ class MongoRepository {
|
|
|
79
70
|
});
|
|
80
71
|
}
|
|
81
72
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
96
|
-
/* istanbul ignore else */
|
|
97
|
-
if (Array.isArray(params.seller.ids)) {
|
|
98
|
-
andConditions.push({
|
|
99
|
-
'seller.id': {
|
|
100
|
-
$exists: true,
|
|
101
|
-
$in: params.seller.ids
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
73
|
+
const providerIdEq = (_h = (_g = params.provider) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
74
|
+
if (typeof providerIdEq === 'string') {
|
|
75
|
+
andConditions.push({ 'seller.id': { $exists: true, $eq: providerIdEq } });
|
|
76
|
+
}
|
|
77
|
+
const sellerIdEq = (_k = (_j = params.seller) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
78
|
+
if (typeof sellerIdEq === 'string') {
|
|
79
|
+
andConditions.push({ 'seller.id': { $exists: true, $eq: sellerIdEq } });
|
|
80
|
+
}
|
|
81
|
+
const sellerIds = (_l = params.seller) === null || _l === void 0 ? void 0 : _l.ids;
|
|
82
|
+
if (Array.isArray(sellerIds)) {
|
|
83
|
+
andConditions.push({ 'seller.id': { $exists: true, $in: sellerIds } });
|
|
105
84
|
}
|
|
106
|
-
|
|
85
|
+
if (typeof ((_m = params.seller) === null || _m === void 0 ? void 0 : _m.typeOf) === 'string') {
|
|
86
|
+
andConditions.push({ 'seller.typeOf': { $exists: true, $eq: params.seller.typeOf } });
|
|
87
|
+
}
|
|
88
|
+
const brokerIdEq = (_p = (_o = params.broker) === null || _o === void 0 ? void 0 : _o.id) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
107
89
|
if (typeof brokerIdEq === 'string') {
|
|
108
90
|
andConditions.push({
|
|
109
91
|
'broker.id': {
|
|
@@ -320,7 +302,7 @@ class MongoRepository {
|
|
|
320
302
|
}
|
|
321
303
|
}
|
|
322
304
|
}
|
|
323
|
-
const nameEq = (
|
|
305
|
+
const nameEq = (_q = params.name) === null || _q === void 0 ? void 0 : _q.$eq;
|
|
324
306
|
if (typeof nameEq === 'string') {
|
|
325
307
|
andConditions.push({
|
|
326
308
|
name: {
|
|
@@ -329,7 +311,7 @@ class MongoRepository {
|
|
|
329
311
|
}
|
|
330
312
|
});
|
|
331
313
|
}
|
|
332
|
-
const nameRegex = (
|
|
314
|
+
const nameRegex = (_r = params.name) === null || _r === void 0 ? void 0 : _r.$regex;
|
|
333
315
|
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
334
316
|
andConditions.push({
|
|
335
317
|
name: {
|
|
@@ -362,7 +344,7 @@ class MongoRepository {
|
|
|
362
344
|
}
|
|
363
345
|
});
|
|
364
346
|
}
|
|
365
|
-
const itemOfferedIdentifierIn = (
|
|
347
|
+
const itemOfferedIdentifierIn = (_u = (_t = (_s = params.acceptedOffers) === null || _s === void 0 ? void 0 : _s.itemOffered) === null || _t === void 0 ? void 0 : _t.identifier) === null || _u === void 0 ? void 0 : _u.$in;
|
|
366
348
|
if (Array.isArray(itemOfferedIdentifierIn)) {
|
|
367
349
|
andConditions.push({
|
|
368
350
|
'acceptedOffers.itemOffered.identifier': {
|
|
@@ -371,7 +353,7 @@ class MongoRepository {
|
|
|
371
353
|
}
|
|
372
354
|
});
|
|
373
355
|
}
|
|
374
|
-
const itemOfferedTypeOfIn = (
|
|
356
|
+
const itemOfferedTypeOfIn = (_x = (_w = (_v = params.acceptedOffers) === null || _v === void 0 ? void 0 : _v.itemOffered) === null || _w === void 0 ? void 0 : _w.typeOf) === null || _x === void 0 ? void 0 : _x.$in;
|
|
375
357
|
if (Array.isArray(itemOfferedTypeOfIn)) {
|
|
376
358
|
andConditions.push({
|
|
377
359
|
'acceptedOffers.itemOffered.typeOf': {
|
|
@@ -380,7 +362,7 @@ class MongoRepository {
|
|
|
380
362
|
}
|
|
381
363
|
});
|
|
382
364
|
}
|
|
383
|
-
const itemOfferedIssuedThroughTypeOfEq = (
|
|
365
|
+
const itemOfferedIssuedThroughTypeOfEq = (_1 = (_0 = (_z = (_y = params.acceptedOffers) === null || _y === void 0 ? void 0 : _y.itemOffered) === null || _z === void 0 ? void 0 : _z.issuedThrough) === null || _0 === void 0 ? void 0 : _0.typeOf) === null || _1 === void 0 ? void 0 : _1.$eq;
|
|
384
366
|
if (typeof itemOfferedIssuedThroughTypeOfEq === 'string') {
|
|
385
367
|
andConditions.push({
|
|
386
368
|
'acceptedOffers.itemOffered.issuedThrough.typeOf': {
|
|
@@ -389,7 +371,7 @@ class MongoRepository {
|
|
|
389
371
|
}
|
|
390
372
|
});
|
|
391
373
|
}
|
|
392
|
-
const itemOfferedIssuedThroughIdIn = (
|
|
374
|
+
const itemOfferedIssuedThroughIdIn = (_5 = (_4 = (_3 = (_2 = params.acceptedOffers) === null || _2 === void 0 ? void 0 : _2.itemOffered) === null || _3 === void 0 ? void 0 : _3.issuedThrough) === null || _4 === void 0 ? void 0 : _4.id) === null || _5 === void 0 ? void 0 : _5.$in;
|
|
393
375
|
if (Array.isArray(itemOfferedIssuedThroughIdIn)) {
|
|
394
376
|
andConditions.push({
|
|
395
377
|
'acceptedOffers.itemOffered.issuedThrough.id': {
|
|
@@ -398,7 +380,7 @@ class MongoRepository {
|
|
|
398
380
|
}
|
|
399
381
|
});
|
|
400
382
|
}
|
|
401
|
-
const itemOfferedProgramMembershipUsedIdentifierEq = (
|
|
383
|
+
const itemOfferedProgramMembershipUsedIdentifierEq = (_9 = (_8 = (_7 = (_6 = params.acceptedOffers) === null || _6 === void 0 ? void 0 : _6.itemOffered) === null || _7 === void 0 ? void 0 : _7.programMembershipUsed) === null || _8 === void 0 ? void 0 : _8.identifier) === null || _9 === void 0 ? void 0 : _9.$eq;
|
|
402
384
|
if (typeof itemOfferedProgramMembershipUsedIdentifierEq === 'string') {
|
|
403
385
|
andConditions.push({
|
|
404
386
|
'acceptedOffers.itemOffered.programMembershipUsed.identifier': {
|
|
@@ -407,7 +389,7 @@ class MongoRepository {
|
|
|
407
389
|
}
|
|
408
390
|
});
|
|
409
391
|
}
|
|
410
|
-
const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq = (
|
|
392
|
+
const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq = (_15 = (_14 = (_13 = (_12 = (_11 = (_10 = params.acceptedOffers) === null || _10 === void 0 ? void 0 : _10.itemOffered) === null || _11 === void 0 ? void 0 : _11.programMembershipUsed) === null || _12 === void 0 ? void 0 : _12.issuedThrough) === null || _13 === void 0 ? void 0 : _13.serviceType) === null || _14 === void 0 ? void 0 : _14.codeValue) === null || _15 === void 0 ? void 0 : _15.$eq;
|
|
411
393
|
if (typeof itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq === 'string') {
|
|
412
394
|
andConditions.push({
|
|
413
395
|
'acceptedOffers.itemOffered.programMembershipUsed.issuedThrough.serviceType.codeValue': {
|
|
@@ -603,7 +585,7 @@ class MongoRepository {
|
|
|
603
585
|
});
|
|
604
586
|
}
|
|
605
587
|
}
|
|
606
|
-
const paymentMethodAdditionalPropertyAll = (
|
|
588
|
+
const paymentMethodAdditionalPropertyAll = (_17 = (_16 = params.paymentMethods) === null || _16 === void 0 ? void 0 : _16.additionalProperty) === null || _17 === void 0 ? void 0 : _17.$all;
|
|
607
589
|
if (Array.isArray(paymentMethodAdditionalPropertyAll)) {
|
|
608
590
|
andConditions.push({
|
|
609
591
|
'paymentMethods.additionalProperty': {
|
|
@@ -612,7 +594,7 @@ class MongoRepository {
|
|
|
612
594
|
}
|
|
613
595
|
});
|
|
614
596
|
}
|
|
615
|
-
const paymentMethodAdditionalPropertyIn = (
|
|
597
|
+
const paymentMethodAdditionalPropertyIn = (_19 = (_18 = params.paymentMethods) === null || _18 === void 0 ? void 0 : _18.additionalProperty) === null || _19 === void 0 ? void 0 : _19.$in;
|
|
616
598
|
if (Array.isArray(paymentMethodAdditionalPropertyIn)) {
|
|
617
599
|
andConditions.push({
|
|
618
600
|
'paymentMethods.additionalProperty': {
|
|
@@ -696,8 +678,9 @@ class MongoRepository {
|
|
|
696
678
|
changeStatus(params) {
|
|
697
679
|
return __awaiter(this, void 0, void 0, function* () {
|
|
698
680
|
const doc = yield this.orderModel.findOneAndUpdate({
|
|
699
|
-
orderNumber: params.orderNumber,
|
|
700
|
-
orderStatus: params.previousOrderStatus
|
|
681
|
+
orderNumber: { $eq: params.orderNumber },
|
|
682
|
+
orderStatus: { $eq: params.previousOrderStatus },
|
|
683
|
+
'project.id': { $eq: params.project.id }
|
|
701
684
|
}, { orderStatus: params.orderStatus }, {
|
|
702
685
|
new: true,
|
|
703
686
|
projection: {
|
|
@@ -711,6 +694,7 @@ class MongoRepository {
|
|
|
711
694
|
if (doc === null) {
|
|
712
695
|
const order = yield this.findByOrderNumber({
|
|
713
696
|
orderNumber: params.orderNumber,
|
|
697
|
+
project: { id: params.project.id },
|
|
714
698
|
inclusion: [],
|
|
715
699
|
exclusion: []
|
|
716
700
|
});
|
|
@@ -735,8 +719,9 @@ class MongoRepository {
|
|
|
735
719
|
returnOrder(params) {
|
|
736
720
|
return __awaiter(this, void 0, void 0, function* () {
|
|
737
721
|
const doc = yield this.orderModel.findOneAndUpdate({
|
|
738
|
-
orderNumber: params.orderNumber,
|
|
739
|
-
orderStatus: factory.orderStatus.OrderDelivered
|
|
722
|
+
orderNumber: { $eq: params.orderNumber },
|
|
723
|
+
orderStatus: { $eq: factory.orderStatus.OrderDelivered },
|
|
724
|
+
'project.id': { $eq: params.project.id }
|
|
740
725
|
}, {
|
|
741
726
|
orderStatus: factory.orderStatus.OrderReturned,
|
|
742
727
|
dateReturned: params.dateReturned,
|
|
@@ -754,6 +739,7 @@ class MongoRepository {
|
|
|
754
739
|
if (doc === null) {
|
|
755
740
|
const order = yield this.findByOrderNumber({
|
|
756
741
|
orderNumber: params.orderNumber,
|
|
742
|
+
project: { id: params.project.id },
|
|
757
743
|
inclusion: [],
|
|
758
744
|
exclusion: []
|
|
759
745
|
});
|
|
@@ -777,7 +763,10 @@ class MongoRepository {
|
|
|
777
763
|
*/
|
|
778
764
|
updateChangeableAttributes(params) {
|
|
779
765
|
return __awaiter(this, void 0, void 0, function* () {
|
|
780
|
-
const doc = yield this.orderModel.findOneAndUpdate({
|
|
766
|
+
const doc = yield this.orderModel.findOneAndUpdate({
|
|
767
|
+
orderNumber: { $eq: params.orderNumber },
|
|
768
|
+
'project.id': { $eq: params.project.id }
|
|
769
|
+
}, {
|
|
781
770
|
$set: Object.assign(Object.assign({}, (Array.isArray(params.additionalProperty)) ? { additionalProperty: params.additionalProperty } : undefined), (typeof params.name === 'string') ? { name: params.name } : undefined)
|
|
782
771
|
}, {
|
|
783
772
|
new: true,
|
|
@@ -844,7 +833,10 @@ class MongoRepository {
|
|
|
844
833
|
});
|
|
845
834
|
}
|
|
846
835
|
}
|
|
847
|
-
const doc = yield this.orderModel.findOne({
|
|
836
|
+
const doc = yield this.orderModel.findOne({
|
|
837
|
+
orderNumber: { $eq: params.orderNumber },
|
|
838
|
+
'project.id': { $eq: params.project.id }
|
|
839
|
+
}, projection)
|
|
848
840
|
.exec();
|
|
849
841
|
if (doc === null) {
|
|
850
842
|
throw new factory.errors.NotFound(this.orderModel.modelName);
|
|
@@ -853,6 +845,7 @@ class MongoRepository {
|
|
|
853
845
|
});
|
|
854
846
|
}
|
|
855
847
|
findByOrderNumberAndReservationId(params) {
|
|
848
|
+
var _a;
|
|
856
849
|
return __awaiter(this, void 0, void 0, function* () {
|
|
857
850
|
const projection = {
|
|
858
851
|
orderStatus: 1,
|
|
@@ -860,15 +853,14 @@ class MongoRepository {
|
|
|
860
853
|
orderNumber: 1,
|
|
861
854
|
_id: 0
|
|
862
855
|
};
|
|
863
|
-
const doc = yield this.orderModel.findOne({
|
|
864
|
-
orderNumber: { $eq: params.orderNumber },
|
|
865
|
-
acceptedOffers: {
|
|
856
|
+
const doc = yield this.orderModel.findOne(Object.assign({ orderNumber: { $eq: params.orderNumber }, 'project.id': { $eq: params.project.id }, acceptedOffers: {
|
|
866
857
|
$elemMatch: {
|
|
867
858
|
'itemOffered.typeOf': { $in: [factory.reservationType.BusReservation, factory.reservationType.EventReservation] },
|
|
868
859
|
'itemOffered.id': { $eq: params.reservationId }
|
|
869
860
|
}
|
|
870
|
-
}
|
|
871
|
-
|
|
861
|
+
} }, (typeof ((_a = params.seller) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
862
|
+
? { 'seller.id': { $exists: true, $eq: params.seller.id } }
|
|
863
|
+
: undefined), projection)
|
|
872
864
|
.exec();
|
|
873
865
|
if (doc === null) {
|
|
874
866
|
throw new factory.errors.NotFound(this.orderModel.modelName);
|