@chevre/domain 22.0.0-alpha.12 → 22.0.0-alpha.13
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/searchEvents.ts +8 -7
- package/lib/chevre/factory/event.d.ts +3 -1
- package/lib/chevre/repo/event.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start.js +1 -1
- package/lib/chevre/service/offer/event/authorize.js +5 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +21 -2
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import { chevre } from '../../../lib/index';
|
|
|
6
6
|
const diff = process.hrtime(startTime);
|
|
7
7
|
console.log(`importing chevre took ${diff[0]} seconds and ${diff[1]} nanoseconds.`);
|
|
8
8
|
|
|
9
|
-
const PROJECT_ID = process.env.PROJECT_ID;
|
|
9
|
+
// const PROJECT_ID = process.env.PROJECT_ID;
|
|
10
10
|
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
@@ -15,18 +15,19 @@ async function main() {
|
|
|
15
15
|
|
|
16
16
|
const events = await eventRepo.search<chevre.factory.eventType.ScreeningEvent>(
|
|
17
17
|
{
|
|
18
|
-
limit:
|
|
18
|
+
limit: 1,
|
|
19
19
|
page: 1,
|
|
20
20
|
// sort: { startDate: 1 },
|
|
21
21
|
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
22
|
-
project: { id: { $eq: PROJECT_ID } }
|
|
23
|
-
// id: { $eq: '
|
|
24
|
-
|
|
22
|
+
// project: { id: { $eq: PROJECT_ID } },
|
|
23
|
+
// id: { $eq: '120162210202407171202250' }
|
|
24
|
+
id: { $eq: 'blxonxv1m' }
|
|
25
25
|
},
|
|
26
|
-
['_id', '
|
|
26
|
+
['_id', 'project', 'typeOf', 'startDate', 'superEvent.id', 'offers.itemOffered.id', 'offers.offeredThrough'],
|
|
27
27
|
[]
|
|
28
28
|
);
|
|
29
|
-
|
|
29
|
+
// tslint:disable-next-line:no-null-keyword
|
|
30
|
+
console.dir(events, { depth: null });
|
|
30
31
|
console.log(events.length, 'events found');
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
|
-
export type IMinimizedIndividualEvent<T extends factory.eventType.ScreeningEvent | factory.eventType.Event> = T extends factory.eventType.ScreeningEvent ? Pick<factory.event.IEvent<T>, 'project' | 'organizer' | 'id' | 'typeOf' | 'additionalProperty' | 'name' | 'doorTime' | 'endDate' | 'eventStatus' | 'location' | 'startDate' | 'superEvent' | 'offers' | 'coaInfo' | 'identifier'> : T extends factory.eventType.Event ? Pick<factory.event.IEvent<T>, 'project' | 'organizer' | 'id' | 'typeOf' | 'additionalProperty' | 'name' | 'doorTime' | 'endDate' | 'eventStatus' | 'location' | 'startDate' | 'offers'>
|
|
2
|
+
export type IMinimizedIndividualEvent<T extends factory.eventType.ScreeningEvent | factory.eventType.Event> = T extends factory.eventType.ScreeningEvent ? Pick<factory.event.IEvent<T>, 'project' | 'organizer' | 'id' | 'typeOf' | 'additionalProperty' | 'name' | 'doorTime' | 'endDate' | 'eventStatus' | 'location' | 'startDate' | 'superEvent' | 'offers' | 'coaInfo' | 'identifier'> : T extends factory.eventType.Event ? Pick<factory.event.IEvent<T>, 'project' | 'organizer' | 'id' | 'typeOf' | 'additionalProperty' | 'name' | 'doorTime' | 'endDate' | 'eventStatus' | 'location' | 'startDate' | 'offers'> & {
|
|
3
|
+
superEvent?: never;
|
|
4
|
+
} : never;
|
|
3
5
|
/**
|
|
4
6
|
* 興行イベントのsuperEventを作成する
|
|
5
7
|
*/
|
|
@@ -68,7 +68,7 @@ interface IStatus {
|
|
|
68
68
|
interface IAggregateEvent {
|
|
69
69
|
statuses: IStatus[];
|
|
70
70
|
}
|
|
71
|
-
type IKeyOfProjection<T extends factory.eventType> = keyof factory.event.IEvent<T> | '_id' | '__v' | 'createdAt' | 'updatedAt' | 'aggregateEntranceGate' | 'aggregateOffer';
|
|
71
|
+
type IKeyOfProjection<T extends factory.eventType> = keyof factory.event.IEvent<T> | '_id' | '__v' | 'createdAt' | 'updatedAt' | 'aggregateEntranceGate' | 'aggregateOffer' | 'superEvent.id' | 'offers.itemOffered.id' | 'offers.offeredThrough';
|
|
72
72
|
type IUnset<T extends factory.eventType> = {
|
|
73
73
|
[key in keyof factory.event.IEvent<T>]?: 1;
|
|
74
74
|
};
|
|
@@ -127,7 +127,7 @@ function createObjectAttributes(params, options) {
|
|
|
127
127
|
// 興行オファー検索
|
|
128
128
|
const searchEventTicketOffersResult = yield OfferService.event.searchEventTicketOffers({
|
|
129
129
|
ids: acceptedOfferIds,
|
|
130
|
-
event: { id: event.id },
|
|
130
|
+
event: { id: event.id, typeOf: event.typeOf },
|
|
131
131
|
// 対応アプリケーション条件追加(2023-01-27~)
|
|
132
132
|
store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id },
|
|
133
133
|
priceSpecification: {},
|
|
@@ -93,7 +93,10 @@ function validateCreateRequest(params) {
|
|
|
93
93
|
// const event = await repos.event.findMinimizedIndividualEventById<factory.eventType.ScreeningEvent>({
|
|
94
94
|
// id: params.object.reservationFor.id
|
|
95
95
|
// });
|
|
96
|
-
const event = {
|
|
96
|
+
const event = {
|
|
97
|
+
id: params.object.reservationFor.id,
|
|
98
|
+
typeOf: factory.eventType.ScreeningEvent // ひとまずfix(2024-07-17~)
|
|
99
|
+
};
|
|
97
100
|
return { transaction, event };
|
|
98
101
|
});
|
|
99
102
|
}
|
|
@@ -131,7 +134,7 @@ function validateAcceptedOffers(params) {
|
|
|
131
134
|
const searchEventTicketOffersResult = yield (0, searchEventTicketOffers_1.searchEventTicketOffers)({
|
|
132
135
|
// 受け入れたオファーIDだけ取得する(2023-01-26~)
|
|
133
136
|
ids: offerIds,
|
|
134
|
-
event: { id: params.event.id },
|
|
137
|
+
event: { id: params.event.id, typeOf: params.event.typeOf },
|
|
135
138
|
store: params.store,
|
|
136
139
|
priceSpecification: {},
|
|
137
140
|
includedInDataCatalog: { id: '' },
|
|
@@ -172,7 +172,6 @@ function searchEventTicketOffersByEvent(params) {
|
|
|
172
172
|
withSortIndex: params.addSortIndex,
|
|
173
173
|
useIncludeInDataCatalog: params.useIncludeInDataCatalog
|
|
174
174
|
})(repos);
|
|
175
|
-
// 冗長な検索について最適化(2023-03-03~)
|
|
176
175
|
const { soundFormatChargeSpecs, videoFormatChargeSpecs, movieTicketTypeChargeSpecs } = yield searchPriceSpecs4event({
|
|
177
176
|
project: { id: event.project.id },
|
|
178
177
|
soundFormatTypes,
|
|
@@ -312,7 +311,27 @@ function checkAvailability(params) {
|
|
|
312
311
|
*/
|
|
313
312
|
function searchEventTicketOffers(params) {
|
|
314
313
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
315
|
-
|
|
314
|
+
// optimize projection(2024-07-17~)
|
|
315
|
+
let event;
|
|
316
|
+
// event = await repos.event.findMinimizedIndividualEventById({ id: params.event.id });
|
|
317
|
+
const eventType = params.event.typeOf;
|
|
318
|
+
if (eventType === factory.eventType.Event) {
|
|
319
|
+
event = (yield repos.event.search({
|
|
320
|
+
limit: 1, page: 1,
|
|
321
|
+
id: { $eq: params.event.id },
|
|
322
|
+
typeOf: eventType
|
|
323
|
+
}, ['_id', 'project', 'typeOf', 'startDate', 'offers.itemOffered.id', 'offers.offeredThrough'], [])).shift();
|
|
324
|
+
}
|
|
325
|
+
else if (eventType === factory.eventType.ScreeningEvent) {
|
|
326
|
+
event = (yield repos.event.search({
|
|
327
|
+
limit: 1, page: 1,
|
|
328
|
+
id: { $eq: params.event.id },
|
|
329
|
+
typeOf: eventType
|
|
330
|
+
}, ['_id', 'project', 'typeOf', 'startDate', 'superEvent.id', 'offers.itemOffered.id', 'offers.offeredThrough'], [])).shift();
|
|
331
|
+
}
|
|
332
|
+
if (event === undefined) {
|
|
333
|
+
throw new factory.errors.NotFound(params.event.typeOf);
|
|
334
|
+
}
|
|
316
335
|
let offers;
|
|
317
336
|
let unitPriceOffers;
|
|
318
337
|
const eventOffers = event.offers;
|
package/package.json
CHANGED