@chevre/domain 21.14.0 → 21.15.0-alpha.1
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/aggregateAllEvents.ts +12 -8
- package/example/src/chevre/searchEvents.ts +5 -7
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/factory/event.js +2 -8
- package/lib/chevre/repo/event.d.ts +14 -29
- package/lib/chevre/repo/event.js +47 -56
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +28 -13
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +6 -8
- package/lib/chevre/service/offer.js +25 -7
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +3 -1
- package/lib/chevre/service/transaction/returnOrder.js +5 -3
- package/package.json +1 -1
|
@@ -14,14 +14,18 @@ async function main() {
|
|
|
14
14
|
|
|
15
15
|
const now = new Date();
|
|
16
16
|
|
|
17
|
-
const events = await eventRepo.search<chevre.factory.eventType.ScreeningEvent>(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
const events = await eventRepo.search<chevre.factory.eventType.ScreeningEvent>(
|
|
18
|
+
{
|
|
19
|
+
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
20
|
+
project: { id: { $eq: project.id } },
|
|
21
|
+
startFrom: now
|
|
22
|
+
// startFrom: moment().add(-1, 'day').toDate(),
|
|
23
|
+
// startThrough: moment().add(1, 'day').toDate(),
|
|
24
|
+
// startThrough: now
|
|
25
|
+
},
|
|
26
|
+
[],
|
|
27
|
+
[]
|
|
28
|
+
);
|
|
25
29
|
|
|
26
30
|
// console.log(events);
|
|
27
31
|
console.log(events.length);
|
|
@@ -15,18 +15,16 @@ async function main() {
|
|
|
15
15
|
|
|
16
16
|
const events = await eventRepo.search(
|
|
17
17
|
{
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
limit: 100,
|
|
19
|
+
page: 1,
|
|
20
20
|
// sort: { startDate: 1 },
|
|
21
21
|
// typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
22
22
|
project: { id: { $eq: PROJECT_ID } },
|
|
23
|
-
id: { $eq: 'al6aff83y' },
|
|
23
|
+
// id: { $eq: 'al6aff83y' },
|
|
24
24
|
typeOfIn: [chevre.factory.eventType.Event, chevre.factory.eventType.ScreeningEvent]
|
|
25
25
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// name: 1
|
|
29
|
-
}
|
|
26
|
+
['_id', 'name'],
|
|
27
|
+
[]
|
|
30
28
|
);
|
|
31
29
|
console.log(events);
|
|
32
30
|
console.log(events.length, 'events found');
|
|
@@ -4,5 +4,5 @@ export type IMinimizedIndividualEvent<T extends factory.eventType.ScreeningEvent
|
|
|
4
4
|
* 興行イベントのsuperEventを作成する
|
|
5
5
|
*/
|
|
6
6
|
export declare function minimizeSuperEvent(params: {
|
|
7
|
-
superEventFromDB: factory.event.screeningEventSeries.IEvent
|
|
7
|
+
superEventFromDB: Omit<factory.event.screeningEventSeries.IEvent, 'offers'>;
|
|
8
8
|
}): factory.event.screeningEvent.ISuperEvent;
|
|
@@ -6,10 +6,7 @@ const factory = require("../factory");
|
|
|
6
6
|
* 興行イベントのsuperEventを作成する
|
|
7
7
|
*/
|
|
8
8
|
function minimizeSuperEvent(params) {
|
|
9
|
-
const workPerformed = Object.assign(Object.assign(Object.assign(Object.assign({
|
|
10
|
-
// 不要なので廃止(2022-12-19~)
|
|
11
|
-
// project: { typeOf: chevre.factory.organizationType.Project, id: params.project.id },
|
|
12
|
-
typeOf: factory.creativeWorkType.Movie, identifier: String(params.superEventFromDB.workPerformed.identifier) }, (typeof params.superEventFromDB.workPerformed.id === 'string')
|
|
9
|
+
const workPerformed = Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: factory.creativeWorkType.Movie, identifier: String(params.superEventFromDB.workPerformed.identifier) }, (typeof params.superEventFromDB.workPerformed.id === 'string')
|
|
13
10
|
? { id: params.superEventFromDB.workPerformed.id }
|
|
14
11
|
: undefined), (params.superEventFromDB.workPerformed.name !== undefined)
|
|
15
12
|
? { name: params.superEventFromDB.workPerformed.name }
|
|
@@ -18,10 +15,7 @@ function minimizeSuperEvent(params) {
|
|
|
18
15
|
: undefined), (typeof params.superEventFromDB.workPerformed.contentRating === 'string')
|
|
19
16
|
? { contentRating: params.superEventFromDB.workPerformed.contentRating }
|
|
20
17
|
: undefined);
|
|
21
|
-
const location = Object.assign(Object.assign({
|
|
22
|
-
// 不要なので廃止(2022-12-19~)
|
|
23
|
-
// project: { typeOf: chevre.factory.organizationType.Project, id: params.project.id },
|
|
24
|
-
typeOf: factory.placeType.MovieTheater, id: params.superEventFromDB.location.id, branchCode: params.superEventFromDB.location.branchCode }, (params.superEventFromDB.location.name !== undefined)
|
|
18
|
+
const location = Object.assign(Object.assign({ typeOf: factory.placeType.MovieTheater, id: params.superEventFromDB.location.id, branchCode: params.superEventFromDB.location.branchCode }, (params.superEventFromDB.location.name !== undefined)
|
|
25
19
|
? { name: params.superEventFromDB.location.name }
|
|
26
20
|
: undefined), (typeof params.superEventFromDB.location.kanaName === 'string')
|
|
27
21
|
? { kanaName: params.superEventFromDB.location.kanaName }
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import type { BulkWriteResult } from 'mongodb';
|
|
26
|
-
import type { Connection } from 'mongoose';
|
|
26
|
+
import type { Connection, FilterQuery } from 'mongoose';
|
|
27
27
|
import * as factory from '../factory';
|
|
28
28
|
import * as EventFactory from '../factory/event';
|
|
29
29
|
export interface IAttributes4patchUpdate<T extends factory.eventType> {
|
|
@@ -74,38 +74,23 @@ interface IStatus {
|
|
|
74
74
|
status: factory.eventStatusType;
|
|
75
75
|
aggregation: IAggregationByStatus;
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
interface IAggregateEvent {
|
|
78
78
|
statuses: IStatus[];
|
|
79
79
|
}
|
|
80
|
-
type IKeyOfProjection<T extends factory.eventType> = keyof factory.event.IEvent<T>
|
|
81
|
-
type
|
|
82
|
-
[key in
|
|
80
|
+
type IKeyOfProjection<T extends factory.eventType> = keyof factory.event.IEvent<T> | '_id' | '__v' | 'createdAt' | 'updatedAt';
|
|
81
|
+
type IUnset<T extends factory.eventType> = {
|
|
82
|
+
[key in keyof factory.event.IEvent<T>]?: 1;
|
|
83
83
|
};
|
|
84
84
|
export import IMinimizedIndividualEvent = EventFactory.IMinimizedIndividualEvent;
|
|
85
|
-
export declare const
|
|
86
|
-
|
|
87
|
-
organizer: number;
|
|
88
|
-
_id: number;
|
|
89
|
-
typeOf: number;
|
|
90
|
-
additionalProperty: number;
|
|
91
|
-
name: number;
|
|
92
|
-
doorTime: number;
|
|
93
|
-
endDate: number;
|
|
94
|
-
eventStatus: number;
|
|
95
|
-
location: number;
|
|
96
|
-
startDate: number;
|
|
97
|
-
superEvent: number;
|
|
98
|
-
offers: number;
|
|
99
|
-
coaInfo: number;
|
|
100
|
-
identifier: number;
|
|
101
|
-
};
|
|
85
|
+
export declare const keyOfMinimizedScreeningEvent: IKeyOfProjection<factory.eventType.ScreeningEvent>[];
|
|
86
|
+
export declare const keyOfMinimizedEvent: IKeyOfProjection<factory.eventType.Event>[];
|
|
102
87
|
/**
|
|
103
88
|
* イベントリポジトリ
|
|
104
89
|
*/
|
|
105
90
|
export declare class MongoRepository {
|
|
106
91
|
private readonly eventModel;
|
|
107
92
|
constructor(connection: Connection);
|
|
108
|
-
static CREATE_MONGO_CONDITIONS<T extends factory.eventType>(conditions: ISearchConditions<T>):
|
|
93
|
+
static CREATE_MONGO_CONDITIONS<T extends factory.eventType>(conditions: ISearchConditions<T>): FilterQuery<factory.event.IEvent<T>>[];
|
|
109
94
|
/**
|
|
110
95
|
* 複数イベントを作成する
|
|
111
96
|
*/
|
|
@@ -150,13 +135,13 @@ export declare class MongoRepository {
|
|
|
150
135
|
save<T extends factory.eventType>(params: {
|
|
151
136
|
id?: string;
|
|
152
137
|
attributes: factory.event.IAttributes<T>;
|
|
153
|
-
$unset?:
|
|
138
|
+
$unset?: IUnset<T>;
|
|
154
139
|
upsert?: boolean;
|
|
155
140
|
}): Promise<factory.event.IEvent<T>>;
|
|
156
141
|
saveMany<T extends factory.eventType>(params: {
|
|
157
142
|
id: string;
|
|
158
143
|
attributes: factory.event.IAttributes<T>;
|
|
159
|
-
$unset?:
|
|
144
|
+
$unset?: IUnset<T>;
|
|
160
145
|
upsert: boolean;
|
|
161
146
|
}[]): Promise<void>;
|
|
162
147
|
save4ttts(params: {
|
|
@@ -166,7 +151,7 @@ export declare class MongoRepository {
|
|
|
166
151
|
/**
|
|
167
152
|
* イベントを検索する
|
|
168
153
|
*/
|
|
169
|
-
search<T extends factory.eventType>(params: ISearchConditions<T>,
|
|
154
|
+
search<T extends factory.eventType>(params: ISearchConditions<T>, inclusion: IKeyOfProjection<T>[], exclusion: IKeyOfProjection<T>[]): Promise<factory.event.IEvent<T>[]>;
|
|
170
155
|
searchIds<T extends factory.eventType>(params: ISearchConditions<T>): Promise<string[]>;
|
|
171
156
|
findMinimizedIndividualEventById<T extends factory.eventType.ScreeningEvent | factory.eventType.Event>(params: {
|
|
172
157
|
id: string;
|
|
@@ -297,10 +282,10 @@ export declare class MongoRepository {
|
|
|
297
282
|
validationErrors: import("mongoose").Error[];
|
|
298
283
|
} | undefined;
|
|
299
284
|
}>;
|
|
300
|
-
getCursor(conditions: any
|
|
285
|
+
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
|
|
301
286
|
unsetUnnecessaryFields(params: {
|
|
302
|
-
filter: any
|
|
303
|
-
$unset: any
|
|
287
|
+
filter: FilterQuery<any>;
|
|
288
|
+
$unset: IUnset<any>;
|
|
304
289
|
}): Promise<import("mongodb").UpdateResult>;
|
|
305
290
|
/**
|
|
306
291
|
* 既存施設コンテンツの最大バージョンを集計する
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -20,13 +20,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.MongoRepository = exports.
|
|
23
|
+
exports.MongoRepository = exports.keyOfMinimizedEvent = exports.keyOfMinimizedScreeningEvent = void 0;
|
|
24
24
|
const factory = require("../factory");
|
|
25
25
|
const EventFactory = require("../factory/event");
|
|
26
26
|
const event_1 = require("./mongoose/schemas/event");
|
|
27
27
|
const errorHandler_1 = require("../errorHandler");
|
|
28
28
|
const settings_1 = require("../settings");
|
|
29
|
-
exports.
|
|
29
|
+
exports.keyOfMinimizedScreeningEvent = [
|
|
30
|
+
'project', 'organizer', '_id', 'typeOf', 'additionalProperty', 'name',
|
|
31
|
+
'doorTime', 'endDate', 'eventStatus', 'location', 'startDate', 'superEvent', 'offers', 'coaInfo', 'identifier'
|
|
32
|
+
];
|
|
33
|
+
exports.keyOfMinimizedEvent = [
|
|
34
|
+
'project', 'organizer', '_id', 'typeOf', 'additionalProperty', 'name',
|
|
35
|
+
'doorTime', 'endDate', 'eventStatus', 'location', 'startDate', 'offers', 'identifier'
|
|
36
|
+
];
|
|
37
|
+
const PROJECTION_MINIMIZED_EVENT = {
|
|
30
38
|
project: 1,
|
|
31
39
|
organizer: 1,
|
|
32
40
|
_id: 1,
|
|
@@ -735,32 +743,48 @@ class MongoRepository {
|
|
|
735
743
|
return doc.toObject();
|
|
736
744
|
});
|
|
737
745
|
}
|
|
738
|
-
// public async count<T extends factory.eventType>(
|
|
739
|
-
// params: ISearchConditions<T>
|
|
740
|
-
// ): Promise<number> {
|
|
741
|
-
// const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
742
|
-
// return this.eventModel.countDocuments(
|
|
743
|
-
// { $and: conditions }
|
|
744
|
-
// )
|
|
745
|
-
// .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
746
|
-
// .exec();
|
|
747
|
-
// }
|
|
748
746
|
/**
|
|
749
747
|
* イベントを検索する
|
|
750
748
|
*/
|
|
751
|
-
search(params,
|
|
749
|
+
search(params,
|
|
750
|
+
// projection?: IProjection<T>
|
|
751
|
+
inclusion, exclusion) {
|
|
752
752
|
var _a;
|
|
753
753
|
return __awaiter(this, void 0, void 0, function* () {
|
|
754
754
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
755
|
+
let projection = {};
|
|
756
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
757
|
+
inclusion.forEach((field) => {
|
|
758
|
+
projection[field] = 1;
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
else {
|
|
762
|
+
projection = {
|
|
763
|
+
__v: 0,
|
|
764
|
+
createdAt: 0,
|
|
765
|
+
updatedAt: 0
|
|
766
|
+
};
|
|
767
|
+
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
768
|
+
exclusion.forEach((field) => {
|
|
769
|
+
projection[field] = 0;
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
// const positiveProjectionExists: boolean = (projection !== undefined && projection !== null)
|
|
774
|
+
// ? Object.values(projection)
|
|
775
|
+
// .some((value) => value !== 0)
|
|
776
|
+
// : false;
|
|
777
|
+
const query = this.eventModel.find({ $and: conditions }, projection
|
|
760
778
|
// :1対応(2023-01-25~)
|
|
761
|
-
(positiveProjectionExists)
|
|
762
|
-
|
|
763
|
-
|
|
779
|
+
// (positiveProjectionExists)
|
|
780
|
+
// ? projection
|
|
781
|
+
// : {
|
|
782
|
+
// ...projection,
|
|
783
|
+
// __v: 0,
|
|
784
|
+
// createdAt: 0,
|
|
785
|
+
// updatedAt: 0
|
|
786
|
+
// }
|
|
787
|
+
);
|
|
764
788
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
765
789
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
766
790
|
query.limit(params.limit)
|
|
@@ -792,42 +816,9 @@ class MongoRepository {
|
|
|
792
816
|
.exec();
|
|
793
817
|
});
|
|
794
818
|
}
|
|
795
|
-
// searchに置き換え(2023-07-13~)
|
|
796
|
-
// public async findById<T extends factory.eventType>(
|
|
797
|
-
// params: {
|
|
798
|
-
// project: { id: string };
|
|
799
|
-
// id: string;
|
|
800
|
-
// },
|
|
801
|
-
// projection?: IProjection
|
|
802
|
-
// ): Promise<factory.event.IEvent<T>> {
|
|
803
|
-
// const positiveProjectionExists: boolean = (projection !== undefined && projection !== null)
|
|
804
|
-
// ? Object.values(projection)
|
|
805
|
-
// .some((value) => value !== 0)
|
|
806
|
-
// : false;
|
|
807
|
-
// const doc = await this.eventModel.findOne(
|
|
808
|
-
// {
|
|
809
|
-
// _id: params.id,
|
|
810
|
-
// 'project.id': { $eq: params.project.id }
|
|
811
|
-
// },
|
|
812
|
-
// // :1対応(2023-01-25~)
|
|
813
|
-
// (positiveProjectionExists)
|
|
814
|
-
// ? projection
|
|
815
|
-
// : {
|
|
816
|
-
// ...projection,
|
|
817
|
-
// __v: 0,
|
|
818
|
-
// createdAt: 0,
|
|
819
|
-
// updatedAt: 0
|
|
820
|
-
// }
|
|
821
|
-
// )
|
|
822
|
-
// .exec();
|
|
823
|
-
// if (doc === null) {
|
|
824
|
-
// throw new factory.errors.NotFound(this.eventModel.modelName);
|
|
825
|
-
// }
|
|
826
|
-
// return doc.toObject();
|
|
827
|
-
// }
|
|
828
819
|
findMinimizedIndividualEventById(params) {
|
|
829
820
|
return __awaiter(this, void 0, void 0, function* () {
|
|
830
|
-
const doc = yield this.eventModel.findOne({ _id: params.id },
|
|
821
|
+
const doc = yield this.eventModel.findOne({ _id: params.id }, PROJECTION_MINIMIZED_EVENT)
|
|
831
822
|
.exec();
|
|
832
823
|
if (doc === null) {
|
|
833
824
|
throw new factory.errors.NotFound(this.eventModel.modelName);
|
|
@@ -858,7 +849,7 @@ class MongoRepository {
|
|
|
858
849
|
typeOf: factory.eventType.ScreeningEventSeries,
|
|
859
850
|
id: { $eq: params.superEvent.id },
|
|
860
851
|
project: { id: { $eq: params.project.id } }
|
|
861
|
-
});
|
|
852
|
+
}, [], ['offers']);
|
|
862
853
|
const superEventFromDB = superEvents.shift();
|
|
863
854
|
if (superEventFromDB === undefined) {
|
|
864
855
|
throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
@@ -26,8 +26,6 @@ const debug = createDebug('chevre-domain:service');
|
|
|
26
26
|
function aggregateScreeningEvent(params) {
|
|
27
27
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
28
28
|
// 集計対象イベント検索
|
|
29
|
-
// イベント取得属性最適化(2023-01-23~)
|
|
30
|
-
// const event = await repos.event.findById<factory.eventType.ScreeningEvent | factory.eventType.Event>(params);
|
|
31
29
|
const event = yield repos.event.findMinimizedIndividualEventById(params);
|
|
32
30
|
let aggregatingEvents = [event];
|
|
33
31
|
// プロジェクト限定(2023-02-22~)
|
|
@@ -43,17 +41,34 @@ function aggregateScreeningEvent(params) {
|
|
|
43
41
|
.add(1, 'hour')
|
|
44
42
|
.add(-1, 'second')
|
|
45
43
|
.toDate();
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
if (event.typeOf === factory.eventType.Event) {
|
|
45
|
+
aggregatingEvents = yield repos.event.search({
|
|
46
|
+
limit: 100,
|
|
47
|
+
page: 1,
|
|
48
|
+
project: { id: { $eq: event.project.id } },
|
|
49
|
+
typeOf: event.typeOf,
|
|
50
|
+
eventStatuses: [factory.eventStatusType.EventScheduled],
|
|
51
|
+
startFrom: startFrom,
|
|
52
|
+
startThrough: startThrough,
|
|
53
|
+
location: { branchCode: { $eq: event.location.branchCode } }
|
|
54
|
+
}, event_1.keyOfMinimizedEvent, []
|
|
55
|
+
// PROJECTION_MINIMIZED_EVENT
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
else if (event.typeOf === factory.eventType.ScreeningEvent) {
|
|
59
|
+
aggregatingEvents = yield repos.event.search({
|
|
60
|
+
limit: 100,
|
|
61
|
+
page: 1,
|
|
62
|
+
project: { id: { $eq: event.project.id } },
|
|
63
|
+
typeOf: event.typeOf,
|
|
64
|
+
eventStatuses: [factory.eventStatusType.EventScheduled],
|
|
65
|
+
startFrom: startFrom,
|
|
66
|
+
startThrough: startThrough,
|
|
67
|
+
location: { branchCode: { $eq: event.location.branchCode } }
|
|
68
|
+
}, event_1.keyOfMinimizedScreeningEvent, []
|
|
69
|
+
// PROJECTION_MINIMIZED_EVENT
|
|
70
|
+
);
|
|
71
|
+
}
|
|
57
72
|
// ID指定されたイベントについてはEventScheduledでなくても集計したいので、集計対象を調整
|
|
58
73
|
aggregatingEvents = aggregatingEvents.filter((e) => e.id !== event.id);
|
|
59
74
|
aggregatingEvents = [event, ...aggregatingEvents];
|
|
@@ -100,18 +100,14 @@ function searchEventTicketOffersByEvent(params) {
|
|
|
100
100
|
let soundFormatTypes = [];
|
|
101
101
|
let videoFormatTypes = [];
|
|
102
102
|
if (event.typeOf === factory.eventType.ScreeningEvent) {
|
|
103
|
-
// 取得属性最適化(2023-01-25~)
|
|
104
|
-
// const superEvent: Pick<factory.event.IEvent<factory.eventType.ScreeningEventSeries>, 'soundFormat' | 'videoFormat'> =
|
|
105
|
-
// await repos.event.findById<factory.eventType.ScreeningEventSeries>(
|
|
106
|
-
// { id: event.superEvent.id },
|
|
107
|
-
// { soundFormat: 1, videoFormat: 1 }
|
|
108
|
-
// );
|
|
109
103
|
const superEvents = yield repos.event.search({
|
|
110
104
|
limit: 1,
|
|
111
105
|
page: 1,
|
|
112
106
|
id: { $eq: event.superEvent.id },
|
|
113
107
|
typeOf: factory.eventType.ScreeningEventSeries
|
|
114
|
-
},
|
|
108
|
+
}, ['soundFormat', 'videoFormat'], []
|
|
109
|
+
// { soundFormat: 1, videoFormat: 1 }
|
|
110
|
+
);
|
|
115
111
|
const superEvent = superEvents.shift();
|
|
116
112
|
if (superEvent === undefined) {
|
|
117
113
|
throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
@@ -327,7 +323,9 @@ function searchOfferAppliesToMovieTicket(params) {
|
|
|
327
323
|
page: 1,
|
|
328
324
|
id: { $eq: event.superEvent.id },
|
|
329
325
|
typeOf: factory.eventType.ScreeningEventSeries
|
|
330
|
-
},
|
|
326
|
+
}, ['soundFormat', 'videoFormat'], []
|
|
327
|
+
// { soundFormat: 1, videoFormat: 1 }
|
|
328
|
+
);
|
|
331
329
|
const superEvent = superEvents.shift();
|
|
332
330
|
if (superEvent === undefined) {
|
|
333
331
|
throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
@@ -236,13 +236,31 @@ function createAggregateScreeningEventIfNotExist(params) {
|
|
|
236
236
|
exports.createAggregateScreeningEventIfNotExist = createAggregateScreeningEventIfNotExist;
|
|
237
237
|
function createInformTasks(params) {
|
|
238
238
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
239
|
+
let events4inform;
|
|
240
|
+
if (params.typeOf === factory.eventType.Event) {
|
|
241
|
+
events4inform = yield repos.event.search({
|
|
242
|
+
id: { $in: params.ids },
|
|
243
|
+
typeOf: params.typeOf
|
|
244
|
+
}, [], [
|
|
245
|
+
'aggregateEntranceGate', 'aggregateOffer', 'aggregateReservation',
|
|
246
|
+
'remainingAttendeeCapacity', 'checkInCount', 'attendeeCount'
|
|
247
|
+
]);
|
|
248
|
+
}
|
|
249
|
+
else if (params.typeOf === factory.eventType.ScreeningEvent) {
|
|
250
|
+
events4inform = yield repos.event.search({
|
|
251
|
+
id: { $in: params.ids },
|
|
252
|
+
typeOf: params.typeOf
|
|
253
|
+
}, [], [
|
|
254
|
+
'aggregateEntranceGate', 'aggregateOffer', 'aggregateReservation',
|
|
255
|
+
'remainingAttendeeCapacity', 'checkInCount', 'attendeeCount'
|
|
256
|
+
]);
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
events4inform = yield repos.event.search({
|
|
260
|
+
id: { $in: params.ids },
|
|
261
|
+
typeOf: params.typeOf
|
|
262
|
+
}, [], []);
|
|
263
|
+
}
|
|
246
264
|
if (events4inform.length > 0) {
|
|
247
265
|
const taskRunsAt = new Date();
|
|
248
266
|
const informTasks = [];
|
|
@@ -114,7 +114,9 @@ function onReservationCheckedIn(params) {
|
|
|
114
114
|
const existingEvents = yield repos.event.search({
|
|
115
115
|
id: { $eq: reservationForId },
|
|
116
116
|
typeOfIn: [factory.eventType.Event, factory.eventType.ScreeningEvent] // 指定しないとArgumentNullError
|
|
117
|
-
},
|
|
117
|
+
}, ['_id'], []
|
|
118
|
+
// { _id: 1 }
|
|
119
|
+
);
|
|
118
120
|
if (existingEvents.length > 0) {
|
|
119
121
|
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
|
120
122
|
project: { id: params.project.id },
|
|
@@ -53,9 +53,11 @@ function start(params) {
|
|
|
53
53
|
events = yield repos.event.search({
|
|
54
54
|
id: { $in: eventIds },
|
|
55
55
|
typeOf: factory.eventType.ScreeningEvent
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
}, ['startDate'], []
|
|
57
|
+
// {
|
|
58
|
+
// startDate: 1
|
|
59
|
+
// }
|
|
60
|
+
);
|
|
59
61
|
}
|
|
60
62
|
let returnPolicies = seller.hasMerchantReturnPolicy;
|
|
61
63
|
if (!Array.isArray(returnPolicies)) {
|
package/package.json
CHANGED