@chevre/domain 22.3.0-alpha.19 → 22.3.0-alpha.20
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/lib/chevre/repo/eventSeries.d.ts +6 -24
- package/lib/chevre/repo/eventSeries.js +53 -43
- package/lib/chevre/repo/mongoose/schemas/eventSeries.d.ts +1 -9
- package/lib/chevre/repo/mongoose/schemas/eventSeries.js +0 -9
- package/lib/chevre/settings.d.ts +0 -2
- package/lib/chevre/settings.js +1 -9
- package/package.json +1 -1
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
import type { BulkWriteResult } from 'mongodb';
|
|
26
26
|
import type { Connection, Document, FilterQuery } from 'mongoose';
|
|
27
27
|
import * as factory from '../factory';
|
|
28
|
-
import { IDocType } from './mongoose/schemas/event';
|
|
29
28
|
type ISearchConditions = Omit<factory.event.ISearchConditions<factory.eventType.ScreeningEventSeries>, 'typeOfIn' | 'hasOfferCatalog'>;
|
|
30
29
|
type IKeyOfProjection = Exclude<keyof factory.event.IEvent<factory.eventType.ScreeningEventSeries>, 'id'>;
|
|
31
30
|
type IUnset = {
|
|
@@ -36,7 +35,6 @@ type IUnset = {
|
|
|
36
35
|
*/
|
|
37
36
|
export declare class EventSeriesRepo {
|
|
38
37
|
private readonly eventModel;
|
|
39
|
-
private readonly secondaryEventModel;
|
|
40
38
|
constructor(connection: Connection);
|
|
41
39
|
static CREATE_MONGO_CONDITIONS(conditions: ISearchConditions): FilterQuery<factory.event.IEvent<factory.eventType.ScreeningEventSeries>>[];
|
|
42
40
|
/**
|
|
@@ -129,37 +127,21 @@ export declare class EventSeriesRepo {
|
|
|
129
127
|
}): Promise<{
|
|
130
128
|
maxVersion: string;
|
|
131
129
|
}>;
|
|
132
|
-
sync2secondary(
|
|
130
|
+
sync2secondary(__: {
|
|
133
131
|
id: string;
|
|
134
132
|
}): Promise<void>;
|
|
135
|
-
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<Document<unknown, {},
|
|
133
|
+
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<Document<unknown, {}, import("@chevre/factory/lib/event/screeningEventSeries").IAttributes & {
|
|
136
134
|
_id: string;
|
|
137
|
-
} &
|
|
138
|
-
_id: string;
|
|
139
|
-
}>) | (import("@chevre/factory/lib/event/screeningEvent").IAttributes & {
|
|
140
|
-
_id: string;
|
|
141
|
-
alternateName?: any;
|
|
142
|
-
aggregateOffer?: import("@chevre/factory/lib/event/anyEvent").IAggregateOffer | undefined;
|
|
143
|
-
} & Required<{
|
|
144
|
-
_id: string;
|
|
145
|
-
}>) | (import("@chevre/factory/lib/event/screeningEventSeries").IAttributes & {
|
|
135
|
+
}> & import("@chevre/factory/lib/event/screeningEventSeries").IAttributes & {
|
|
146
136
|
_id: string;
|
|
147
137
|
} & Required<{
|
|
148
138
|
_id: string;
|
|
149
|
-
}
|
|
150
|
-
_id: string;
|
|
151
|
-
} & Required<{
|
|
152
|
-
_id: string;
|
|
153
|
-
}>) | (import("@chevre/factory/lib/event/screeningEvent").IAttributes & {
|
|
154
|
-
_id: string;
|
|
155
|
-
alternateName?: any;
|
|
156
|
-
aggregateOffer?: import("@chevre/factory/lib/event/anyEvent").IAggregateOffer | undefined;
|
|
157
|
-
} & Required<{
|
|
139
|
+
}>, import("mongoose").QueryOptions<Document<unknown, {}, import("@chevre/factory/lib/event/screeningEventSeries").IAttributes & {
|
|
158
140
|
_id: string;
|
|
159
|
-
}>
|
|
141
|
+
}> & import("@chevre/factory/lib/event/screeningEventSeries").IAttributes & {
|
|
160
142
|
_id: string;
|
|
161
143
|
} & Required<{
|
|
162
144
|
_id: string;
|
|
163
|
-
}
|
|
145
|
+
}>>>;
|
|
164
146
|
}
|
|
165
147
|
export {};
|
|
@@ -22,7 +22,7 @@ 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
|
-
|
|
25
|
+
// import { createSchema, IDocType, IModel, modelName } from './mongoose/schemas/event';
|
|
26
26
|
const eventSeries_1 = require("./mongoose/schemas/eventSeries");
|
|
27
27
|
const errorHandler_1 = require("../errorHandler");
|
|
28
28
|
const settings_1 = require("../settings");
|
|
@@ -30,15 +30,18 @@ const settings_1 = require("../settings");
|
|
|
30
30
|
* 施設コンテンツリポジトリ
|
|
31
31
|
*/
|
|
32
32
|
class EventSeriesRepo {
|
|
33
|
+
// private readonly eventModel: IModel | INewModel;
|
|
34
|
+
// private readonly secondaryEventModel: IModel | INewModel;
|
|
33
35
|
constructor(connection) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
this.eventModel = connection.model(eventSeries_1.modelName, (0, eventSeries_1.createSchema)());
|
|
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
|
+
// }
|
|
42
45
|
}
|
|
43
46
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
44
47
|
static CREATE_MONGO_CONDITIONS(conditions) {
|
|
@@ -455,9 +458,9 @@ class EventSeriesRepo {
|
|
|
455
458
|
if (bulkWriteOps.length > 0) {
|
|
456
459
|
yield this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
457
460
|
// sync2secondary(2024-09-10~)
|
|
458
|
-
if (
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
+
// if (USE_EVENT_SERIES_SYNC2SECONDARY) {
|
|
462
|
+
// await (<INewModel>this.secondaryEventModel).bulkWrite(bulkWriteOps, { ordered: false });
|
|
463
|
+
// }
|
|
461
464
|
}
|
|
462
465
|
});
|
|
463
466
|
}
|
|
@@ -611,38 +614,45 @@ class EventSeriesRepo {
|
|
|
611
614
|
return { maxVersion };
|
|
612
615
|
});
|
|
613
616
|
}
|
|
614
|
-
|
|
617
|
+
// tslint:disable-next-line:prefer-function-over-method
|
|
618
|
+
sync2secondary(__) {
|
|
615
619
|
return __awaiter(this, void 0, void 0, function* () {
|
|
616
|
-
if (!
|
|
617
|
-
|
|
618
|
-
}
|
|
619
|
-
const doc =
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
})
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
if (doc !== null) {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
}
|
|
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
|
+
// }
|
|
646
656
|
});
|
|
647
657
|
}
|
|
648
658
|
getCursor(conditions, projection) {
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
|
-
type IDocTypeAsEvent = factory.event.IAttributes<factory.eventType.Event> & {
|
|
4
|
-
_id: string;
|
|
5
|
-
};
|
|
6
|
-
type IDocTypeAsScreeningEvent = factory.event.IAttributes<factory.eventType.ScreeningEvent> & {
|
|
7
|
-
_id: string;
|
|
8
|
-
alternateName?: any;
|
|
9
|
-
aggregateOffer?: factory.event.event.IAggregateOffer;
|
|
10
|
-
};
|
|
11
3
|
type IDocTypeAsEventSeries = factory.event.IAttributes<factory.eventType.ScreeningEventSeries> & {
|
|
12
4
|
_id: string;
|
|
13
5
|
};
|
|
14
|
-
export type IDocType =
|
|
6
|
+
export type IDocType = IDocTypeAsEventSeries;
|
|
15
7
|
type IModel = Model<IDocType>;
|
|
16
8
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
17
9
|
type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
|
|
@@ -40,15 +40,6 @@ const schemaDefinition = {
|
|
|
40
40
|
kanaName: String,
|
|
41
41
|
offers: mongoose_1.SchemaTypes.Mixed,
|
|
42
42
|
coaInfo: mongoose_1.SchemaTypes.Mixed
|
|
43
|
-
// alternateName: SchemaTypes.Mixed,
|
|
44
|
-
// doorTime: SchemaTypes.Mixed,
|
|
45
|
-
// superEvent: SchemaTypes.Mixed,
|
|
46
|
-
// maximumAttendeeCapacity: SchemaTypes.Mixed,
|
|
47
|
-
// remainingAttendeeCapacity: SchemaTypes.Mixed,
|
|
48
|
-
// checkInCount: SchemaTypes.Mixed,
|
|
49
|
-
// attendeeCount: SchemaTypes.Mixed,
|
|
50
|
-
// aggregateReservation: SchemaTypes.Mixed,
|
|
51
|
-
// aggregateOffer: SchemaTypes.Mixed
|
|
52
43
|
};
|
|
53
44
|
const schemaOptions = {
|
|
54
45
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -5,11 +5,9 @@ export declare const MONGO_AUTO_INDEX: boolean;
|
|
|
5
5
|
/**
|
|
6
6
|
* 施設コンテンツのprimaryコレクションとして新スキーマを使用するかどうか
|
|
7
7
|
*/
|
|
8
|
-
export declare const USE_EVENT_SERIES_NEW_SCHEMA: boolean;
|
|
9
8
|
/**
|
|
10
9
|
* 施設コンテンツのsecondaryコレクションへ同期するかどうか
|
|
11
10
|
*/
|
|
12
|
-
export declare const USE_EVENT_SERIES_SYNC2SECONDARY: boolean;
|
|
13
11
|
interface IOptions {
|
|
14
12
|
onOrderStatusChanged: factory.project.IOnOrderStatusChanged;
|
|
15
13
|
onEventChanged: {
|
package/lib/chevre/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Settings = exports.
|
|
3
|
+
exports.Settings = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = void 0;
|
|
4
4
|
exports.MONGO_MAX_TIME_MS = (typeof process.env.MONGO_MAX_TIME_MS === 'string')
|
|
5
5
|
? Number(process.env.MONGO_MAX_TIME_MS)
|
|
6
6
|
// tslint:disable-next-line:no-magic-numbers
|
|
@@ -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
|
-
exports.USE_EVENT_SERIES_NEW_SCHEMA = process.env.USE_EVENT_SERIES_NEW_SCHEMA === '1';
|
|
16
|
-
/**
|
|
17
|
-
* 施設コンテンツのsecondaryコレクションへ同期するかどうか
|
|
18
|
-
*/
|
|
19
|
-
exports.USE_EVENT_SERIES_SYNC2SECONDARY = process.env.USE_EVENT_SERIES_SYNC2SECONDARY === '1';
|
|
20
12
|
/**
|
|
21
13
|
* domain settings
|
|
22
14
|
*/
|
package/package.json
CHANGED