@chevre/domain 22.3.0-alpha.7 → 22.3.0-alpha.8
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/aggregateScreeningEventMaxVersion.ts +2 -2
- package/example/src/chevre/unsetUnnecessaryFields.ts +3 -68
- package/example/src/chevre/upsertScreeningEventSeriesByVersion.ts +2 -2
- package/lib/chevre/repo/event.d.ts +2 -61
- package/lib/chevre/repo/event.js +0 -150
- package/lib/chevre/repo/eventSeries.d.ts +81 -0
- package/lib/chevre/repo/eventSeries.js +289 -0
- package/lib/chevre/repo/mongoose/schemas/event.js +5 -12
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/event/createEvent.d.ts +2 -0
- package/lib/chevre/service/event/createEvent.js +1 -1
- package/lib/chevre/service/task/createEvent.js +2 -0
- package/package.json +1 -1
|
@@ -8,8 +8,8 @@ const project = { id: String(process.env.PROJECT_ID) };
|
|
|
8
8
|
async function main() {
|
|
9
9
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
const result = await
|
|
11
|
+
const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
|
|
12
|
+
const result = await eventSeriesRepo.aggregateMaxVersion(
|
|
13
13
|
{
|
|
14
14
|
project: {
|
|
15
15
|
id: { $eq: project.id }
|
|
@@ -6,79 +6,14 @@ import { chevre } from '../../../lib/index';
|
|
|
6
6
|
async function main() {
|
|
7
7
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
const customerRepo = await chevre.repository.Customer.createInstance(mongoose.connection);
|
|
11
|
-
const additionalPropertyRepo = await chevre.repository.AdditionalProperty.createInstance(mongoose.connection);
|
|
12
|
-
const movieTheaterRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
|
|
13
|
-
const productModelRepo = await chevre.repository.ProductModel.createInstance(mongoose.connection);
|
|
14
|
-
const tripRepo = await chevre.repository.Trip.createInstance(mongoose.connection);
|
|
9
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
15
10
|
|
|
16
11
|
let updateResult: any;
|
|
17
|
-
updateResult = await
|
|
12
|
+
updateResult = await eventRepo.unsetUnnecessaryFields({
|
|
18
13
|
filter: {
|
|
19
14
|
_id: { $exists: true }
|
|
20
15
|
},
|
|
21
|
-
$unset: {
|
|
22
|
-
createdAt: 1,
|
|
23
|
-
updatedAt: 1,
|
|
24
|
-
__v: 1
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
console.log(updateResult);
|
|
28
|
-
|
|
29
|
-
updateResult = await accountTitleRepo.unsetUnnecessaryFields({
|
|
30
|
-
filter: {
|
|
31
|
-
_id: { $exists: true }
|
|
32
|
-
},
|
|
33
|
-
$unset: {
|
|
34
|
-
createdAt: 1,
|
|
35
|
-
updatedAt: 1,
|
|
36
|
-
__v: 1
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
console.log(updateResult);
|
|
40
|
-
|
|
41
|
-
updateResult = await additionalPropertyRepo.unsetUnnecessaryFields({
|
|
42
|
-
filter: {
|
|
43
|
-
_id: { $exists: true }
|
|
44
|
-
},
|
|
45
|
-
$unset: {
|
|
46
|
-
createdAt: 1,
|
|
47
|
-
updatedAt: 1,
|
|
48
|
-
__v: 1
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
console.log(updateResult);
|
|
52
|
-
|
|
53
|
-
updateResult = await movieTheaterRepo.unsetUnnecessaryFields({
|
|
54
|
-
filter: {
|
|
55
|
-
_id: { $exists: true }
|
|
56
|
-
},
|
|
57
|
-
$unset: {
|
|
58
|
-
createdAt: 1,
|
|
59
|
-
updatedAt: 1,
|
|
60
|
-
__v: 1
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
console.log(updateResult);
|
|
64
|
-
|
|
65
|
-
updateResult = await productModelRepo.unsetUnnecessaryFields({
|
|
66
|
-
filter: {
|
|
67
|
-
_id: { $exists: true }
|
|
68
|
-
},
|
|
69
|
-
$unset: {
|
|
70
|
-
createdAt: 1,
|
|
71
|
-
updatedAt: 1,
|
|
72
|
-
__v: 1
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
console.log(updateResult);
|
|
76
|
-
|
|
77
|
-
updateResult = await tripRepo.unsetUnnecessaryFields({
|
|
78
|
-
filter: {
|
|
79
|
-
_id: { $exists: true }
|
|
80
|
-
},
|
|
81
|
-
$unset: {
|
|
16
|
+
$unset: <any>{
|
|
82
17
|
createdAt: 1,
|
|
83
18
|
updatedAt: 1,
|
|
84
19
|
__v: 1
|
|
@@ -10,9 +10,9 @@ const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
|
10
10
|
async function main() {
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
|
|
14
14
|
|
|
15
|
-
const result = await
|
|
15
|
+
const result = await eventSeriesRepo.upsertByVersion(
|
|
16
16
|
[
|
|
17
17
|
{
|
|
18
18
|
$set: {
|
|
@@ -26,7 +26,6 @@ import type { BulkWriteResult } from 'mongodb';
|
|
|
26
26
|
import type { Connection, Document, FilterQuery } from 'mongoose';
|
|
27
27
|
import * as factory from '../factory';
|
|
28
28
|
import * as EventFactory from '../factory/event';
|
|
29
|
-
import { IDocType } from './mongoose/schemas/event';
|
|
30
29
|
export interface IAttributes4patchUpdate<T extends factory.eventType> {
|
|
31
30
|
typeOf: T;
|
|
32
31
|
eventStatus?: factory.eventStatusType;
|
|
@@ -107,24 +106,6 @@ export declare class EventRepo {
|
|
|
107
106
|
id: string;
|
|
108
107
|
}[];
|
|
109
108
|
} | void>;
|
|
110
|
-
/**
|
|
111
|
-
* コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
|
|
112
|
-
*/
|
|
113
|
-
createScreeningEventSeriesIfNotExistByWorkPerformed(params: {
|
|
114
|
-
attributes: factory.event.IAttributes<factory.eventType.ScreeningEventSeries>;
|
|
115
|
-
}[]): Promise<BulkWriteResult | void>;
|
|
116
|
-
/**
|
|
117
|
-
* コンテンツ+バージョンをキーにして冪等置換
|
|
118
|
-
*/
|
|
119
|
-
upsertScreeningEventSeriesByVersion(params: {
|
|
120
|
-
$set: factory.event.IAttributes<factory.eventType.ScreeningEventSeries>;
|
|
121
|
-
$unset?: IUnset<factory.eventType.ScreeningEventSeries>;
|
|
122
|
-
}[]): Promise<{
|
|
123
|
-
bulkWriteResult4insert: BulkWriteResult;
|
|
124
|
-
modifiedEvents: {
|
|
125
|
-
id: string;
|
|
126
|
-
}[];
|
|
127
|
-
} | void>;
|
|
128
109
|
/**
|
|
129
110
|
* イベント部分更新
|
|
130
111
|
*/
|
|
@@ -337,51 +318,33 @@ export declare class EventRepo {
|
|
|
337
318
|
validationErrors: import("mongoose").Error[];
|
|
338
319
|
} | undefined;
|
|
339
320
|
}>;
|
|
340
|
-
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<Document<unknown, {}, IDocType> & Omit<(import("@chevre/factory/lib/event/anyEvent").IAttributes & {
|
|
321
|
+
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<Document<unknown, {}, import("./mongoose/schemas/event").IDocType> & Omit<(import("@chevre/factory/lib/event/anyEvent").IAttributes & {
|
|
341
322
|
_id: string;
|
|
342
323
|
} & Required<{
|
|
343
|
-
/**
|
|
344
|
-
* イベントリポジトリ
|
|
345
|
-
*/
|
|
346
324
|
_id: string;
|
|
347
325
|
}>) | (import("@chevre/factory/lib/event/screeningEvent").IAttributes & {
|
|
348
326
|
_id: string;
|
|
349
327
|
alternateName?: any;
|
|
350
328
|
aggregateOffer?: import("@chevre/factory/lib/event/anyEvent").IAggregateOffer | undefined;
|
|
351
329
|
} & Required<{
|
|
352
|
-
/**
|
|
353
|
-
* イベントリポジトリ
|
|
354
|
-
*/
|
|
355
330
|
_id: string;
|
|
356
331
|
}>) | (import("@chevre/factory/lib/event/screeningEventSeries").IAttributes & {
|
|
357
332
|
_id: string;
|
|
358
333
|
} & Required<{
|
|
359
|
-
/**
|
|
360
|
-
* イベントリポジトリ
|
|
361
|
-
*/
|
|
362
334
|
_id: string;
|
|
363
|
-
}>), never>, import("mongoose").QueryOptions<Document<unknown, {}, IDocType> & Omit<(import("@chevre/factory/lib/event/anyEvent").IAttributes & {
|
|
335
|
+
}>), never>, import("mongoose").QueryOptions<Document<unknown, {}, import("./mongoose/schemas/event").IDocType> & Omit<(import("@chevre/factory/lib/event/anyEvent").IAttributes & {
|
|
364
336
|
_id: string;
|
|
365
337
|
} & Required<{
|
|
366
|
-
/**
|
|
367
|
-
* イベントリポジトリ
|
|
368
|
-
*/
|
|
369
338
|
_id: string;
|
|
370
339
|
}>) | (import("@chevre/factory/lib/event/screeningEvent").IAttributes & {
|
|
371
340
|
_id: string;
|
|
372
341
|
alternateName?: any;
|
|
373
342
|
aggregateOffer?: import("@chevre/factory/lib/event/anyEvent").IAggregateOffer | undefined;
|
|
374
343
|
} & Required<{
|
|
375
|
-
/**
|
|
376
|
-
* イベントリポジトリ
|
|
377
|
-
*/
|
|
378
344
|
_id: string;
|
|
379
345
|
}>) | (import("@chevre/factory/lib/event/screeningEventSeries").IAttributes & {
|
|
380
346
|
_id: string;
|
|
381
347
|
} & Required<{
|
|
382
|
-
/**
|
|
383
|
-
* イベントリポジトリ
|
|
384
|
-
*/
|
|
385
348
|
_id: string;
|
|
386
349
|
}>), never>>>;
|
|
387
350
|
addAvailableAtOrFrom(params: {
|
|
@@ -408,28 +371,6 @@ export declare class EventRepo {
|
|
|
408
371
|
filter: FilterQuery<factory.event.IEvent<T>>;
|
|
409
372
|
$unset: IUnset<T>;
|
|
410
373
|
}): Promise<import("mongodb").UpdateResult>;
|
|
411
|
-
/**
|
|
412
|
-
* 既存施設コンテンツの最大バージョンを集計する
|
|
413
|
-
*/
|
|
414
|
-
aggregateScreeningEventMaxVersion(params: {
|
|
415
|
-
project: {
|
|
416
|
-
id: {
|
|
417
|
-
$eq: string;
|
|
418
|
-
};
|
|
419
|
-
};
|
|
420
|
-
workPerformed: {
|
|
421
|
-
identifier: {
|
|
422
|
-
$eq: string;
|
|
423
|
-
};
|
|
424
|
-
};
|
|
425
|
-
location: {
|
|
426
|
-
branchCode: {
|
|
427
|
-
$in: string[];
|
|
428
|
-
};
|
|
429
|
-
};
|
|
430
|
-
}): Promise<{
|
|
431
|
-
maxVersion: string;
|
|
432
|
-
}>;
|
|
433
374
|
aggregateEvent(params: {
|
|
434
375
|
project?: {
|
|
435
376
|
id?: {
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -568,119 +568,6 @@ class EventRepo {
|
|
|
568
568
|
}
|
|
569
569
|
});
|
|
570
570
|
}
|
|
571
|
-
/**
|
|
572
|
-
* コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
|
|
573
|
-
*/
|
|
574
|
-
createScreeningEventSeriesIfNotExistByWorkPerformed(params) {
|
|
575
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
576
|
-
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
577
|
-
const bulkWriteOps = [];
|
|
578
|
-
if (Array.isArray(params)) {
|
|
579
|
-
params.forEach((creatingEventParams) => {
|
|
580
|
-
const version = creatingEventParams.attributes.workPerformed.version;
|
|
581
|
-
if (typeof version !== 'string') {
|
|
582
|
-
throw new factory.errors.ArgumentNull('workPerformed.version');
|
|
583
|
-
}
|
|
584
|
-
const setOnInsertFields = creatingEventParams.attributes;
|
|
585
|
-
bulkWriteOps.push({
|
|
586
|
-
updateOne: {
|
|
587
|
-
filter: {
|
|
588
|
-
typeOf: creatingEventParams.attributes.typeOf,
|
|
589
|
-
'project.id': { $eq: creatingEventParams.attributes.project.id },
|
|
590
|
-
'location.branchCode': {
|
|
591
|
-
$exists: true,
|
|
592
|
-
$eq: creatingEventParams.attributes.location.branchCode
|
|
593
|
-
},
|
|
594
|
-
'workPerformed.identifier': {
|
|
595
|
-
$exists: true,
|
|
596
|
-
$eq: creatingEventParams.attributes.workPerformed.identifier
|
|
597
|
-
},
|
|
598
|
-
'workPerformed.version': {
|
|
599
|
-
$exists: true,
|
|
600
|
-
$eq: version
|
|
601
|
-
}
|
|
602
|
-
},
|
|
603
|
-
update: {
|
|
604
|
-
$setOnInsert: Object.assign(Object.assign({}, setOnInsertFields), { _id: uniqid() })
|
|
605
|
-
// 変更可能な属性のみ上書き
|
|
606
|
-
// $set: {}
|
|
607
|
-
},
|
|
608
|
-
upsert: true
|
|
609
|
-
}
|
|
610
|
-
});
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
if (bulkWriteOps.length > 0) {
|
|
614
|
-
return this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* コンテンツ+バージョンをキーにして冪等置換
|
|
620
|
-
*/
|
|
621
|
-
// tslint:disable-next-line:max-func-body-length
|
|
622
|
-
upsertScreeningEventSeriesByVersion(params
|
|
623
|
-
// options?: {
|
|
624
|
-
// }
|
|
625
|
-
) {
|
|
626
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
627
|
-
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
628
|
-
const bulkWriteOps4insert = [];
|
|
629
|
-
// const bulkWriteOps: AnyBulkWriteOperation<factory.event.IAttributes<factory.eventType.ScreeningEventSeries>>[] = [];
|
|
630
|
-
const queryFilters = [];
|
|
631
|
-
if (Array.isArray(params)) {
|
|
632
|
-
params.forEach(({ $set, $unset }) => {
|
|
633
|
-
const version = $set.workPerformed.version;
|
|
634
|
-
if (typeof version !== 'string' || version.length === 0) {
|
|
635
|
-
throw new factory.errors.ArgumentNull('workPerformed.version');
|
|
636
|
-
}
|
|
637
|
-
// リソースのユニークネスを保証するfilter
|
|
638
|
-
const filter = {
|
|
639
|
-
typeOf: $set.typeOf,
|
|
640
|
-
'project.id': { $eq: $set.project.id },
|
|
641
|
-
'location.branchCode': { $exists: true, $eq: $set.location.branchCode },
|
|
642
|
-
'workPerformed.identifier': { $exists: true, $eq: $set.workPerformed.identifier },
|
|
643
|
-
'workPerformed.version': { $exists: true, $eq: version }
|
|
644
|
-
};
|
|
645
|
-
queryFilters.push({
|
|
646
|
-
typeOf: $set.typeOf,
|
|
647
|
-
'project.id': { $eq: $set.project.id },
|
|
648
|
-
'location.branchCode': { $exists: true, $eq: $set.location.branchCode },
|
|
649
|
-
'workPerformed.identifier': { $exists: true, $eq: $set.workPerformed.identifier },
|
|
650
|
-
'workPerformed.version': { $exists: true, $eq: version }
|
|
651
|
-
});
|
|
652
|
-
const { identifier, project, typeOf } = $set, setFields = __rest($set, ["identifier", "project", "typeOf"]);
|
|
653
|
-
const setOnInsert = {
|
|
654
|
-
project,
|
|
655
|
-
typeOf,
|
|
656
|
-
_id: uniqid()
|
|
657
|
-
};
|
|
658
|
-
const updateOne = {
|
|
659
|
-
filter,
|
|
660
|
-
update: Object.assign({ $setOnInsert: setOnInsert, $set: setFields }, ($unset !== undefined) ? { $unset } : undefined),
|
|
661
|
-
upsert: true
|
|
662
|
-
};
|
|
663
|
-
bulkWriteOps4insert.push({ updateOne });
|
|
664
|
-
// updateOneで再実装
|
|
665
|
-
// const replacement: WithoutId<factory.event.IAttributes<factory.eventType.ScreeningEventSeries>> = attributes;
|
|
666
|
-
// const replaceOne: ReplaceOneModel<factory.event.IAttributes<factory.eventType.ScreeningEventSeries>> = {
|
|
667
|
-
// filter,
|
|
668
|
-
// replacement,
|
|
669
|
-
// upsert: true
|
|
670
|
-
// };
|
|
671
|
-
// bulkWriteOps.push({ replaceOne });
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
if (bulkWriteOps4insert.length > 0) {
|
|
675
|
-
const bulkWriteResult4insert = yield this.eventModel.bulkWrite(bulkWriteOps4insert, { ordered: false });
|
|
676
|
-
// const bulkWriteResult = await this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
677
|
-
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
678
|
-
const modifiedEvents = yield this.eventModel.find({ $or: queryFilters }, { _id: 1 })
|
|
679
|
-
.exec();
|
|
680
|
-
return { bulkWriteResult4insert, modifiedEvents };
|
|
681
|
-
}
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
571
|
/**
|
|
685
572
|
* イベント部分更新
|
|
686
573
|
*/
|
|
@@ -1210,43 +1097,6 @@ class EventRepo {
|
|
|
1210
1097
|
.exec();
|
|
1211
1098
|
});
|
|
1212
1099
|
}
|
|
1213
|
-
/**
|
|
1214
|
-
* 既存施設コンテンツの最大バージョンを集計する
|
|
1215
|
-
*/
|
|
1216
|
-
aggregateScreeningEventMaxVersion(params) {
|
|
1217
|
-
var _a;
|
|
1218
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1219
|
-
const aggregations = yield this.eventModel.aggregate([
|
|
1220
|
-
{
|
|
1221
|
-
$match: {
|
|
1222
|
-
typeOf: { $eq: factory.eventType.ScreeningEventSeries },
|
|
1223
|
-
'project.id': { $eq: params.project.id.$eq },
|
|
1224
|
-
'workPerformed.identifier': { $exists: true, $eq: params.workPerformed.identifier.$eq },
|
|
1225
|
-
'workPerformed.version': { $exists: true },
|
|
1226
|
-
'location.branchCode': { $exists: true, $in: params.location.branchCode.$in }
|
|
1227
|
-
}
|
|
1228
|
-
},
|
|
1229
|
-
{
|
|
1230
|
-
$project: {
|
|
1231
|
-
workPerformed: '$workPerformed',
|
|
1232
|
-
// version: { $toInt: '$workPerformed.version' }
|
|
1233
|
-
version: { $toLong: '$workPerformed.version' } // support YYYYMMDDHHmmss
|
|
1234
|
-
}
|
|
1235
|
-
},
|
|
1236
|
-
{
|
|
1237
|
-
$group: {
|
|
1238
|
-
_id: '$typeOf',
|
|
1239
|
-
maxVersion: { $max: '$version' }
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
])
|
|
1243
|
-
.exec();
|
|
1244
|
-
const maxVersion = (aggregations.length > 0)
|
|
1245
|
-
? String((_a = aggregations.shift()) === null || _a === void 0 ? void 0 : _a.maxVersion)
|
|
1246
|
-
: '0';
|
|
1247
|
-
return { maxVersion };
|
|
1248
|
-
});
|
|
1249
|
-
}
|
|
1250
1100
|
aggregateEvent(params) {
|
|
1251
1101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1252
1102
|
const statuses = yield Promise.all([
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { BulkWriteResult } from 'mongodb';
|
|
2
|
+
import type { Connection } from 'mongoose';
|
|
3
|
+
import * as factory from '../factory';
|
|
4
|
+
type IUnset = {
|
|
5
|
+
[key in keyof factory.event.IEvent<factory.eventType.ScreeningEventSeries>]?: 1;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* 施設コンテンツリポジトリ
|
|
9
|
+
*/
|
|
10
|
+
export declare class EventSeriesRepo {
|
|
11
|
+
private readonly eventModel;
|
|
12
|
+
constructor(connection: Connection);
|
|
13
|
+
/**
|
|
14
|
+
* 複数イベントを作成する
|
|
15
|
+
*/
|
|
16
|
+
createMany(params: {
|
|
17
|
+
attributes: factory.event.IAttributes<factory.eventType.ScreeningEventSeries>[];
|
|
18
|
+
expectsNoContent: boolean;
|
|
19
|
+
}): Promise<string[] | void>;
|
|
20
|
+
/**
|
|
21
|
+
* コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
|
|
22
|
+
*/
|
|
23
|
+
createIfNotExistByWorkPerformed(params: {
|
|
24
|
+
attributes: factory.event.IAttributes<factory.eventType.ScreeningEventSeries>;
|
|
25
|
+
}[]): Promise<BulkWriteResult | void>;
|
|
26
|
+
/**
|
|
27
|
+
* コンテンツ+バージョンをキーにして冪等置換
|
|
28
|
+
*/
|
|
29
|
+
upsertByVersion(params: {
|
|
30
|
+
$set: factory.event.IAttributes<factory.eventType.ScreeningEventSeries>;
|
|
31
|
+
$unset?: IUnset;
|
|
32
|
+
}[]): Promise<{
|
|
33
|
+
bulkWriteResult4insert: BulkWriteResult;
|
|
34
|
+
modifiedEvents: {
|
|
35
|
+
id: string;
|
|
36
|
+
}[];
|
|
37
|
+
} | void>;
|
|
38
|
+
/**
|
|
39
|
+
* イベントを保管する
|
|
40
|
+
*/
|
|
41
|
+
save(params: {
|
|
42
|
+
id?: string;
|
|
43
|
+
attributes: factory.event.IAttributes<factory.eventType.ScreeningEventSeries>;
|
|
44
|
+
/**
|
|
45
|
+
* ドキュメント作成時には無視される
|
|
46
|
+
*/
|
|
47
|
+
$unset?: IUnset;
|
|
48
|
+
upsert?: boolean;
|
|
49
|
+
}): Promise<{
|
|
50
|
+
id: string;
|
|
51
|
+
}>;
|
|
52
|
+
saveMany(params: {
|
|
53
|
+
id: string;
|
|
54
|
+
attributes: factory.event.IAttributes<factory.eventType.ScreeningEventSeries>;
|
|
55
|
+
$unset?: IUnset;
|
|
56
|
+
upsert: boolean;
|
|
57
|
+
}[]): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* 既存施設コンテンツの最大バージョンを集計する
|
|
60
|
+
*/
|
|
61
|
+
aggregateMaxVersion(params: {
|
|
62
|
+
project: {
|
|
63
|
+
id: {
|
|
64
|
+
$eq: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
workPerformed: {
|
|
68
|
+
identifier: {
|
|
69
|
+
$eq: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
location: {
|
|
73
|
+
branchCode: {
|
|
74
|
+
$in: string[];
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
}): Promise<{
|
|
78
|
+
maxVersion: string;
|
|
79
|
+
}>;
|
|
80
|
+
}
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.EventSeriesRepo = void 0;
|
|
24
|
+
const factory = require("../factory");
|
|
25
|
+
const event_1 = require("./mongoose/schemas/event");
|
|
26
|
+
const errorHandler_1 = require("../errorHandler");
|
|
27
|
+
/**
|
|
28
|
+
* 施設コンテンツリポジトリ
|
|
29
|
+
*/
|
|
30
|
+
class EventSeriesRepo {
|
|
31
|
+
constructor(connection) {
|
|
32
|
+
this.eventModel = connection.model(event_1.modelName, (0, event_1.createSchema)());
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 複数イベントを作成する
|
|
36
|
+
*/
|
|
37
|
+
createMany(params) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
40
|
+
// let docs: HydratedDocument<factory.event.IEvent<T>>[];
|
|
41
|
+
const insertingDocs = params.attributes.map((p) => {
|
|
42
|
+
return Object.assign({ _id: uniqid() }, p);
|
|
43
|
+
});
|
|
44
|
+
try {
|
|
45
|
+
yield this.eventModel.insertMany(insertingDocs, { rawResult: true } // rawResult(2024-08-02~)
|
|
46
|
+
);
|
|
47
|
+
// console.dir(insertResult, { depth: null });
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (yield (0, errorHandler_1.isMongoError)(error)) {
|
|
51
|
+
if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
|
|
52
|
+
throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEventSeries, ['workPerformed.version']);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
if (params.expectsNoContent) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
// return docs.map((doc) => doc.toObject<factory.event.IEvent<T>>());
|
|
61
|
+
return insertingDocs.map(({ _id }) => _id);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
|
|
66
|
+
*/
|
|
67
|
+
createIfNotExistByWorkPerformed(params) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
70
|
+
const bulkWriteOps = [];
|
|
71
|
+
if (Array.isArray(params)) {
|
|
72
|
+
params.forEach((creatingEventParams) => {
|
|
73
|
+
const version = creatingEventParams.attributes.workPerformed.version;
|
|
74
|
+
if (typeof version !== 'string') {
|
|
75
|
+
throw new factory.errors.ArgumentNull('workPerformed.version');
|
|
76
|
+
}
|
|
77
|
+
const setOnInsertFields = creatingEventParams.attributes;
|
|
78
|
+
bulkWriteOps.push({
|
|
79
|
+
updateOne: {
|
|
80
|
+
filter: {
|
|
81
|
+
typeOf: creatingEventParams.attributes.typeOf,
|
|
82
|
+
'project.id': { $eq: creatingEventParams.attributes.project.id },
|
|
83
|
+
'location.branchCode': {
|
|
84
|
+
$exists: true,
|
|
85
|
+
$eq: creatingEventParams.attributes.location.branchCode
|
|
86
|
+
},
|
|
87
|
+
'workPerformed.identifier': {
|
|
88
|
+
$exists: true,
|
|
89
|
+
$eq: creatingEventParams.attributes.workPerformed.identifier
|
|
90
|
+
},
|
|
91
|
+
'workPerformed.version': {
|
|
92
|
+
$exists: true,
|
|
93
|
+
$eq: version
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
update: {
|
|
97
|
+
$setOnInsert: Object.assign(Object.assign({}, setOnInsertFields), { _id: uniqid() })
|
|
98
|
+
// 変更可能な属性のみ上書き
|
|
99
|
+
// $set: {}
|
|
100
|
+
},
|
|
101
|
+
upsert: true
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (bulkWriteOps.length > 0) {
|
|
107
|
+
return this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* コンテンツ+バージョンをキーにして冪等置換
|
|
113
|
+
*/
|
|
114
|
+
// tslint:disable-next-line:max-func-body-length
|
|
115
|
+
upsertByVersion(params
|
|
116
|
+
// options?: {
|
|
117
|
+
// }
|
|
118
|
+
) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
121
|
+
const bulkWriteOps4insert = [];
|
|
122
|
+
// const bulkWriteOps: AnyBulkWriteOperation<factory.event.IAttributes<factory.eventType.ScreeningEventSeries>>[] = [];
|
|
123
|
+
const queryFilters = [];
|
|
124
|
+
if (Array.isArray(params)) {
|
|
125
|
+
params.forEach(({ $set, $unset }) => {
|
|
126
|
+
const version = $set.workPerformed.version;
|
|
127
|
+
if (typeof version !== 'string' || version.length === 0) {
|
|
128
|
+
throw new factory.errors.ArgumentNull('workPerformed.version');
|
|
129
|
+
}
|
|
130
|
+
// リソースのユニークネスを保証するfilter
|
|
131
|
+
const filter = {
|
|
132
|
+
typeOf: $set.typeOf,
|
|
133
|
+
'project.id': { $eq: $set.project.id },
|
|
134
|
+
'location.branchCode': { $exists: true, $eq: $set.location.branchCode },
|
|
135
|
+
'workPerformed.identifier': { $exists: true, $eq: $set.workPerformed.identifier },
|
|
136
|
+
'workPerformed.version': { $exists: true, $eq: version }
|
|
137
|
+
};
|
|
138
|
+
queryFilters.push({
|
|
139
|
+
typeOf: $set.typeOf,
|
|
140
|
+
'project.id': { $eq: $set.project.id },
|
|
141
|
+
'location.branchCode': { $exists: true, $eq: $set.location.branchCode },
|
|
142
|
+
'workPerformed.identifier': { $exists: true, $eq: $set.workPerformed.identifier },
|
|
143
|
+
'workPerformed.version': { $exists: true, $eq: version }
|
|
144
|
+
});
|
|
145
|
+
const { identifier, project, typeOf } = $set, setFields = __rest($set, ["identifier", "project", "typeOf"]);
|
|
146
|
+
const setOnInsert = {
|
|
147
|
+
project,
|
|
148
|
+
typeOf,
|
|
149
|
+
_id: uniqid()
|
|
150
|
+
};
|
|
151
|
+
const updateOne = {
|
|
152
|
+
filter,
|
|
153
|
+
update: Object.assign({ $setOnInsert: setOnInsert, $set: setFields }, ($unset !== undefined) ? { $unset } : undefined),
|
|
154
|
+
upsert: true
|
|
155
|
+
};
|
|
156
|
+
bulkWriteOps4insert.push({ updateOne });
|
|
157
|
+
// updateOneで再実装
|
|
158
|
+
// const replacement: WithoutId<factory.event.IAttributes<factory.eventType.ScreeningEventSeries>> = attributes;
|
|
159
|
+
// const replaceOne: ReplaceOneModel<factory.event.IAttributes<factory.eventType.ScreeningEventSeries>> = {
|
|
160
|
+
// filter,
|
|
161
|
+
// replacement,
|
|
162
|
+
// upsert: true
|
|
163
|
+
// };
|
|
164
|
+
// bulkWriteOps.push({ replaceOne });
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (bulkWriteOps4insert.length > 0) {
|
|
168
|
+
const bulkWriteResult4insert = yield this.eventModel.bulkWrite(bulkWriteOps4insert, { ordered: false });
|
|
169
|
+
// const bulkWriteResult = await this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
170
|
+
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
171
|
+
const modifiedEvents = yield this.eventModel.find({ $or: queryFilters }, { _id: 1 })
|
|
172
|
+
.exec();
|
|
173
|
+
return { bulkWriteResult4insert, modifiedEvents };
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* イベントを保管する
|
|
179
|
+
*/
|
|
180
|
+
save(params) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
let savedEventId;
|
|
183
|
+
let doc;
|
|
184
|
+
const _a = params.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
|
|
185
|
+
if (typeof typeOf !== 'string' || typeOf.length === 0) {
|
|
186
|
+
throw new factory.errors.ArgumentNull('attributes.typeOf');
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
if (params.id === undefined) {
|
|
190
|
+
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
191
|
+
const id = uniqid();
|
|
192
|
+
doc = yield this.eventModel.create(Object.assign(Object.assign({}, params.attributes), { _id: id }));
|
|
193
|
+
savedEventId = id;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
const upsert = params.upsert === true;
|
|
197
|
+
doc = yield this.eventModel.findOneAndUpdate({
|
|
198
|
+
_id: { $eq: params.id },
|
|
199
|
+
typeOf: { $eq: typeOf }
|
|
200
|
+
}, Object.assign({
|
|
201
|
+
// 上書き禁止属性を除外(2022-08-24~)
|
|
202
|
+
$setOnInsert: Object.assign({ typeOf,
|
|
203
|
+
project }, (identifier !== undefined) ? { identifier } : undefined), $set: updateFields }, (params.$unset !== undefined) ? { $unset: params.$unset } : undefined), { upsert, new: true, projection: { _id: 1 } })
|
|
204
|
+
.lean()
|
|
205
|
+
.exec();
|
|
206
|
+
savedEventId = params.id;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
if (yield (0, errorHandler_1.isMongoError)(error)) {
|
|
211
|
+
if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
|
|
212
|
+
throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEventSeries, ['workPerformed.version']);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
throw error;
|
|
216
|
+
}
|
|
217
|
+
if (doc === null) {
|
|
218
|
+
throw new factory.errors.NotFound(this.eventModel.modelName);
|
|
219
|
+
}
|
|
220
|
+
return { id: savedEventId }; // optimize(2024-07-31~)
|
|
221
|
+
// return doc.toObject();
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
saveMany(params) {
|
|
225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
const bulkWriteOps = [];
|
|
227
|
+
if (Array.isArray(params)) {
|
|
228
|
+
params.forEach((p) => {
|
|
229
|
+
const upsert = p.upsert === true;
|
|
230
|
+
// 上書き禁止属性を除外(2022-08-24~)
|
|
231
|
+
const _a = p.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
|
|
232
|
+
bulkWriteOps.push({
|
|
233
|
+
updateOne: {
|
|
234
|
+
filter: {
|
|
235
|
+
_id: p.id,
|
|
236
|
+
typeOf: p.attributes.typeOf
|
|
237
|
+
},
|
|
238
|
+
// upsertの場合、createがありうるので属性を除外しない
|
|
239
|
+
update: Object.assign({ $setOnInsert: Object.assign({ typeOf: p.attributes.typeOf, project: p.attributes.project }, (typeof p.attributes.identifier === 'string')
|
|
240
|
+
? { identifier: p.attributes.identifier } : undefined), $set: updateFields }, (p.$unset !== undefined) ? { $unset: p.$unset } : undefined),
|
|
241
|
+
upsert
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
if (bulkWriteOps.length > 0) {
|
|
247
|
+
yield this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* 既存施設コンテンツの最大バージョンを集計する
|
|
253
|
+
*/
|
|
254
|
+
aggregateMaxVersion(params) {
|
|
255
|
+
var _a;
|
|
256
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
257
|
+
const aggregations = yield this.eventModel.aggregate([
|
|
258
|
+
{
|
|
259
|
+
$match: {
|
|
260
|
+
typeOf: { $eq: factory.eventType.ScreeningEventSeries },
|
|
261
|
+
'project.id': { $eq: params.project.id.$eq },
|
|
262
|
+
'workPerformed.identifier': { $exists: true, $eq: params.workPerformed.identifier.$eq },
|
|
263
|
+
'workPerformed.version': { $exists: true },
|
|
264
|
+
'location.branchCode': { $exists: true, $in: params.location.branchCode.$in }
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
$project: {
|
|
269
|
+
workPerformed: '$workPerformed',
|
|
270
|
+
// version: { $toInt: '$workPerformed.version' }
|
|
271
|
+
version: { $toLong: '$workPerformed.version' } // support YYYYMMDDHHmmss
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
$group: {
|
|
276
|
+
_id: '$typeOf',
|
|
277
|
+
maxVersion: { $max: '$version' }
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
])
|
|
281
|
+
.exec();
|
|
282
|
+
const maxVersion = (aggregations.length > 0)
|
|
283
|
+
? String((_a = aggregations.shift()) === null || _a === void 0 ? void 0 : _a.maxVersion)
|
|
284
|
+
: '0';
|
|
285
|
+
return { maxVersion };
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
exports.EventSeriesRepo = EventSeriesRepo;
|
|
@@ -50,6 +50,9 @@ const schemaDefinition = {
|
|
|
50
50
|
aggregateReservation: mongoose_1.SchemaTypes.Mixed,
|
|
51
51
|
aggregateOffer: mongoose_1.SchemaTypes.Mixed,
|
|
52
52
|
coaInfo: mongoose_1.SchemaTypes.Mixed
|
|
53
|
+
// createdAt: SchemaTypes.Mixed,
|
|
54
|
+
// updatedAt: SchemaTypes.Mixed,
|
|
55
|
+
// __v: SchemaTypes.Mixed
|
|
53
56
|
};
|
|
54
57
|
const schemaOptions = {
|
|
55
58
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -60,10 +63,8 @@ const schemaOptions = {
|
|
|
60
63
|
writeConcern: writeConcern_1.writeConcern,
|
|
61
64
|
strict: true,
|
|
62
65
|
strictQuery: false,
|
|
63
|
-
timestamps:
|
|
64
|
-
|
|
65
|
-
updatedAt: 'updatedAt'
|
|
66
|
-
},
|
|
66
|
+
timestamps: false,
|
|
67
|
+
versionKey: false,
|
|
67
68
|
toJSON: {
|
|
68
69
|
getters: false,
|
|
69
70
|
virtuals: false,
|
|
@@ -78,14 +79,6 @@ const schemaOptions = {
|
|
|
78
79
|
}
|
|
79
80
|
};
|
|
80
81
|
const indexes = [
|
|
81
|
-
[
|
|
82
|
-
{ createdAt: 1 },
|
|
83
|
-
{ name: 'searchByCreatedAt' }
|
|
84
|
-
],
|
|
85
|
-
[
|
|
86
|
-
{ updatedAt: 1 },
|
|
87
|
-
{ name: 'searchByUpdatedAt' }
|
|
88
|
-
],
|
|
89
82
|
[
|
|
90
83
|
{ 'project.id': 1, startDate: 1 },
|
|
91
84
|
{
|
|
@@ -20,6 +20,7 @@ import type { CustomerRepo } from './repo/customer';
|
|
|
20
20
|
import type { CustomerTypeRepo } from './repo/customerType';
|
|
21
21
|
import type { EmailMessageRepo } from './repo/emailMessage';
|
|
22
22
|
import type { EventRepo } from './repo/event';
|
|
23
|
+
import type { EventSeriesRepo } from './repo/eventSeries';
|
|
23
24
|
import type { MemberRepo } from './repo/member';
|
|
24
25
|
import type { MerchantReturnPolicyRepo } from './repo/merchantReturnPolicy';
|
|
25
26
|
import type { MessageRepo } from './repo/message';
|
|
@@ -146,6 +147,10 @@ export type Event = EventRepo;
|
|
|
146
147
|
export declare namespace Event {
|
|
147
148
|
function createInstance(...params: ConstructorParameters<typeof EventRepo>): Promise<EventRepo>;
|
|
148
149
|
}
|
|
150
|
+
export type EventSeries = EventSeriesRepo;
|
|
151
|
+
export declare namespace EventSeries {
|
|
152
|
+
function createInstance(...params: ConstructorParameters<typeof EventSeriesRepo>): Promise<EventSeriesRepo>;
|
|
153
|
+
}
|
|
149
154
|
export type Member = MemberRepo;
|
|
150
155
|
export declare namespace Member {
|
|
151
156
|
function createInstance(...params: ConstructorParameters<typeof MemberRepo>): Promise<MemberRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = void 0;
|
|
12
|
+
exports.SellerPaymentAccepted = exports.Seller = exports.Role = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.Product = exports.PriceSpecification = exports.place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.Note = exports.Message = exports.MerchantReturnPolicy = exports.Member = exports.EventSeries = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
|
|
13
|
+
exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = void 0;
|
|
14
14
|
var AcceptedOffer;
|
|
15
15
|
(function (AcceptedOffer) {
|
|
16
16
|
let repo;
|
|
@@ -271,6 +271,19 @@ var Event;
|
|
|
271
271
|
}
|
|
272
272
|
Event.createInstance = createInstance;
|
|
273
273
|
})(Event = exports.Event || (exports.Event = {}));
|
|
274
|
+
var EventSeries;
|
|
275
|
+
(function (EventSeries) {
|
|
276
|
+
let repo;
|
|
277
|
+
function createInstance(...params) {
|
|
278
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
279
|
+
if (repo === undefined) {
|
|
280
|
+
repo = (yield Promise.resolve().then(() => require('./repo/eventSeries'))).EventSeriesRepo;
|
|
281
|
+
}
|
|
282
|
+
return new repo(...params);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
EventSeries.createInstance = createInstance;
|
|
286
|
+
})(EventSeries = exports.EventSeries || (exports.EventSeries = {}));
|
|
274
287
|
var Member;
|
|
275
288
|
(function (Member) {
|
|
276
289
|
let repo;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import type { ActionRepo } from '../../repo/action';
|
|
3
3
|
import type { EventRepo } from '../../repo/event';
|
|
4
|
+
import type { EventSeriesRepo } from '../../repo/eventSeries';
|
|
4
5
|
import type { MovieTheaterRepo } from '../../repo/place/movieTheater';
|
|
5
6
|
import type { TaskRepo } from '../../repo/task';
|
|
6
7
|
export declare function createEvent(params: factory.task.createEvent.IData): (repos: {
|
|
7
8
|
action: ActionRepo;
|
|
8
9
|
event: EventRepo;
|
|
10
|
+
eventSeries: EventSeriesRepo;
|
|
9
11
|
movieTheater: MovieTheaterRepo;
|
|
10
12
|
task: TaskRepo;
|
|
11
13
|
}) => Promise<void>;
|
|
@@ -57,7 +57,7 @@ function createEvent(params) {
|
|
|
57
57
|
};
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
const bulkWriteResult = yield repos.
|
|
60
|
+
const bulkWriteResult = yield repos.eventSeries.createIfNotExistByWorkPerformed(creatingEventParams);
|
|
61
61
|
let upsertedIds;
|
|
62
62
|
if (bulkWriteResult !== undefined) {
|
|
63
63
|
upsertedIds = bulkWriteResult.getUpsertedIds()
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.call = void 0;
|
|
13
13
|
const action_1 = require("../../repo/action");
|
|
14
14
|
const event_1 = require("../../repo/event");
|
|
15
|
+
const eventSeries_1 = require("../../repo/eventSeries");
|
|
15
16
|
const movieTheater_1 = require("../../repo/place/movieTheater");
|
|
16
17
|
const task_1 = require("../../repo/task");
|
|
17
18
|
const EventService = require("../event");
|
|
@@ -23,6 +24,7 @@ function call(data) {
|
|
|
23
24
|
yield EventService.createEvent(data)({
|
|
24
25
|
action: new action_1.ActionRepo(connection),
|
|
25
26
|
event: new event_1.EventRepo(connection),
|
|
27
|
+
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
26
28
|
movieTheater: new movieTheater_1.MovieTheaterRepo(connection),
|
|
27
29
|
task: new task_1.TaskRepo(connection)
|
|
28
30
|
});
|
package/package.json
CHANGED