@chevre/domain 22.0.0-alpha.22 → 22.0.0-alpha.24
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/{searchMinimizedEvent.ts → projectEventFieldsById.ts} +8 -2
- package/example/src/chevre/projectOrderFieldsById.ts +40 -0
- package/example/src/chevre/searchOrders.ts +8 -2
- package/lib/chevre/repo/event.d.ts +6 -2
- package/lib/chevre/repo/event.js +37 -61
- package/lib/chevre/repo/order.d.ts +1 -1
- package/lib/chevre/repo/order.js +68 -32
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start.js +12 -14
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -4
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -1
- package/lib/chevre/service/offer.js +1 -1
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +1 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +1 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
- package/package.json +1 -1
|
@@ -13,12 +13,18 @@ async function main() {
|
|
|
13
13
|
|
|
14
14
|
const eventRepo: chevre.repository.Event = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
15
15
|
|
|
16
|
-
const event = await eventRepo.
|
|
16
|
+
const event = await eventRepo.projectFieldsById(
|
|
17
17
|
{
|
|
18
18
|
// id: '120162210202407171202250'
|
|
19
19
|
id: 'blxonxv1m'
|
|
20
20
|
},
|
|
21
|
-
[
|
|
21
|
+
// [
|
|
22
|
+
// 'project', 'organizer', 'typeOf',
|
|
23
|
+
// 'name', 'doorTime', 'endDate', 'eventStatus',
|
|
24
|
+
// 'location', 'startDate', 'superEvent',
|
|
25
|
+
// 'offers'
|
|
26
|
+
// ]
|
|
27
|
+
['project', 'startDate', 'typeOf', 'superEvent.location.id']
|
|
22
28
|
);
|
|
23
29
|
// tslint:disable-next-line:no-null-keyword
|
|
24
30
|
console.dir(event, { depth: null });
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
mongoose.Model.on('index', (...args) => {
|
|
9
|
+
console.error('******** index event emitted. ********\n', args);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
async function main() {
|
|
13
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
+
|
|
15
|
+
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
16
|
+
const result = await orderRepo.projectFieldsById(
|
|
17
|
+
{
|
|
18
|
+
id: '66a04d962582d528b3ba6521',
|
|
19
|
+
inclusion: ['orderNumber']
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
// tslint:disable-next-line:no-null-keyword
|
|
23
|
+
console.dir(result, { depth: null });
|
|
24
|
+
|
|
25
|
+
const findByOrderNumberResult = await orderRepo.findByOrderNumber(
|
|
26
|
+
{
|
|
27
|
+
orderNumber: 'CIN0-2152162-0949752',
|
|
28
|
+
project: { id: project.id },
|
|
29
|
+
inclusion: [
|
|
30
|
+
// 'orderNumber', 'orderStatus', 'typeOf'
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
// tslint:disable-next-line:no-null-keyword
|
|
35
|
+
console.log(findByOrderNumberResult);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
main()
|
|
39
|
+
.then(console.log)
|
|
40
|
+
.catch(console.error);
|
|
@@ -21,7 +21,7 @@ async function main() {
|
|
|
21
21
|
|
|
22
22
|
const orders = await orderRepo.search(
|
|
23
23
|
{
|
|
24
|
-
limit:
|
|
24
|
+
limit: 1,
|
|
25
25
|
project: { id: { $eq: project.id } },
|
|
26
26
|
acceptedOffers: {
|
|
27
27
|
// itemOffered: {
|
|
@@ -49,7 +49,13 @@ async function main() {
|
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
orderNumber: 1,
|
|
52
|
-
|
|
52
|
+
_id: 1,
|
|
53
|
+
id: 1
|
|
54
|
+
// customer: 1
|
|
55
|
+
// seller: 0,
|
|
56
|
+
// customer: 0,
|
|
57
|
+
// paymentMethods: 0,
|
|
58
|
+
// orderedItem: 0
|
|
53
59
|
}
|
|
54
60
|
);
|
|
55
61
|
console.log('orders found', orders);
|
|
@@ -74,7 +74,7 @@ type IKeyOfProjection<T extends factory.eventType> = keyof factory.event.IEvent<
|
|
|
74
74
|
* minimizedEvent検索時のprojection候補
|
|
75
75
|
* add(2024-07-18~)
|
|
76
76
|
*/
|
|
77
|
-
type IKeyOfProjection4minimizedEvent<T extends factory.eventType> = T extends factory.eventType.ScreeningEvent ? Exclude<keyof IMinimizedIndividualEvent<T>, 'additionalProperty'> | 'superEvent.id' | 'location.branchCode' | 'superEvent.workPerformed.identifier' | 'superEvent.location.id' | 'offers.itemOffered' | 'offers.itemOffered.id' | 'offers.offeredThrough' | 'offers.unacceptedPaymentMethod' | 'offers.eligibleQuantity' : T extends factory.eventType.Event ? Exclude<keyof IMinimizedIndividualEvent<T>, 'additionalProperty'> | 'superEvent.id' | 'location.branchCode' | 'superEvent.workPerformed.identifier' | 'superEvent.location.id' | 'offers.itemOffered' | 'offers.itemOffered.id' | 'offers.offeredThrough' | 'offers.unacceptedPaymentMethod' | 'offers.eligibleQuantity' : never;
|
|
77
|
+
type IKeyOfProjection4minimizedEvent<T extends factory.eventType> = T extends factory.eventType.ScreeningEvent ? Exclude<keyof IMinimizedIndividualEvent<T>, 'additionalProperty' | 'id'> | 'superEvent.id' | 'location.branchCode' | 'superEvent.workPerformed.identifier' | 'superEvent.location.id' | 'offers.itemOffered' | 'offers.itemOffered.id' | 'offers.offeredThrough' | 'offers.unacceptedPaymentMethod' | 'offers.eligibleQuantity' : T extends factory.eventType.Event ? Exclude<keyof IMinimizedIndividualEvent<T>, 'additionalProperty' | 'id'> | 'superEvent.id' | 'location.branchCode' | 'superEvent.workPerformed.identifier' | 'superEvent.location.id' | 'offers.itemOffered' | 'offers.itemOffered.id' | 'offers.offeredThrough' | 'offers.unacceptedPaymentMethod' | 'offers.eligibleQuantity' : never;
|
|
78
78
|
type IUnset<T extends factory.eventType> = {
|
|
79
79
|
[key in keyof factory.event.IEvent<T>]?: 1;
|
|
80
80
|
};
|
|
@@ -162,7 +162,11 @@ export declare class EventRepo {
|
|
|
162
162
|
*/
|
|
163
163
|
search<T extends factory.eventType>(params: ISearchConditions<T>, inclusion: IKeyOfProjection<T>[], exclusion: IKeyOfProjection<T>[]): Promise<Omit<factory.event.IEvent<T>, 'aggregateEntranceGate' | 'aggregateOffer'>[]>;
|
|
164
164
|
searchIds<T extends factory.eventType>(params: ISearchConditions<T>): Promise<string[]>;
|
|
165
|
-
|
|
165
|
+
/**
|
|
166
|
+
* 特定イベントから指定フィールドのみ取得する
|
|
167
|
+
* イベント IDは必ず返ります
|
|
168
|
+
*/
|
|
169
|
+
projectFieldsById<T extends factory.eventType.ScreeningEvent | factory.eventType.Event>(params: {
|
|
166
170
|
id: string;
|
|
167
171
|
}, inclusion: IKeyOfProjection4minimizedEvent<T>[]): Promise<IMinimizedIndividualEvent<T>>;
|
|
168
172
|
/**
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -38,23 +38,25 @@ const settings_1 = require("../settings");
|
|
|
38
38
|
// 'name',
|
|
39
39
|
// 'doorTime', 'endDate', 'eventStatus', 'location', 'startDate', 'offers', 'identifier'
|
|
40
40
|
// ];
|
|
41
|
-
const PROJECTION_MINIMIZED_EVENT
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
// const PROJECTION_MINIMIZED_EVENT: {
|
|
42
|
+
// [key in (IKeyOfProjection<factory.eventType.ScreeningEvent> | IKeyOfProjection<factory.eventType.Event>)]?: 1
|
|
43
|
+
// } = {
|
|
44
|
+
// project: 1,
|
|
45
|
+
// organizer: 1,
|
|
46
|
+
// _id: 1,
|
|
47
|
+
// typeOf: 1,
|
|
48
|
+
// // additionalProperty: 1, // discontinue(2024-07-20~)
|
|
49
|
+
// name: 1,
|
|
50
|
+
// doorTime: 1,
|
|
51
|
+
// endDate: 1,
|
|
52
|
+
// eventStatus: 1,
|
|
53
|
+
// location: 1,
|
|
54
|
+
// startDate: 1,
|
|
55
|
+
// superEvent: 1,
|
|
56
|
+
// offers: 1,
|
|
57
|
+
// coaInfo: 1,
|
|
58
|
+
// identifier: 1
|
|
59
|
+
// };
|
|
58
60
|
/**
|
|
59
61
|
* イベントリポジトリ
|
|
60
62
|
*/
|
|
@@ -863,45 +865,6 @@ class EventRepo {
|
|
|
863
865
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
864
866
|
});
|
|
865
867
|
}
|
|
866
|
-
// イベント集計検索廃止(2024-03-28~)
|
|
867
|
-
// public async searchAggregations(
|
|
868
|
-
// params: Pick<
|
|
869
|
-
// ISearchConditions<factory.eventType.ScreeningEvent>,
|
|
870
|
-
// 'page' | 'limit' | 'sort' | 'project' | 'typeOf' | 'id' | 'startFrom' | 'startThrough' | 'organizer'
|
|
871
|
-
// >,
|
|
872
|
-
// inclusion: ('aggregateEntranceGate' | 'aggregateOffer' | 'aggregateReservation')[]
|
|
873
|
-
// ): Promise<Pick<
|
|
874
|
-
// factory.event.IEvent<factory.eventType.ScreeningEvent>,
|
|
875
|
-
// 'aggregateEntranceGate' | 'aggregateOffer' | 'aggregateReservation' | 'id'
|
|
876
|
-
// >[]> {
|
|
877
|
-
// const conditions = MongoRepository.CREATE_MONGO_CONDITIONS<factory.eventType.ScreeningEvent>(params);
|
|
878
|
-
// let projection: IProjection<factory.eventType.ScreeningEvent> = {};
|
|
879
|
-
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
880
|
-
// inclusion.forEach((field) => {
|
|
881
|
-
// projection[field] = 1;
|
|
882
|
-
// });
|
|
883
|
-
// } else {
|
|
884
|
-
// projection = {
|
|
885
|
-
// aggregateEntranceGate: 1,
|
|
886
|
-
// aggregateOffer: 1,
|
|
887
|
-
// aggregateReservation: 1
|
|
888
|
-
// };
|
|
889
|
-
// }
|
|
890
|
-
// const query = this.eventModel.find({ $and: conditions }, projection);
|
|
891
|
-
// if (typeof params.limit === 'number' && params.limit > 0) {
|
|
892
|
-
// const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
893
|
-
// query.limit(params.limit)
|
|
894
|
-
// .skip(params.limit * (page - 1));
|
|
895
|
-
// }
|
|
896
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
897
|
-
// /* istanbul ignore else */
|
|
898
|
-
// if (params.sort?.startDate !== undefined) {
|
|
899
|
-
// query.sort({ startDate: params.sort.startDate });
|
|
900
|
-
// }
|
|
901
|
-
// return query.setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
902
|
-
// .exec()
|
|
903
|
-
// .then((docs) => docs.map((doc) => doc.toObject()));
|
|
904
|
-
// }
|
|
905
868
|
searchIds(params) {
|
|
906
869
|
return __awaiter(this, void 0, void 0, function* () {
|
|
907
870
|
const conditions = EventRepo.CREATE_MONGO_CONDITIONS(params);
|
|
@@ -910,24 +873,37 @@ class EventRepo {
|
|
|
910
873
|
.exec();
|
|
911
874
|
});
|
|
912
875
|
}
|
|
913
|
-
|
|
876
|
+
/**
|
|
877
|
+
* 特定イベントから指定フィールドのみ取得する
|
|
878
|
+
* イベント IDは必ず返ります
|
|
879
|
+
*/
|
|
880
|
+
projectFieldsById(params, inclusion // add projection(2024-07-18~)
|
|
914
881
|
) {
|
|
915
882
|
return __awaiter(this, void 0, void 0, function* () {
|
|
916
|
-
|
|
883
|
+
const projection = {
|
|
884
|
+
_id: 0,
|
|
885
|
+
id: { $toString: '$_id' }
|
|
886
|
+
};
|
|
917
887
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
918
888
|
inclusion.forEach((field) => {
|
|
919
|
-
|
|
889
|
+
if (field !== '_id' && field !== 'id') {
|
|
890
|
+
projection[field] = 1;
|
|
891
|
+
}
|
|
920
892
|
});
|
|
921
893
|
}
|
|
922
894
|
else {
|
|
923
|
-
|
|
895
|
+
// discontinue(2024-07-24~)
|
|
896
|
+
throw new factory.errors.ArgumentNull('inclusion', 'inclusion must be specified');
|
|
897
|
+
// projection = PROJECTION_MINIMIZED_EVENT;
|
|
924
898
|
}
|
|
925
899
|
const doc = yield this.eventModel.findOne({ _id: { $eq: params.id } }, projection)
|
|
900
|
+
.lean() // lean(2024-07-24~)
|
|
926
901
|
.exec();
|
|
927
902
|
if (doc === null) {
|
|
928
903
|
throw new factory.errors.NotFound(this.eventModel.modelName);
|
|
929
904
|
}
|
|
930
|
-
return doc
|
|
905
|
+
return doc;
|
|
906
|
+
// return doc.toObject();
|
|
931
907
|
});
|
|
932
908
|
}
|
|
933
909
|
/**
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -853,38 +853,41 @@ class OrderRepo {
|
|
|
853
853
|
}
|
|
854
854
|
});
|
|
855
855
|
}
|
|
856
|
-
|
|
856
|
+
projectFieldsById(params) {
|
|
857
857
|
return __awaiter(this, void 0, void 0, function* () {
|
|
858
|
-
|
|
858
|
+
const projection = {
|
|
859
|
+
// _id: 1
|
|
860
|
+
_id: 0,
|
|
861
|
+
id: { $toString: '$_id' }
|
|
862
|
+
};
|
|
859
863
|
if (Array.isArray(params.inclusion) && params.inclusion.length > 0) {
|
|
860
864
|
params.inclusion.forEach((field) => {
|
|
861
|
-
if (String(field) !== 'acceptedOffers') {
|
|
865
|
+
if (String(field) !== 'acceptedOffers' && field !== '_id' && field !== 'id') {
|
|
862
866
|
projection[field] = 1;
|
|
863
867
|
}
|
|
864
868
|
});
|
|
865
869
|
}
|
|
866
870
|
else {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
//
|
|
874
|
-
//
|
|
875
|
-
// projection[field] = 0;
|
|
876
|
-
// });
|
|
877
|
-
// }
|
|
871
|
+
// discontinue(2024-07-25~)
|
|
872
|
+
throw new factory.errors.ArgumentNull('inclusion', 'inclusion must be specified');
|
|
873
|
+
// projection = {
|
|
874
|
+
// __v: 0,
|
|
875
|
+
// createdAt: 0,
|
|
876
|
+
// updatedAt: 0,
|
|
877
|
+
// acceptedOffers: 0
|
|
878
|
+
// };
|
|
878
879
|
}
|
|
879
880
|
const doc = yield this.orderModel.findOne({
|
|
880
|
-
_id: params.id,
|
|
881
|
+
_id: { $eq: params.id },
|
|
881
882
|
typeOf: { $eq: factory.order.OrderType.Order }
|
|
882
883
|
}, projection)
|
|
884
|
+
.lean() // lean(2024-07-25~)
|
|
883
885
|
.exec();
|
|
884
886
|
if (doc === null) {
|
|
885
887
|
throw new factory.errors.NotFound(this.orderModel.modelName);
|
|
886
888
|
}
|
|
887
|
-
return doc
|
|
889
|
+
return doc;
|
|
890
|
+
// return doc.toObject();
|
|
888
891
|
});
|
|
889
892
|
}
|
|
890
893
|
/**
|
|
@@ -892,10 +895,15 @@ class OrderRepo {
|
|
|
892
895
|
*/
|
|
893
896
|
findByOrderNumber(params) {
|
|
894
897
|
return __awaiter(this, void 0, void 0, function* () {
|
|
895
|
-
let
|
|
898
|
+
let useInclusionProjection = false;
|
|
899
|
+
let projection = {
|
|
900
|
+
_id: 0,
|
|
901
|
+
id: { $toString: '$_id' }
|
|
902
|
+
};
|
|
896
903
|
if (Array.isArray(params.inclusion) && params.inclusion.length > 0) {
|
|
904
|
+
useInclusionProjection = true;
|
|
897
905
|
params.inclusion.forEach((field) => {
|
|
898
|
-
if (String(field) !== 'acceptedOffers') {
|
|
906
|
+
if (String(field) !== 'acceptedOffers' && field !== '_id' && field !== 'id') {
|
|
899
907
|
projection[field] = 1;
|
|
900
908
|
}
|
|
901
909
|
});
|
|
@@ -913,16 +921,31 @@ class OrderRepo {
|
|
|
913
921
|
// });
|
|
914
922
|
// }
|
|
915
923
|
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
+
if (useInclusionProjection) {
|
|
925
|
+
const doc = yield this.orderModel.findOne({
|
|
926
|
+
orderNumber: { $eq: params.orderNumber },
|
|
927
|
+
'project.id': { $eq: params.project.id },
|
|
928
|
+
typeOf: { $eq: factory.order.OrderType.Order }
|
|
929
|
+
}, projection)
|
|
930
|
+
.lean() // lean(2024-07-25~)
|
|
931
|
+
.exec();
|
|
932
|
+
if (doc === null) {
|
|
933
|
+
throw new factory.errors.NotFound(this.orderModel.modelName);
|
|
934
|
+
}
|
|
935
|
+
return doc;
|
|
936
|
+
}
|
|
937
|
+
else {
|
|
938
|
+
const doc = yield this.orderModel.findOne({
|
|
939
|
+
orderNumber: { $eq: params.orderNumber },
|
|
940
|
+
'project.id': { $eq: params.project.id },
|
|
941
|
+
typeOf: { $eq: factory.order.OrderType.Order }
|
|
942
|
+
}, projection)
|
|
943
|
+
.exec();
|
|
944
|
+
if (doc === null) {
|
|
945
|
+
throw new factory.errors.NotFound(this.orderModel.modelName);
|
|
946
|
+
}
|
|
947
|
+
return doc.toObject();
|
|
924
948
|
}
|
|
925
|
-
return doc.toObject();
|
|
926
949
|
});
|
|
927
950
|
}
|
|
928
951
|
findByOrderNumberAndReservationId(params) {
|
|
@@ -980,15 +1003,21 @@ class OrderRepo {
|
|
|
980
1003
|
var _a;
|
|
981
1004
|
return __awaiter(this, void 0, void 0, function* () {
|
|
982
1005
|
const conditions = OrderRepo.CREATE_MONGO_CONDITIONS(params);
|
|
1006
|
+
let useInclusionProjection = false;
|
|
983
1007
|
let projectStage = {};
|
|
984
1008
|
const positiveProjectionFields = (projection !== undefined && projection !== null)
|
|
985
1009
|
? Object.keys(projection)
|
|
986
1010
|
.filter((key) => projection[key] !== 0
|
|
987
1011
|
&& key !== 'acceptedOffers' // defaultで隠蔽(2023-12-06~)
|
|
988
|
-
|
|
1012
|
+
&& key !== '_id'
|
|
1013
|
+
&& key !== 'id')
|
|
989
1014
|
: [];
|
|
990
1015
|
if (Array.isArray(positiveProjectionFields) && positiveProjectionFields.length > 0) {
|
|
991
|
-
|
|
1016
|
+
useInclusionProjection = true;
|
|
1017
|
+
projectStage = {
|
|
1018
|
+
_id: 0,
|
|
1019
|
+
id: { $toString: '$_id' }
|
|
1020
|
+
};
|
|
992
1021
|
positiveProjectionFields.forEach((field) => {
|
|
993
1022
|
projectStage[field] = 1;
|
|
994
1023
|
});
|
|
@@ -1010,9 +1039,16 @@ class OrderRepo {
|
|
|
1010
1039
|
}
|
|
1011
1040
|
// const explainResult = await (<any>query).explain();
|
|
1012
1041
|
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
1013
|
-
|
|
1014
|
-
.
|
|
1015
|
-
|
|
1042
|
+
if (useInclusionProjection) {
|
|
1043
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
1044
|
+
.lean() // lean(2024-07-25~)
|
|
1045
|
+
.exec();
|
|
1046
|
+
}
|
|
1047
|
+
else {
|
|
1048
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
1049
|
+
.exec()
|
|
1050
|
+
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
1051
|
+
}
|
|
1016
1052
|
});
|
|
1017
1053
|
}
|
|
1018
1054
|
getCursor(conditions, projection) {
|
|
@@ -21,7 +21,7 @@ const debug = createDebug('chevre-domain:service:aggregation');
|
|
|
21
21
|
function aggregateOffers(params) {
|
|
22
22
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
// 集計対象イベント検索
|
|
24
|
-
const event = yield repos.event.
|
|
24
|
+
const event = yield repos.event.projectFieldsById({ id: params.id }, [
|
|
25
25
|
'location', 'project', 'startDate', 'typeOf', 'superEvent.location.id', 'offers.itemOffered'
|
|
26
26
|
] // projection(2024-07-21~)
|
|
27
27
|
);
|
|
@@ -24,7 +24,7 @@ const debug = createDebug('chevre-domain:service:aggregation');
|
|
|
24
24
|
function aggregateScreeningEvent(params) {
|
|
25
25
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
// 集計対象イベント検索
|
|
27
|
-
const event = yield repos.event.
|
|
27
|
+
const event = yield repos.event.projectFieldsById({ id: params.id }, ['location', 'project', 'startDate', 'typeOf', 'superEvent.location.id', 'offers.itemOffered']);
|
|
28
28
|
let aggregatingEvents = [event];
|
|
29
29
|
// プロジェクト限定(2023-02-22~)
|
|
30
30
|
if (settings.useOfferRateLimitProjects.includes(event.project.id)) {
|
|
@@ -22,7 +22,7 @@ function aggregateUseActionsOnEvent(params) {
|
|
|
22
22
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
const now = new Date();
|
|
24
24
|
// 集計対象イベント検索
|
|
25
|
-
const event = yield repos.event.
|
|
25
|
+
const event = yield repos.event.projectFieldsById(params, ['offers.itemOffered.id', 'project', 'startDate', 'superEvent', 'typeOf'] // optimize projection(2024-07-19~)
|
|
26
26
|
);
|
|
27
27
|
// 入場ゲート検索
|
|
28
28
|
const entranceGates = yield findEntranceGates({ event })(repos);
|
|
@@ -84,20 +84,18 @@ function fixEvent(params) {
|
|
|
84
84
|
if (typeof reservationForId !== 'string' || reservationForId.length === 0) {
|
|
85
85
|
throw new factory.errors.ArgumentNull('object.reservationFor.id');
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (offeredThrough.identifier === factory.service.webAPI.Identifier.COA) {
|
|
100
|
-
throw new factory.errors.NotImplemented(`${offeredThrough.identifier} not implemented`);
|
|
87
|
+
const event = yield repos.event.projectFieldsById({ id: reservationForId }, [
|
|
88
|
+
'project', 'organizer', 'typeOf',
|
|
89
|
+
// additionalProperty, // discontinue(2024-07-20~)
|
|
90
|
+
'name', 'doorTime', 'endDate', 'eventStatus',
|
|
91
|
+
'location', 'startDate', 'superEvent',
|
|
92
|
+
'offers'
|
|
93
|
+
// 'coaInfo', // discontinue(2024-07-24~)
|
|
94
|
+
// 'identifier' // discontinue(2024-07-24~)
|
|
95
|
+
]);
|
|
96
|
+
const offeredThroughIdentifier = (_b = event.offers.offeredThrough) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
97
|
+
if (offeredThroughIdentifier === factory.service.webAPI.Identifier.COA) {
|
|
98
|
+
throw new factory.errors.NotImplemented(`${offeredThroughIdentifier} not implemented`);
|
|
101
99
|
}
|
|
102
100
|
return event;
|
|
103
101
|
});
|
|
@@ -2,7 +2,7 @@ import * as factory from '../../../factory';
|
|
|
2
2
|
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
3
3
|
declare function validateStartRequest(params: {
|
|
4
4
|
object: factory.assetTransaction.reserve.IObjectWithoutDetail;
|
|
5
|
-
event: IMinimizedIndividualEvent<factory.eventType.Event | factory.eventType.ScreeningEvent>;
|
|
5
|
+
event: Pick<IMinimizedIndividualEvent<factory.eventType.Event | factory.eventType.ScreeningEvent>, 'offers' | 'id'>;
|
|
6
6
|
validateEventOfferPeriod?: boolean;
|
|
7
7
|
validateEvent?: boolean;
|
|
8
8
|
now: Date;
|
|
@@ -313,7 +313,7 @@ function searchEventTicketOffers(params) {
|
|
|
313
313
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
314
314
|
const eventType = params.event.typeOf;
|
|
315
315
|
// optimize projection(2024-07-17~)
|
|
316
|
-
const event = yield repos.event.
|
|
316
|
+
const event = yield repos.event.projectFieldsById({ id: params.event.id }, [
|
|
317
317
|
'project', 'typeOf', 'startDate',
|
|
318
318
|
'superEvent.id',
|
|
319
319
|
'offers.itemOffered.id', 'offers.offeredThrough', 'offers.unacceptedPaymentMethod', 'offers.eligibleQuantity'
|
|
@@ -358,7 +358,7 @@ function searchOfferAppliesToMovieTicket(params) {
|
|
|
358
358
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
359
359
|
var _a, _b, _c;
|
|
360
360
|
// optimize(2024-07-18~)
|
|
361
|
-
const event = yield repos.event.
|
|
361
|
+
const event = yield repos.event.projectFieldsById({ id: params.event.id }, ['project', 'startDate', 'typeOf', 'superEvent.id', 'offers.itemOffered.id', 'offers.unacceptedPaymentMethod']);
|
|
362
362
|
// let soundFormatTypes: string[] = [];
|
|
363
363
|
let videoFormatTypes = [];
|
|
364
364
|
if (event.typeOf === factory.eventType.ScreeningEvent) {
|
|
@@ -437,7 +437,7 @@ function searchOfferCatalogItems(params) {
|
|
|
437
437
|
}
|
|
438
438
|
let offerCatalogItems = [];
|
|
439
439
|
// optimize(2024-07-18~)
|
|
440
|
-
const event = yield repos.event.
|
|
440
|
+
const event = yield repos.event.projectFieldsById({ id: params.event.id }, ['offers.itemOffered.id']);
|
|
441
441
|
// 興行設定があれば興行のカタログを参照する
|
|
442
442
|
const eventOffers = event.offers;
|
|
443
443
|
let catalogId;
|
|
@@ -507,7 +507,7 @@ function searchOfferCatalogItemAvailability(params) {
|
|
|
507
507
|
}
|
|
508
508
|
let availabilities = [];
|
|
509
509
|
// optimize(2024-07-18~)
|
|
510
|
-
const event = yield repos.event.
|
|
510
|
+
const event = yield repos.event.projectFieldsById({ id: params.event.id }, ['project', 'offers.itemOffered.id']);
|
|
511
511
|
// 興行設定があれば興行のカタログを参照する
|
|
512
512
|
const eventOffers = event.offers;
|
|
513
513
|
let catalogId;
|
|
@@ -48,7 +48,7 @@ function authorize(params) {
|
|
|
48
48
|
typeOf: factory.assetTransactionType.COAReserveTransaction
|
|
49
49
|
};
|
|
50
50
|
try {
|
|
51
|
-
screeningEvent = yield repos.event.
|
|
51
|
+
screeningEvent = yield repos.event.projectFieldsById({ id: params.object.event.id }, [
|
|
52
52
|
'coaInfo', 'doorTime', 'endDate', 'location', 'startDate',
|
|
53
53
|
'superEvent', 'typeOf', 'identifier', 'name'
|
|
54
54
|
] // optimize(2024-07-18~)
|
|
@@ -72,7 +72,7 @@ function changeOffers(params) {
|
|
|
72
72
|
return Object.assign(Object.assign({}, offer), { ticketInfo: Object.assign(Object.assign({}, offer.ticketInfo), { spseatAdd1: originalAcceptedOfferBySeatNumber.ticketInfo.spseatAdd1, spseatAdd2: originalAcceptedOfferBySeatNumber.ticketInfo.spseatAdd2, spseatKbn: originalAcceptedOfferBySeatNumber.ticketInfo.spseatKbn }) });
|
|
73
73
|
});
|
|
74
74
|
// イベント取得属性最適化(2023-01-23~)
|
|
75
|
-
const screeningEvent = yield repos.event.
|
|
75
|
+
const screeningEvent = yield repos.event.projectFieldsById({ id: params.object.event.id }, [
|
|
76
76
|
'coaInfo', 'doorTime', 'endDate', 'location', 'startDate',
|
|
77
77
|
'superEvent', 'typeOf', 'identifier', 'name'
|
|
78
78
|
] // optimize(2024-07-18~)
|
|
@@ -66,7 +66,7 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
66
66
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
67
67
|
let offers = [];
|
|
68
68
|
// optimize(2024-07-18~)
|
|
69
|
-
const event = yield repos.event.
|
|
69
|
+
const event = yield repos.event.projectFieldsById({ id: params.event.id }, ['project', 'startDate', 'offers.itemOffered']);
|
|
70
70
|
// 座席指定利用可能かどうか
|
|
71
71
|
const eventOffers = event.offers;
|
|
72
72
|
const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
|
|
@@ -53,7 +53,7 @@ function checkMovieTicket(params) {
|
|
|
53
53
|
if (eventIds.length !== 1) {
|
|
54
54
|
throw new factory.errors.Argument('movieTickets', 'Number of events must be 1');
|
|
55
55
|
}
|
|
56
|
-
const screeningEvent = yield repos.event.
|
|
56
|
+
const screeningEvent = yield repos.event.projectFieldsById({ id: eventIds[0] }, [
|
|
57
57
|
'typeOf', 'project', 'coaInfo', 'startDate', 'offers.offeredThrough', 'superEvent.workPerformed.identifier'
|
|
58
58
|
] // optimize projection(2024-07-19~)
|
|
59
59
|
);
|
|
@@ -111,7 +111,7 @@ function payActionParams2seatInfoSyncIn(params) {
|
|
|
111
111
|
if (eventIds.length !== 1) {
|
|
112
112
|
throw new factory.errors.Argument('movieTickets', 'Number of events must be 1');
|
|
113
113
|
}
|
|
114
|
-
const event = yield repos.event.
|
|
114
|
+
const event = yield repos.event.projectFieldsById({ id: eventIds[0] },
|
|
115
115
|
// optimize projection(2024-07-19~)
|
|
116
116
|
[
|
|
117
117
|
'coaInfo', 'startDate', 'project',
|
|
@@ -45,7 +45,7 @@ function validateMovieTicket(params, paymentServiceId, useCheckByIdentifierIfNot
|
|
|
45
45
|
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
46
46
|
}
|
|
47
47
|
// イベント取得属性最適化(2023-01-23~)
|
|
48
|
-
const screeningEvent = yield repos.event.
|
|
48
|
+
const screeningEvent = yield repos.event.projectFieldsById({ id: eventIds[0] }, [
|
|
49
49
|
'typeOf', 'project', 'coaInfo', 'startDate', 'offers.offeredThrough', 'superEvent.workPerformed.identifier'
|
|
50
50
|
] // optimize(2024-07-18~)
|
|
51
51
|
);
|
package/package.json
CHANGED