@chevre/domain 22.3.0-alpha.23 → 22.3.0-alpha.25
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/migrateEventSeries2secondary.ts +3 -3
- package/lib/chevre/repo/event.js +0 -124
- package/lib/chevre/repo/eventSeries.d.ts +2 -5
- package/lib/chevre/repo/eventSeries.js +17 -94
- package/lib/chevre/repo/mongoose/schemas/event.js +0 -65
- package/lib/chevre/service/event.js +5 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -4
- package/lib/chevre/service/offer/onEventChanged.js +3 -14
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +0 -4
- package/lib/chevre/settings.d.ts +0 -6
- package/lib/chevre/settings.js +0 -8
- package/package.json +3 -3
- package/example/src/chevre/syncEventSeries2secondary.ts +0 -20
|
@@ -48,9 +48,9 @@ async function main() {
|
|
|
48
48
|
eventSeries.id,
|
|
49
49
|
eventSeries.startDate, i, updateCount
|
|
50
50
|
);
|
|
51
|
-
await eventSeriesRepo.sync2secondary({
|
|
52
|
-
|
|
53
|
-
});
|
|
51
|
+
// await eventSeriesRepo.sync2secondary({
|
|
52
|
+
// id: eventSeries.id
|
|
53
|
+
// });
|
|
54
54
|
console.log(
|
|
55
55
|
'updated.',
|
|
56
56
|
eventSeries.project.id,
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -373,106 +373,6 @@ class EventRepo {
|
|
|
373
373
|
break;
|
|
374
374
|
case factory.eventType.ScreeningEventSeries:
|
|
375
375
|
throw new factory.errors.Internal('typeOf: ScreeningEventSeries discontinued');
|
|
376
|
-
// params = conditions;
|
|
377
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
378
|
-
// /* istanbul ignore else */
|
|
379
|
-
// if (typeof params.name === 'string' && params.name.length > 0) {
|
|
380
|
-
// andConditions.push({
|
|
381
|
-
// $or: [
|
|
382
|
-
// {
|
|
383
|
-
// 'name.ja': {
|
|
384
|
-
// $exists: true,
|
|
385
|
-
// $regex: new RegExp(params.name)
|
|
386
|
-
// }
|
|
387
|
-
// },
|
|
388
|
-
// {
|
|
389
|
-
// 'name.en': {
|
|
390
|
-
// $exists: true,
|
|
391
|
-
// $regex: new RegExp(params.name)
|
|
392
|
-
// }
|
|
393
|
-
// },
|
|
394
|
-
// {
|
|
395
|
-
// kanaName: {
|
|
396
|
-
// $exists: true,
|
|
397
|
-
// $regex: new RegExp(params.name)
|
|
398
|
-
// }
|
|
399
|
-
// }
|
|
400
|
-
// ]
|
|
401
|
-
// });
|
|
402
|
-
// }
|
|
403
|
-
// const locationIdEq = params.location?.id?.$eq;
|
|
404
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
405
|
-
// /* istanbul ignore else */
|
|
406
|
-
// if (typeof locationIdEq === 'string') {
|
|
407
|
-
// andConditions.push({
|
|
408
|
-
// 'location.id': { $exists: true, $eq: locationIdEq }
|
|
409
|
-
// });
|
|
410
|
-
// }
|
|
411
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
412
|
-
// /* istanbul ignore else */
|
|
413
|
-
// if (params.location !== undefined) {
|
|
414
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
415
|
-
// /* istanbul ignore else */
|
|
416
|
-
// if (Array.isArray(params.location.branchCodes)) {
|
|
417
|
-
// andConditions.push({
|
|
418
|
-
// 'location.branchCode': {
|
|
419
|
-
// $exists: true,
|
|
420
|
-
// $in: params.location.branchCodes
|
|
421
|
-
// }
|
|
422
|
-
// });
|
|
423
|
-
// }
|
|
424
|
-
// }
|
|
425
|
-
// const workPerformedIdentifierIn = params.workPerformed?.identifiers;
|
|
426
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
427
|
-
// /* istanbul ignore else */
|
|
428
|
-
// if (Array.isArray(workPerformedIdentifierIn)) {
|
|
429
|
-
// andConditions.push({
|
|
430
|
-
// 'workPerformed.identifier': { $exists: true, $in: workPerformedIdentifierIn }
|
|
431
|
-
// });
|
|
432
|
-
// }
|
|
433
|
-
// const workPerformedVersionEq = params.workPerformed?.version?.$eq;
|
|
434
|
-
// if (typeof workPerformedVersionEq === 'string') {
|
|
435
|
-
// andConditions.push({
|
|
436
|
-
// 'workPerformed.version': { $exists: true, $eq: workPerformedVersionEq }
|
|
437
|
-
// });
|
|
438
|
-
// }
|
|
439
|
-
// const videoFormatTypeOfEq = params.videoFormat?.typeOf?.$eq;
|
|
440
|
-
// if (typeof videoFormatTypeOfEq === 'string') {
|
|
441
|
-
// andConditions.push({
|
|
442
|
-
// 'videoFormat.typeOf': {
|
|
443
|
-
// $exists: true,
|
|
444
|
-
// $eq: videoFormatTypeOfEq
|
|
445
|
-
// }
|
|
446
|
-
// });
|
|
447
|
-
// }
|
|
448
|
-
// const videoFormatTypeOfIn = params.videoFormat?.typeOf?.$in;
|
|
449
|
-
// if (Array.isArray(videoFormatTypeOfIn)) {
|
|
450
|
-
// andConditions.push({
|
|
451
|
-
// 'videoFormat.typeOf': {
|
|
452
|
-
// $exists: true,
|
|
453
|
-
// $in: videoFormatTypeOfIn
|
|
454
|
-
// }
|
|
455
|
-
// });
|
|
456
|
-
// }
|
|
457
|
-
// const soundFormatTypeOfEq = params.soundFormat?.typeOf?.$eq;
|
|
458
|
-
// if (typeof soundFormatTypeOfEq === 'string') {
|
|
459
|
-
// andConditions.push({
|
|
460
|
-
// 'soundFormat.typeOf': {
|
|
461
|
-
// $exists: true,
|
|
462
|
-
// $eq: soundFormatTypeOfEq
|
|
463
|
-
// }
|
|
464
|
-
// });
|
|
465
|
-
// }
|
|
466
|
-
// const soundFormatTypeOfIn = params.soundFormat?.typeOf?.$in;
|
|
467
|
-
// if (Array.isArray(soundFormatTypeOfIn)) {
|
|
468
|
-
// andConditions.push({
|
|
469
|
-
// 'soundFormat.typeOf': {
|
|
470
|
-
// $exists: true,
|
|
471
|
-
// $in: soundFormatTypeOfIn
|
|
472
|
-
// }
|
|
473
|
-
// });
|
|
474
|
-
// }
|
|
475
|
-
// break;
|
|
476
376
|
default:
|
|
477
377
|
}
|
|
478
378
|
return andConditions;
|
|
@@ -870,30 +770,6 @@ class EventRepo {
|
|
|
870
770
|
*/
|
|
871
771
|
syncScreeningEventSeries2screeningEvents(params) {
|
|
872
772
|
return __awaiter(this, void 0, void 0, function* () {
|
|
873
|
-
// const superEvents = <Pick<
|
|
874
|
-
// factory.event.screeningEventSeries.IEvent,
|
|
875
|
-
// 'additionalProperty' | 'alternativeHeadline' | 'description' | 'dubLanguage'
|
|
876
|
-
// | 'endDate' | 'headline' | 'id' | 'kanaName' | 'location' | 'name'
|
|
877
|
-
// | 'soundFormat' | 'startDate' | 'subtitleLanguage' | 'typeOf' | 'videoFormat' | 'workPerformed'
|
|
878
|
-
// >[]>
|
|
879
|
-
// await this.projectFields<factory.eventType.ScreeningEventSeries>(
|
|
880
|
-
// {
|
|
881
|
-
// limit: 1,
|
|
882
|
-
// page: 1,
|
|
883
|
-
// typeOf: factory.eventType.ScreeningEventSeries,
|
|
884
|
-
// id: { $eq: params.superEvent.id },
|
|
885
|
-
// project: { id: { $eq: params.project.id } }
|
|
886
|
-
// },
|
|
887
|
-
// [
|
|
888
|
-
// 'additionalProperty', 'alternativeHeadline', 'description', 'dubLanguage',
|
|
889
|
-
// 'endDate', 'headline', 'kanaName', 'location', 'name',
|
|
890
|
-
// 'soundFormat', 'startDate', 'subtitleLanguage', 'typeOf', 'videoFormat', 'workPerformed'
|
|
891
|
-
// ]
|
|
892
|
-
// );
|
|
893
|
-
// const superEventFromDB = superEvents.shift();
|
|
894
|
-
// if (superEventFromDB === undefined) {
|
|
895
|
-
// throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
896
|
-
// }
|
|
897
773
|
const superEvent = EventFactory.minimizeSuperEvent({ superEventFromDB: params.superEventFromDB });
|
|
898
774
|
yield this.eventModel.updateMany({
|
|
899
775
|
typeOf: { $eq: factory.eventType.ScreeningEvent },
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import type { BulkWriteResult } from 'mongodb';
|
|
26
26
|
import type { Connection, Document, FilterQuery } from 'mongoose';
|
|
27
27
|
import * as factory from '../factory';
|
|
28
|
-
type ISearchConditions =
|
|
28
|
+
type ISearchConditions = factory.event.ISearchConditions<factory.eventType.ScreeningEventSeries>;
|
|
29
29
|
type IKeyOfProjection = Exclude<keyof factory.event.IEvent<factory.eventType.ScreeningEventSeries>, 'id'>;
|
|
30
30
|
type IUnset = {
|
|
31
31
|
[key in keyof factory.event.IEvent<factory.eventType.ScreeningEventSeries>]?: 1;
|
|
@@ -34,7 +34,7 @@ type IUnset = {
|
|
|
34
34
|
* 施設コンテンツリポジトリ
|
|
35
35
|
*/
|
|
36
36
|
export declare class EventSeriesRepo {
|
|
37
|
-
private readonly
|
|
37
|
+
private readonly eventSeriesModel;
|
|
38
38
|
constructor(connection: Connection);
|
|
39
39
|
static CREATE_MONGO_CONDITIONS(conditions: ISearchConditions): FilterQuery<factory.event.IEvent<factory.eventType.ScreeningEventSeries>>[];
|
|
40
40
|
/**
|
|
@@ -127,9 +127,6 @@ export declare class EventSeriesRepo {
|
|
|
127
127
|
}): Promise<{
|
|
128
128
|
maxVersion: string;
|
|
129
129
|
}>;
|
|
130
|
-
sync2secondary(__: {
|
|
131
|
-
id: string;
|
|
132
|
-
}): Promise<void>;
|
|
133
130
|
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<Document<unknown, {}, import("@chevre/factory/lib/event/screeningEventSeries").IAttributes & {
|
|
134
131
|
_id: string;
|
|
135
132
|
}> & import("@chevre/factory/lib/event/screeningEventSeries").IAttributes & {
|
|
@@ -22,7 +22,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.EventSeriesRepo = void 0;
|
|
24
24
|
const factory = require("../factory");
|
|
25
|
-
// import { createSchema, IDocType, IModel, modelName } from './mongoose/schemas/event';
|
|
26
25
|
const eventSeries_1 = require("./mongoose/schemas/eventSeries");
|
|
27
26
|
const errorHandler_1 = require("../errorHandler");
|
|
28
27
|
const settings_1 = require("../settings");
|
|
@@ -30,18 +29,8 @@ const settings_1 = require("../settings");
|
|
|
30
29
|
* 施設コンテンツリポジトリ
|
|
31
30
|
*/
|
|
32
31
|
class EventSeriesRepo {
|
|
33
|
-
// private readonly eventModel: IModel | INewModel;
|
|
34
|
-
// private readonly secondaryEventModel: IModel | INewModel;
|
|
35
32
|
constructor(connection) {
|
|
36
|
-
this.
|
|
37
|
-
// this.secondaryEventModel = connection.model(modelName, createSchema());
|
|
38
|
-
// if (USE_EVENT_SERIES_NEW_SCHEMA) {
|
|
39
|
-
// this.eventModel = connection.model(newModelName, createNewSchema());
|
|
40
|
-
// this.secondaryEventModel = connection.model(modelName, createSchema());
|
|
41
|
-
// } else {
|
|
42
|
-
// this.eventModel = connection.model(modelName, createSchema());
|
|
43
|
-
// this.secondaryEventModel = connection.model(newModelName, createNewSchema());
|
|
44
|
-
// }
|
|
33
|
+
this.eventSeriesModel = connection.model(eventSeries_1.modelName, (0, eventSeries_1.createSchema)());
|
|
45
34
|
}
|
|
46
35
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
47
36
|
static CREATE_MONGO_CONDITIONS(conditions) {
|
|
@@ -49,18 +38,6 @@ class EventSeriesRepo {
|
|
|
49
38
|
const andConditions = [
|
|
50
39
|
{ typeOf: { $eq: factory.eventType.ScreeningEventSeries } } // fix(2024-09-08~)
|
|
51
40
|
];
|
|
52
|
-
// const typeOfEq = conditions.typeOf;
|
|
53
|
-
// if (typeof typeOfEq === 'string') {
|
|
54
|
-
// andConditions.push({ typeOf: { $eq: typeOfEq } });
|
|
55
|
-
// }
|
|
56
|
-
// const typeOfIn = conditions.typeOfIn;
|
|
57
|
-
// if (Array.isArray(typeOfIn)) {
|
|
58
|
-
// andConditions.push({ typeOf: { $in: typeOfIn } });
|
|
59
|
-
// }
|
|
60
|
-
// typeOf条件必須検証(2023-07-13~)
|
|
61
|
-
// if (typeof typeOfEq !== 'string' && !Array.isArray(typeOfIn)) {
|
|
62
|
-
// throw new factory.errors.ArgumentNull('typeOf');
|
|
63
|
-
// }
|
|
64
41
|
const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
65
42
|
if (typeof projectIdEq === 'string') {
|
|
66
43
|
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
@@ -134,15 +111,6 @@ class EventSeriesRepo {
|
|
|
134
111
|
if (Array.isArray(locationBranchCodeIn)) {
|
|
135
112
|
andConditions.push({ 'location.branchCode': { $exists: true, $in: locationBranchCodeIn } });
|
|
136
113
|
}
|
|
137
|
-
// const hasOfferCatalogIdEq = conditions.hasOfferCatalog?.id?.$eq;
|
|
138
|
-
// if (typeof hasOfferCatalogIdEq === 'string') {
|
|
139
|
-
// andConditions.push({
|
|
140
|
-
// 'hasOfferCatalog.id': {
|
|
141
|
-
// $exists: true,
|
|
142
|
-
// $eq: hasOfferCatalogIdEq
|
|
143
|
-
// }
|
|
144
|
-
// });
|
|
145
|
-
// }
|
|
146
114
|
const additionalPropertyElemMatch = (_l = conditions.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
|
|
147
115
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
148
116
|
andConditions.push({
|
|
@@ -262,7 +230,7 @@ class EventSeriesRepo {
|
|
|
262
230
|
return Object.assign({ _id: uniqid() }, p);
|
|
263
231
|
});
|
|
264
232
|
try {
|
|
265
|
-
yield this.
|
|
233
|
+
yield this.eventSeriesModel.insertMany(insertingDocs, { rawResult: true } // rawResult(2024-08-02~)
|
|
266
234
|
);
|
|
267
235
|
// console.dir(insertResult, { depth: null });
|
|
268
236
|
}
|
|
@@ -321,7 +289,7 @@ class EventSeriesRepo {
|
|
|
321
289
|
});
|
|
322
290
|
}
|
|
323
291
|
if (bulkWriteOps.length > 0) {
|
|
324
|
-
return this.
|
|
292
|
+
return this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
325
293
|
}
|
|
326
294
|
});
|
|
327
295
|
}
|
|
@@ -370,9 +338,9 @@ class EventSeriesRepo {
|
|
|
370
338
|
});
|
|
371
339
|
}
|
|
372
340
|
if (bulkWriteOps4insert.length > 0) {
|
|
373
|
-
const bulkWriteResult4insert = yield this.
|
|
341
|
+
const bulkWriteResult4insert = yield this.eventSeriesModel.bulkWrite(bulkWriteOps4insert, { ordered: false });
|
|
374
342
|
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
375
|
-
const modifiedEvents = yield this.
|
|
343
|
+
const modifiedEvents = yield this.eventSeriesModel.find({ $or: queryFilters }, { _id: 1 })
|
|
376
344
|
.exec();
|
|
377
345
|
return { bulkWriteResult4insert, modifiedEvents };
|
|
378
346
|
}
|
|
@@ -390,13 +358,13 @@ class EventSeriesRepo {
|
|
|
390
358
|
if (params.id === undefined) {
|
|
391
359
|
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
392
360
|
const id = uniqid();
|
|
393
|
-
doc = yield this.
|
|
361
|
+
doc = yield this.eventSeriesModel.create(Object.assign(Object.assign({}, params.attributes), { _id: id }));
|
|
394
362
|
savedEventId = id;
|
|
395
363
|
}
|
|
396
364
|
else {
|
|
397
365
|
// const upsert: boolean = params.upsert === true;
|
|
398
366
|
const upsert = false;
|
|
399
|
-
doc = yield this.
|
|
367
|
+
doc = yield this.eventSeriesModel.findOneAndUpdate({
|
|
400
368
|
_id: { $eq: params.id },
|
|
401
369
|
typeOf: { $eq: typeOf }
|
|
402
370
|
}, Object.assign({
|
|
@@ -421,7 +389,7 @@ class EventSeriesRepo {
|
|
|
421
389
|
throw error;
|
|
422
390
|
}
|
|
423
391
|
if (doc === null) {
|
|
424
|
-
throw new factory.errors.NotFound(this.
|
|
392
|
+
throw new factory.errors.NotFound(this.eventSeriesModel.modelName);
|
|
425
393
|
}
|
|
426
394
|
return { id: savedEventId }; // optimize(2024-07-31~)
|
|
427
395
|
// return doc.toObject();
|
|
@@ -456,11 +424,7 @@ class EventSeriesRepo {
|
|
|
456
424
|
});
|
|
457
425
|
}
|
|
458
426
|
if (bulkWriteOps.length > 0) {
|
|
459
|
-
yield this.
|
|
460
|
-
// sync2secondary(2024-09-10~)
|
|
461
|
-
// if (USE_EVENT_SERIES_SYNC2SECONDARY) {
|
|
462
|
-
// await (<INewModel>this.secondaryEventModel).bulkWrite(bulkWriteOps, { ordered: false });
|
|
463
|
-
// }
|
|
427
|
+
yield this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
464
428
|
}
|
|
465
429
|
});
|
|
466
430
|
}
|
|
@@ -482,7 +446,7 @@ class EventSeriesRepo {
|
|
|
482
446
|
// discontinue(2024-07-24~)
|
|
483
447
|
throw new factory.errors.ArgumentNull('inclusion', 'inclusion must be specified');
|
|
484
448
|
}
|
|
485
|
-
const query = this.
|
|
449
|
+
const query = this.eventSeriesModel.find({ $and: conditions }, projection);
|
|
486
450
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
487
451
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
488
452
|
query.limit(params.limit)
|
|
@@ -511,7 +475,7 @@ class EventSeriesRepo {
|
|
|
511
475
|
// project: { id: { $eq: string } };
|
|
512
476
|
// organizer?: { id: { $eq: string } };
|
|
513
477
|
// }): Promise<factory.event.IEvent<factory.eventType.ScreeningEventSeries>> {
|
|
514
|
-
// const doc = await this.
|
|
478
|
+
// const doc = await this.eventSeriesModel.findOne<HydratedDocument<factory.event.IEvent<factory.eventType.ScreeningEventSeries>>>(
|
|
515
479
|
// {
|
|
516
480
|
// _id: { $eq: params.id.$eq },
|
|
517
481
|
// 'project.id': { $eq: params.project.id.$eq },
|
|
@@ -540,7 +504,7 @@ class EventSeriesRepo {
|
|
|
540
504
|
// params: ISearchConditions
|
|
541
505
|
// ): Promise<string[]> {
|
|
542
506
|
// const conditions = EventSeriesRepo.CREATE_MONGO_CONDITIONS(params);
|
|
543
|
-
// const query = this.
|
|
507
|
+
// const query = this.eventSeriesModel.distinct(
|
|
544
508
|
// '_id',
|
|
545
509
|
// { $and: conditions }
|
|
546
510
|
// );
|
|
@@ -549,7 +513,7 @@ class EventSeriesRepo {
|
|
|
549
513
|
// }
|
|
550
514
|
deleteEventSeriesById(params) {
|
|
551
515
|
return __awaiter(this, void 0, void 0, function* () {
|
|
552
|
-
yield this.
|
|
516
|
+
yield this.eventSeriesModel.findOneAndDelete({
|
|
553
517
|
_id: { $eq: params.id },
|
|
554
518
|
'project.id': { $eq: params.project.id },
|
|
555
519
|
typeOf: { $eq: factory.eventType.ScreeningEventSeries }
|
|
@@ -559,7 +523,7 @@ class EventSeriesRepo {
|
|
|
559
523
|
}
|
|
560
524
|
deleteManyByOrganizerId(params) {
|
|
561
525
|
return __awaiter(this, void 0, void 0, function* () {
|
|
562
|
-
return this.
|
|
526
|
+
return this.eventSeriesModel.deleteMany({
|
|
563
527
|
'project.id': { $eq: params.project.id },
|
|
564
528
|
'organizer.id': { $exists: true, $eq: params.organizer.id },
|
|
565
529
|
typeOf: { $eq: factory.eventType.ScreeningEventSeries }
|
|
@@ -569,7 +533,7 @@ class EventSeriesRepo {
|
|
|
569
533
|
}
|
|
570
534
|
deleteManyByLocationId(params) {
|
|
571
535
|
return __awaiter(this, void 0, void 0, function* () {
|
|
572
|
-
return this.
|
|
536
|
+
return this.eventSeriesModel.deleteMany({
|
|
573
537
|
'project.id': { $eq: params.project.id },
|
|
574
538
|
'location.id': { $exists: true, $eq: params.location.id },
|
|
575
539
|
typeOf: { $eq: factory.eventType.ScreeningEventSeries }
|
|
@@ -583,7 +547,7 @@ class EventSeriesRepo {
|
|
|
583
547
|
aggregateMaxVersion(params) {
|
|
584
548
|
var _a;
|
|
585
549
|
return __awaiter(this, void 0, void 0, function* () {
|
|
586
|
-
const aggregations = yield this.
|
|
550
|
+
const aggregations = yield this.eventSeriesModel.aggregate([
|
|
587
551
|
{
|
|
588
552
|
$match: {
|
|
589
553
|
typeOf: { $eq: factory.eventType.ScreeningEventSeries },
|
|
@@ -614,49 +578,8 @@ class EventSeriesRepo {
|
|
|
614
578
|
return { maxVersion };
|
|
615
579
|
});
|
|
616
580
|
}
|
|
617
|
-
// tslint:disable-next-line:prefer-function-over-method
|
|
618
|
-
sync2secondary(__) {
|
|
619
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
620
|
-
// if (!USE_EVENT_SERIES_SYNC2SECONDARY) {
|
|
621
|
-
// return;
|
|
622
|
-
// }
|
|
623
|
-
// const doc = await this.eventModel.findOne({
|
|
624
|
-
// _id: { $eq: params.id },
|
|
625
|
-
// typeOf: { $eq: factory.eventType.ScreeningEventSeries }
|
|
626
|
-
// })
|
|
627
|
-
// .lean()
|
|
628
|
-
// .exec();
|
|
629
|
-
// if (doc !== null) {
|
|
630
|
-
// const { _id, ...replacement } = doc;
|
|
631
|
-
// // console.log('replacing eventSeries', params.id, 'replacement:', replacement);
|
|
632
|
-
// const replaceResult = await this.secondaryEventModel.findOneAndReplace(
|
|
633
|
-
// {
|
|
634
|
-
// _id: { $eq: params.id },
|
|
635
|
-
// typeOf: { $eq: factory.eventType.ScreeningEventSeries }
|
|
636
|
-
// },
|
|
637
|
-
// replacement,
|
|
638
|
-
// {
|
|
639
|
-
// upsert: true,
|
|
640
|
-
// rawResult: true
|
|
641
|
-
// }
|
|
642
|
-
// )
|
|
643
|
-
// .exec();
|
|
644
|
-
// // tslint:disable-next-line:no-console
|
|
645
|
-
// console.log('eventSeries', params.id, 'replaced. result:', replaceResult);
|
|
646
|
-
// } else {
|
|
647
|
-
// await this.secondaryEventModel.findOneAndDelete(
|
|
648
|
-
// {
|
|
649
|
-
// _id: { $eq: params.id },
|
|
650
|
-
// typeOf: { $eq: factory.eventType.ScreeningEventSeries }
|
|
651
|
-
// },
|
|
652
|
-
// { projection: { _id: 1 } }
|
|
653
|
-
// )
|
|
654
|
-
// .exec();
|
|
655
|
-
// }
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
581
|
getCursor(conditions, projection) {
|
|
659
|
-
return this.
|
|
582
|
+
return this.eventSeriesModel.find(conditions, projection)
|
|
660
583
|
.sort({ startDate: factory.sortType.Descending })
|
|
661
584
|
.cursor();
|
|
662
585
|
}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.modelName = exports.indexes = exports.createSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const writeConcern_1 = require("../writeConcern");
|
|
6
|
-
const factory = require("../../../factory");
|
|
7
6
|
const settings_1 = require("../../../settings");
|
|
8
7
|
const modelName = 'Event';
|
|
9
8
|
exports.modelName = modelName;
|
|
@@ -158,43 +157,6 @@ const indexes = [
|
|
|
158
157
|
}
|
|
159
158
|
}
|
|
160
159
|
],
|
|
161
|
-
[
|
|
162
|
-
{ 'workPerformed.identifier': 1, startDate: 1 },
|
|
163
|
-
{
|
|
164
|
-
name: 'searchByWorkPerformedIdentifier',
|
|
165
|
-
partialFilterExpression: {
|
|
166
|
-
'workPerformed.identifier': { $exists: true }
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
],
|
|
170
|
-
[
|
|
171
|
-
{ 'workPerformed.version': 1, startDate: 1 },
|
|
172
|
-
{
|
|
173
|
-
name: 'searchByWorkPerformedVersion',
|
|
174
|
-
partialFilterExpression: {
|
|
175
|
-
'workPerformed.version': { $exists: true }
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
],
|
|
179
|
-
[
|
|
180
|
-
// コンテンツ+バージョンに対するuniqueness
|
|
181
|
-
{
|
|
182
|
-
'project.id': 1,
|
|
183
|
-
'location.branchCode': 1,
|
|
184
|
-
'workPerformed.identifier': 1,
|
|
185
|
-
'workPerformed.version': 1
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
unique: true,
|
|
189
|
-
name: 'uniqueScreeningEventSeries',
|
|
190
|
-
partialFilterExpression: {
|
|
191
|
-
typeOf: factory.eventType.ScreeningEventSeries,
|
|
192
|
-
'location.branchCode': { $exists: true },
|
|
193
|
-
'workPerformed.identifier': { $exists: true },
|
|
194
|
-
'workPerformed.version': { $exists: true }
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
],
|
|
198
160
|
[
|
|
199
161
|
{ startDate: 1 },
|
|
200
162
|
{ name: 'searchByStartDate' }
|
|
@@ -302,24 +264,6 @@ const indexes = [
|
|
|
302
264
|
}
|
|
303
265
|
}
|
|
304
266
|
],
|
|
305
|
-
[
|
|
306
|
-
{ 'videoFormat.typeOf': 1, startDate: 1 },
|
|
307
|
-
{
|
|
308
|
-
name: 'searchByVideoFormatTypeOf',
|
|
309
|
-
partialFilterExpression: {
|
|
310
|
-
'videoFormat.typeOf': { $exists: true }
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
],
|
|
314
|
-
[
|
|
315
|
-
{ 'soundFormat.typeOf': 1, startDate: 1 },
|
|
316
|
-
{
|
|
317
|
-
name: 'searchBySoundFormatTypeOf',
|
|
318
|
-
partialFilterExpression: {
|
|
319
|
-
'soundFormat.typeOf': { $exists: true }
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
],
|
|
323
267
|
[
|
|
324
268
|
{ 'name.ja': 1, startDate: 1 },
|
|
325
269
|
{
|
|
@@ -338,15 +282,6 @@ const indexes = [
|
|
|
338
282
|
}
|
|
339
283
|
}
|
|
340
284
|
],
|
|
341
|
-
[
|
|
342
|
-
{ kanaName: 1, startDate: 1 },
|
|
343
|
-
{
|
|
344
|
-
name: 'searchByKanaName',
|
|
345
|
-
partialFilterExpression: {
|
|
346
|
-
kanaName: { $exists: true }
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
],
|
|
350
285
|
[
|
|
351
286
|
{ additionalProperty: 1, startDate: 1 },
|
|
352
287
|
{
|
|
@@ -651,6 +651,10 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
651
651
|
.toISOString(), contentRating: params.eirinKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEirin)[0], typeOf: factory.creativeWorkType.Movie }, (typeof params.filmFromCOA.titleBranchNum === 'string' && params.filmFromCOA.titleBranchNum.length > 0)
|
|
652
652
|
? { version: params.filmFromCOA.titleBranchNum } // add version(2024-01-31~)
|
|
653
653
|
: undefined);
|
|
654
|
+
// redefine videoFormat(2024-09-18~)
|
|
655
|
+
// const videoFormat: factory.event.screeningEventSeries.ICOAKubun =
|
|
656
|
+
// params.eizouKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEizou)[0];
|
|
657
|
+
const videoFormat = params.joueihousikiKubuns.map(({ kubunCode }) => ({ typeOf: kubunCode, name: kubunCode }));
|
|
654
658
|
return {
|
|
655
659
|
project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
656
660
|
typeOf: factory.eventType.ScreeningEventSeries,
|
|
@@ -673,7 +677,7 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
673
677
|
},
|
|
674
678
|
// 必須化(2023-07-12~)
|
|
675
679
|
organizer: { id: params.seller.id },
|
|
676
|
-
videoFormat
|
|
680
|
+
videoFormat,
|
|
677
681
|
soundFormat: [],
|
|
678
682
|
workPerformed,
|
|
679
683
|
duration: moment.duration(params.filmFromCOA.showTime, 'm')
|
|
@@ -139,8 +139,8 @@ function searchEventTicketOffersByEvent(params) {
|
|
|
139
139
|
const superEvents = yield repos.eventSeries.projectEventSeriesFields({
|
|
140
140
|
limit: 1,
|
|
141
141
|
page: 1,
|
|
142
|
-
id: { $eq: event.superEvent.id }
|
|
143
|
-
typeOf: factory.eventType.ScreeningEventSeries
|
|
142
|
+
id: { $eq: event.superEvent.id }
|
|
143
|
+
// typeOf: factory.eventType.ScreeningEventSeries
|
|
144
144
|
}, ['soundFormat', 'videoFormat']);
|
|
145
145
|
const superEvent = superEvents.shift();
|
|
146
146
|
if (superEvent === undefined) {
|
|
@@ -361,8 +361,8 @@ function searchOfferAppliesToMovieTicket(params) {
|
|
|
361
361
|
const superEvents = yield repos.eventSeries.projectEventSeriesFields({
|
|
362
362
|
limit: 1,
|
|
363
363
|
page: 1,
|
|
364
|
-
id: { $eq: event.superEvent.id }
|
|
365
|
-
typeOf: factory.eventType.ScreeningEventSeries
|
|
364
|
+
id: { $eq: event.superEvent.id }
|
|
365
|
+
// typeOf: factory.eventType.ScreeningEventSeries
|
|
366
366
|
}, ['soundFormat', 'videoFormat']);
|
|
367
367
|
const superEvent = superEvents.shift();
|
|
368
368
|
if (superEvent === undefined) {
|
|
@@ -50,21 +50,10 @@ function onEventChanged(params) {
|
|
|
50
50
|
// no op
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
// 施設コンテンツsecondaryコレクションへ同期(2024-09-10~)
|
|
54
|
-
yield syncEventSeries2secondary({
|
|
55
|
-
ids: params.id
|
|
56
|
-
})(repos);
|
|
57
53
|
}
|
|
58
54
|
});
|
|
59
55
|
}
|
|
60
56
|
exports.onEventChanged = onEventChanged;
|
|
61
|
-
function syncEventSeries2secondary(params) {
|
|
62
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
for (const eventSeriesId of params.ids) {
|
|
64
|
-
yield repos.eventSeries.sync2secondary({ id: eventSeriesId });
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
57
|
function syncEventSeries2screeningEvents(params) {
|
|
69
58
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
70
59
|
const now = new Date();
|
|
@@ -72,7 +61,7 @@ function syncEventSeries2screeningEvents(params) {
|
|
|
72
61
|
const superEvents = yield repos.eventSeries.projectEventSeriesFields({
|
|
73
62
|
limit: 1,
|
|
74
63
|
page: 1,
|
|
75
|
-
typeOf: factory.eventType.ScreeningEventSeries,
|
|
64
|
+
// typeOf: factory.eventType.ScreeningEventSeries,
|
|
76
65
|
id: { $eq: eventSeriesId },
|
|
77
66
|
project: { id: { $eq: params.project.id } }
|
|
78
67
|
}, [
|
|
@@ -209,8 +198,8 @@ function createInformTasks(params) {
|
|
|
209
198
|
}
|
|
210
199
|
else {
|
|
211
200
|
const screeningEventSeries4inform = yield repos.eventSeries.projectEventSeriesFields({
|
|
212
|
-
id: { $in: params.ids }
|
|
213
|
-
typeOf: params.typeOf
|
|
201
|
+
id: { $in: params.ids }
|
|
202
|
+
// typeOf: params.typeOf
|
|
214
203
|
}, [
|
|
215
204
|
'project', 'organizer', 'typeOf', 'name', 'location', 'videoFormat', 'soundFormat', 'workPerformed', 'kanaName', 'eventStatus',
|
|
216
205
|
'endDate', 'startDate', 'additionalProperty', 'subtitleLanguage', 'dubLanguage',
|
|
@@ -40,10 +40,6 @@ function onResourceDeleted(params) {
|
|
|
40
40
|
project: { id: params.project.id },
|
|
41
41
|
ids: params.id
|
|
42
42
|
})(repos);
|
|
43
|
-
// 施設コンテンツsecondaryコレクションへ同期(2024-09-10~)
|
|
44
|
-
for (const eventSeriesId of params.id) {
|
|
45
|
-
yield repos.eventSeries.sync2secondary({ id: eventSeriesId });
|
|
46
|
-
}
|
|
47
43
|
break;
|
|
48
44
|
case factory.placeType.ScreeningRoom:
|
|
49
45
|
yield deleteResourcesByScreeningRoom({
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -2,12 +2,6 @@ import * as factory from './factory';
|
|
|
2
2
|
export declare const MONGO_MAX_TIME_MS: number;
|
|
3
3
|
export declare const MONGO_READ_PREFERENCE: string;
|
|
4
4
|
export declare const MONGO_AUTO_INDEX: boolean;
|
|
5
|
-
/**
|
|
6
|
-
* 施設コンテンツのprimaryコレクションとして新スキーマを使用するかどうか
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* 施設コンテンツのsecondaryコレクションへ同期するかどうか
|
|
10
|
-
*/
|
|
11
5
|
/**
|
|
12
6
|
* 施設のprimaryコレクションとして新スキーマを使用するかどうか
|
|
13
7
|
*/
|
package/lib/chevre/settings.js
CHANGED
|
@@ -9,14 +9,6 @@ exports.MONGO_READ_PREFERENCE = (typeof process.env.MONGO_READ_PREFERENCE === 's
|
|
|
9
9
|
? process.env.MONGO_READ_PREFERENCE
|
|
10
10
|
: 'primaryPreferred';
|
|
11
11
|
exports.MONGO_AUTO_INDEX = process.env.MONGO_AUTO_INDEX === '1';
|
|
12
|
-
/**
|
|
13
|
-
* 施設コンテンツのprimaryコレクションとして新スキーマを使用するかどうか
|
|
14
|
-
*/
|
|
15
|
-
// export const USE_EVENT_SERIES_NEW_SCHEMA = process.env.USE_EVENT_SERIES_NEW_SCHEMA === '1';
|
|
16
|
-
/**
|
|
17
|
-
* 施設コンテンツのsecondaryコレクションへ同期するかどうか
|
|
18
|
-
*/
|
|
19
|
-
// export const USE_EVENT_SERIES_SYNC2SECONDARY = process.env.USE_EVENT_SERIES_SYNC2SECONDARY === '1';
|
|
20
12
|
/**
|
|
21
13
|
* 施設のprimaryコレクションとして新スキーマを使用するかどうか
|
|
22
14
|
*/
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "10.
|
|
12
|
+
"@chevre/factory": "4.384.0-alpha.0",
|
|
13
|
+
"@cinerino/sdk": "10.10.0-alpha.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.5.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.3.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "22.3.0-alpha.
|
|
113
|
+
"version": "22.3.0-alpha.25"
|
|
114
114
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
|
-
|
|
9
|
-
const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
|
|
10
|
-
|
|
11
|
-
await eventSeriesRepo.sync2secondary({
|
|
12
|
-
id: '7k9ayl8hc'
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
main()
|
|
17
|
-
.then(() => {
|
|
18
|
-
console.log('success!');
|
|
19
|
-
})
|
|
20
|
-
.catch(console.error);
|