@chevre/domain 21.8.0-alpha.65 → 21.8.0-alpha.67
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/optimizeCatalogs.ts +35 -2
- package/example/src/chevre/searchOfferCatalogs.ts +7 -3
- package/example/src/chevre/syncCatalogs2aggregateOffers.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +12 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +6 -0
- package/lib/chevre/repo/offer.js +0 -4
- package/lib/chevre/repo/offerCatalog.d.ts +5 -3
- package/lib/chevre/repo/offerCatalog.js +20 -10
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +45 -27
- package/package.json +2 -2
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +0 -140
- package/lib/chevre/repo/mongoose/schemas/offer.js +0 -211
|
@@ -11,11 +11,44 @@ async function main() {
|
|
|
11
11
|
|
|
12
12
|
const offerCatalogRepo = new chevre.repository.OfferCatalog(mongoose.connection);
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const cursor = offerCatalogRepo.getCursor(
|
|
15
|
+
{
|
|
16
|
+
// 'project.id': { $eq: project.id }
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
__v: 0,
|
|
20
|
+
createdAt: 0,
|
|
21
|
+
updatedAt: 0
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
console.log('catalogs found');
|
|
25
|
+
|
|
26
|
+
let i = 0;
|
|
27
|
+
let updateCount = 0;
|
|
28
|
+
await cursor.eachAsync(async (doc) => {
|
|
29
|
+
i += 1;
|
|
30
|
+
const { _id, ...offerCatalog } = <chevre.factory.offerCatalog.IOfferCatalog & { _id: string }>doc.toObject();
|
|
31
|
+
|
|
32
|
+
let itemListElementTypeOfEqOffer = false;
|
|
33
|
+
itemListElementTypeOfEqOffer = offerCatalog.itemListElement.every((element) => element.typeOf === chevre.factory.offerType.Offer);
|
|
34
|
+
if (!itemListElementTypeOfEqOffer) {
|
|
35
|
+
throw new Error(`itemListElementTypeOfEqOffer: false. ${offerCatalog.project.id} ${offerCatalog.id}`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const itemOfferedKeys = Object.keys(offerCatalog.itemOffered);
|
|
39
|
+
console.log(itemOfferedKeys);
|
|
40
|
+
if (itemOfferedKeys.length > 1) {
|
|
41
|
+
console.log(itemOfferedKeys, offerCatalog.project.id, offerCatalog.id);
|
|
42
|
+
updateCount += 1;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
15
45
|
|
|
46
|
+
console.log(i, 'catalogs checked');
|
|
47
|
+
console.log(updateCount, 'catalogs synced');
|
|
48
|
+
|
|
49
|
+
await offerCatalogRepo.optimizeAll();
|
|
16
50
|
console.log('optmized');
|
|
17
51
|
}
|
|
18
|
-
|
|
19
52
|
main()
|
|
20
53
|
.then()
|
|
21
54
|
.catch(console.error);
|
|
@@ -4,9 +4,12 @@ import * as mongoose from 'mongoose';
|
|
|
4
4
|
import { chevre } from '../../../lib/index';
|
|
5
5
|
|
|
6
6
|
const PROJECT_ID = process.env.PROJECT_ID;
|
|
7
|
+
mongoose.Model.on('index', (...args) => {
|
|
8
|
+
console.error('******** index event emitted. ********\n', args);
|
|
9
|
+
});
|
|
7
10
|
|
|
8
11
|
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: true });
|
|
10
13
|
|
|
11
14
|
const catalogRepo = new chevre.repository.OfferCatalog(mongoose.connection);
|
|
12
15
|
|
|
@@ -17,10 +20,11 @@ async function main() {
|
|
|
17
20
|
identifier: { $eq: '0001' },
|
|
18
21
|
sort: { identifier: chevre.factory.sortType.Descending },
|
|
19
22
|
limit: 2,
|
|
20
|
-
page: 1
|
|
23
|
+
page: 1,
|
|
24
|
+
itemListElement: { typeOf: { $eq: 'Offer' } }
|
|
21
25
|
}
|
|
22
26
|
);
|
|
23
|
-
console.log('catalogs found', catalogs.map((catalog) => `${catalog.identifier} ${catalog.numberOfItems}`));
|
|
27
|
+
console.log('catalogs found', catalogs.map((catalog) => `${catalog.identifier} ${catalog.numberOfItems} ${catalog.itemListElementTypeOf}`));
|
|
24
28
|
console.log(catalogs.length);
|
|
25
29
|
}
|
|
26
30
|
|
|
@@ -4,6 +4,9 @@ import * as mongoose from 'mongoose';
|
|
|
4
4
|
import { chevre } from '../../../lib/index';
|
|
5
5
|
|
|
6
6
|
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
mongoose.Model.on('index', (...args) => {
|
|
8
|
+
console.error('******** index event emitted. ********\n', args);
|
|
9
|
+
});
|
|
7
10
|
|
|
8
11
|
// tslint:disable-next-line:max-func-body-length
|
|
9
12
|
async function main() {
|
|
@@ -53,6 +53,18 @@ schema.index({ 'offers.identifier': 1, 'project.id': 1 }, {
|
|
|
53
53
|
name: 'uniqueOfferIdentifier',
|
|
54
54
|
unique: true
|
|
55
55
|
});
|
|
56
|
+
schema.index({ 'includedInDataCatalog.id': 1 }, {
|
|
57
|
+
name: 'searchByIncludedInDataCatalogId',
|
|
58
|
+
partialFilterExpression: {
|
|
59
|
+
'includedInDataCatalog.id': { $exists: true }
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
schema.index({ 'offers.includedInDataCatalog.id': 1, 'offers.priceSpecification.price': 1 }, {
|
|
63
|
+
name: 'searchByOffersIncludedInDataCatalogId',
|
|
64
|
+
partialFilterExpression: {
|
|
65
|
+
'offers.includedInDataCatalog.id': { $exists: true }
|
|
66
|
+
}
|
|
67
|
+
});
|
|
56
68
|
schema.index({ 'offers.availability': 1, 'offers.priceSpecification.price': 1 }, { name: 'searchByOffersAvailability' });
|
|
57
69
|
schema.index({ 'offers.itemOffered.typeOf': 1, 'offers.priceSpecification.price': 1 }, { name: 'searchByOffersItemOfferedTypeOf' });
|
|
58
70
|
schema.index({ 'offers.identifier': 1, 'offers.priceSpecification.price': 1 }, {
|
|
@@ -61,6 +61,12 @@ schema.index({ identifier: 1 }, {
|
|
|
61
61
|
schema.index({ 'project.id': 1, identifier: 1 }, {
|
|
62
62
|
name: 'searchByProjectId-v20220721'
|
|
63
63
|
});
|
|
64
|
+
schema.index({ 'itemListElement.typeOf': 1, identifier: 1 }, {
|
|
65
|
+
name: 'searchByItemListElementTypeOf',
|
|
66
|
+
partialFilterExpression: {
|
|
67
|
+
'itemListElement.typeOf': { $exists: true }
|
|
68
|
+
}
|
|
69
|
+
});
|
|
64
70
|
schema.index({ 'itemListElement.id': 1, identifier: 1 }, {
|
|
65
71
|
name: 'searchByItemListElementId',
|
|
66
72
|
partialFilterExpression: {
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -32,10 +32,6 @@ const OFFERS_ARRAY_INDEX_NAME = 'offerIndex';
|
|
|
32
32
|
class MongoRepository {
|
|
33
33
|
constructor(connection) {
|
|
34
34
|
this.aggregateOfferModel = connection.model(aggregateOffer_1.modelName, aggregateOffer_1.schema);
|
|
35
|
-
// .on('index', (error: any) => {
|
|
36
|
-
// // tslint:disable-next-line:no-console
|
|
37
|
-
// console.error('index event emitted.', error);
|
|
38
|
-
// });
|
|
39
35
|
this.offerCatalogModel = connection.model(offerCatalog_1.modelName, offerCatalog_1.schema);
|
|
40
36
|
}
|
|
41
37
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import { Connection } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
|
+
export type IAggregatedOfferCatalog = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered' | 'additionalProperty'> & {
|
|
28
|
+
numberOfItems?: number;
|
|
29
|
+
itemListElementTypeOf: factory.offerType.Offer | 'OfferCatalog';
|
|
30
|
+
};
|
|
27
31
|
/**
|
|
28
32
|
* オファーカタログリポジトリ
|
|
29
33
|
*/
|
|
@@ -77,9 +81,7 @@ export declare class MongoRepository {
|
|
|
77
81
|
};
|
|
78
82
|
};
|
|
79
83
|
}): Promise<import("mongodb").UpdateResult | undefined>;
|
|
80
|
-
search(params: factory.offerCatalog.ISearchConditions): Promise<
|
|
81
|
-
numberOfItems?: number;
|
|
82
|
-
})[]>;
|
|
84
|
+
search(params: factory.offerCatalog.ISearchConditions): Promise<IAggregatedOfferCatalog[]>;
|
|
83
85
|
findItemListElementById(params: {
|
|
84
86
|
id: string;
|
|
85
87
|
project: {
|
|
@@ -33,7 +33,7 @@ class MongoRepository {
|
|
|
33
33
|
}
|
|
34
34
|
// tslint:disable-next-line:max-func-body-length
|
|
35
35
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
36
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
36
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
37
37
|
// MongoDB検索条件
|
|
38
38
|
const andConditions = [];
|
|
39
39
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -70,7 +70,11 @@ class MongoRepository {
|
|
|
70
70
|
]
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const itemListElementTypeOfEq = (_h = (_g = params.itemListElement) === null || _g === void 0 ? void 0 : _g.typeOf) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
74
|
+
if (typeof itemListElementTypeOfEq === 'string') {
|
|
75
|
+
andConditions.push({ 'itemListElement.typeOf': { $exists: true, $eq: itemListElementTypeOfEq } });
|
|
76
|
+
}
|
|
77
|
+
const itemListElementIdIn = (_k = (_j = params.itemListElement) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$in;
|
|
74
78
|
if (Array.isArray(itemListElementIdIn)) {
|
|
75
79
|
andConditions.push({
|
|
76
80
|
'itemListElement.id': {
|
|
@@ -79,7 +83,7 @@ class MongoRepository {
|
|
|
79
83
|
}
|
|
80
84
|
});
|
|
81
85
|
}
|
|
82
|
-
const itemListElementIdNin = (
|
|
86
|
+
const itemListElementIdNin = (_m = (_l = params.itemListElement) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$nin;
|
|
83
87
|
if (Array.isArray(itemListElementIdNin)) {
|
|
84
88
|
andConditions.push({
|
|
85
89
|
'itemListElement.id': {
|
|
@@ -87,7 +91,7 @@ class MongoRepository {
|
|
|
87
91
|
}
|
|
88
92
|
});
|
|
89
93
|
}
|
|
90
|
-
const itemListElementIdAll = (
|
|
94
|
+
const itemListElementIdAll = (_p = (_o = params.itemListElement) === null || _o === void 0 ? void 0 : _o.id) === null || _p === void 0 ? void 0 : _p.$all;
|
|
91
95
|
if (Array.isArray(itemListElementIdAll)) {
|
|
92
96
|
andConditions.push({
|
|
93
97
|
'itemListElement.id': {
|
|
@@ -96,7 +100,7 @@ class MongoRepository {
|
|
|
96
100
|
}
|
|
97
101
|
});
|
|
98
102
|
}
|
|
99
|
-
const itemOfferedTypeOfEq = (
|
|
103
|
+
const itemOfferedTypeOfEq = (_r = (_q = params.itemOffered) === null || _q === void 0 ? void 0 : _q.typeOf) === null || _r === void 0 ? void 0 : _r.$eq;
|
|
100
104
|
if (typeof itemOfferedTypeOfEq === 'string') {
|
|
101
105
|
andConditions.push({
|
|
102
106
|
'itemOffered.typeOf': {
|
|
@@ -105,7 +109,7 @@ class MongoRepository {
|
|
|
105
109
|
}
|
|
106
110
|
});
|
|
107
111
|
}
|
|
108
|
-
const itemOfferedServiceTypeCodeValueEq = (
|
|
112
|
+
const itemOfferedServiceTypeCodeValueEq = (_u = (_t = (_s = params.itemOffered) === null || _s === void 0 ? void 0 : _s.serviceType) === null || _t === void 0 ? void 0 : _t.codeValue) === null || _u === void 0 ? void 0 : _u.$eq;
|
|
109
113
|
if (typeof itemOfferedServiceTypeCodeValueEq === 'string') {
|
|
110
114
|
andConditions.push({
|
|
111
115
|
'itemOffered.serviceType.codeValue': {
|
|
@@ -114,7 +118,7 @@ class MongoRepository {
|
|
|
114
118
|
}
|
|
115
119
|
});
|
|
116
120
|
}
|
|
117
|
-
const additionalPropertyElemMatch = (
|
|
121
|
+
const additionalPropertyElemMatch = (_v = params.additionalProperty) === null || _v === void 0 ? void 0 : _v.$elemMatch;
|
|
118
122
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
119
123
|
andConditions.push({
|
|
120
124
|
additionalProperty: {
|
|
@@ -174,6 +178,12 @@ class MongoRepository {
|
|
|
174
178
|
.exec();
|
|
175
179
|
// tslint:disable-next-line:no-console
|
|
176
180
|
console.log(result);
|
|
181
|
+
result = yield this.offerCatalogModel.updateMany({ 'itemOffered.serviceType': { $exists: true } }, {
|
|
182
|
+
$unset: { 'itemOffered.serviceType': 1 }
|
|
183
|
+
})
|
|
184
|
+
.exec();
|
|
185
|
+
// tslint:disable-next-line:no-console
|
|
186
|
+
console.log(result);
|
|
177
187
|
});
|
|
178
188
|
}
|
|
179
189
|
updateManyById(params) {
|
|
@@ -238,7 +248,6 @@ class MongoRepository {
|
|
|
238
248
|
const matchStages = conditions.map((condition) => {
|
|
239
249
|
return { $match: condition };
|
|
240
250
|
});
|
|
241
|
-
// numberOfItems集計(2023-02-28~)
|
|
242
251
|
const aggregate = this.offerCatalogModel.aggregate([
|
|
243
252
|
...(((_a = params.sort) === null || _a === void 0 ? void 0 : _a.identifier) !== undefined) ? [{ $sort: { identifier: params.sort.identifier } }] : [],
|
|
244
253
|
...matchStages,
|
|
@@ -251,7 +260,6 @@ class MongoRepository {
|
|
|
251
260
|
typeOf: '$typeOf',
|
|
252
261
|
id: '$_id',
|
|
253
262
|
identifier: '$identifier',
|
|
254
|
-
// itemListElement: '$itemListElement',
|
|
255
263
|
itemOffered: '$itemOffered',
|
|
256
264
|
additionalProperty: '$additionalProperty',
|
|
257
265
|
numberOfItems: {
|
|
@@ -260,7 +268,9 @@ class MongoRepository {
|
|
|
260
268
|
then: { $size: '$itemListElement' },
|
|
261
269
|
else: 0
|
|
262
270
|
}
|
|
263
|
-
}
|
|
271
|
+
},
|
|
272
|
+
// itemListElement.typeOfを追加(2023-09-14~)
|
|
273
|
+
itemListElementTypeOf: { $first: '$itemListElement.typeOf' }
|
|
264
274
|
}
|
|
265
275
|
}
|
|
266
276
|
]);
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.syncOfferCatalog = void 0;
|
|
13
|
+
const factory = require("../../../factory");
|
|
13
14
|
/**
|
|
14
15
|
* カタログのitemListElementを集計オファーへ同期する
|
|
15
16
|
*/
|
|
@@ -18,41 +19,58 @@ function syncOfferCatalog(params) {
|
|
|
18
19
|
// if (params.ids.length !== 1) {
|
|
19
20
|
// throw new factory.errors.Argument('id', 'id.length must be 1');
|
|
20
21
|
// }
|
|
22
|
+
var _a, _b;
|
|
21
23
|
if (params.isDeleted) {
|
|
22
24
|
for (const offerCatalogId of params.ids) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const offerCatalogs = yield repos.offerCatalog.search({ id: { $in: [offerCatalogId] } });
|
|
26
|
+
const itemListElementTypeOf = (_a = offerCatalogs.shift()) === null || _a === void 0 ? void 0 : _a.itemListElementTypeOf;
|
|
27
|
+
switch (itemListElementTypeOf) {
|
|
28
|
+
case factory.offerType.Offer:
|
|
29
|
+
// カタログを含む全集計オファーからカタログを除外
|
|
30
|
+
yield repos.aggregateOffer.pullIncludedInDataCatalog({
|
|
31
|
+
project: { id: params.project.id },
|
|
32
|
+
$pull: {
|
|
33
|
+
includedInDataCatalog: { $elemMatch: { id: { $eq: offerCatalogId } } }
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
// no op
|
|
39
|
+
}
|
|
30
40
|
}
|
|
31
41
|
}
|
|
32
42
|
else {
|
|
33
43
|
for (const offerCatalogId of params.ids) {
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
const offerCatalogs = yield repos.offerCatalog.search({ id: { $in: [offerCatalogId] } });
|
|
45
|
+
const itemListElementTypeOf = (_b = offerCatalogs.shift()) === null || _b === void 0 ? void 0 : _b.itemListElementTypeOf;
|
|
46
|
+
switch (itemListElementTypeOf) {
|
|
47
|
+
case factory.offerType.Offer:
|
|
48
|
+
// 集計オファーIDリストを検索
|
|
49
|
+
const { itemListElement } = yield repos.offerCatalog.findItemListElementById({
|
|
50
|
+
id: offerCatalogId,
|
|
51
|
+
project: { id: params.project.id }
|
|
52
|
+
});
|
|
53
|
+
const aggregateOfferIds = itemListElement.map((element) => element.id);
|
|
54
|
+
// カタログを含み、かつ、新しいカタログに含まれない集計オファーからカタログを除外
|
|
55
|
+
yield repos.aggregateOffer.pullIncludedInDataCatalog(Object.assign({ project: { id: params.project.id }, $pull: {
|
|
56
|
+
includedInDataCatalog: { $elemMatch: { id: { $eq: offerCatalogId } } }
|
|
57
|
+
} }, (aggregateOfferIds.length > 0) ? { id: { $nin: aggregateOfferIds } } : undefined));
|
|
58
|
+
if (aggregateOfferIds.length > 0) {
|
|
59
|
+
// 新しいカタログに含まれる全集計オファーにカタログを追加
|
|
60
|
+
yield repos.aggregateOffer.pushIncludedInDataCatalog({
|
|
61
|
+
project: { id: params.project.id },
|
|
62
|
+
id: { $in: aggregateOfferIds },
|
|
63
|
+
$push: {
|
|
64
|
+
includedInDataCatalog: { $each: [{ id: offerCatalogId }] }
|
|
65
|
+
}
|
|
66
|
+
});
|
|
51
67
|
}
|
|
52
|
-
|
|
68
|
+
// 同期済記録を補完
|
|
69
|
+
yield repos.offerCatalog.updateDateSynced({ id: offerCatalogId, dateSynced: new Date() });
|
|
70
|
+
break;
|
|
71
|
+
default:
|
|
72
|
+
// no op
|
|
53
73
|
}
|
|
54
|
-
// 同期済記録を補完
|
|
55
|
-
yield repos.offerCatalog.updateDateSynced({ id: offerCatalogId, dateSynced: new Date() });
|
|
56
74
|
}
|
|
57
75
|
}
|
|
58
76
|
});
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.329.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.329.0-alpha.15",
|
|
13
13
|
"@cinerino/sdk": "3.167.0-alpha.6",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.8.0-alpha.
|
|
120
|
+
"version": "21.8.0-alpha.67"
|
|
121
121
|
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
-
/// <reference types="mongoose/types/callback" />
|
|
3
|
-
/// <reference types="mongoose/types/collection" />
|
|
4
|
-
/// <reference types="mongoose/types/connection" />
|
|
5
|
-
/// <reference types="mongoose/types/cursor" />
|
|
6
|
-
/// <reference types="mongoose/types/document" />
|
|
7
|
-
/// <reference types="mongoose/types/error" />
|
|
8
|
-
/// <reference types="mongoose/types/expressions" />
|
|
9
|
-
/// <reference types="mongoose/types/helpers" />
|
|
10
|
-
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
-
/// <reference types="mongoose/types/indexes" />
|
|
12
|
-
/// <reference types="mongoose/types/models" />
|
|
13
|
-
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
-
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
-
/// <reference types="mongoose/types/populate" />
|
|
16
|
-
/// <reference types="mongoose/types/query" />
|
|
17
|
-
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
-
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
-
/// <reference types="mongoose/types/session" />
|
|
20
|
-
/// <reference types="mongoose/types/types" />
|
|
21
|
-
/// <reference types="mongoose/types/utility" />
|
|
22
|
-
/// <reference types="mongoose/types/validation" />
|
|
23
|
-
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
-
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import { Schema } from 'mongoose';
|
|
26
|
-
declare const modelName = "Offer";
|
|
27
|
-
/**
|
|
28
|
-
* 単価オファースキーマ
|
|
29
|
-
*/
|
|
30
|
-
declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
31
|
-
collection: string;
|
|
32
|
-
id: true;
|
|
33
|
-
read: string;
|
|
34
|
-
writeConcern: import("mongodb").WriteConcern;
|
|
35
|
-
strict: true;
|
|
36
|
-
strictQuery: false;
|
|
37
|
-
timestamps: {
|
|
38
|
-
createdAt: string;
|
|
39
|
-
updatedAt: string;
|
|
40
|
-
};
|
|
41
|
-
toJSON: {
|
|
42
|
-
getters: false;
|
|
43
|
-
virtuals: false;
|
|
44
|
-
minimize: false;
|
|
45
|
-
versionKey: false;
|
|
46
|
-
};
|
|
47
|
-
toObject: {
|
|
48
|
-
getters: false;
|
|
49
|
-
virtuals: true;
|
|
50
|
-
minimize: false;
|
|
51
|
-
versionKey: false;
|
|
52
|
-
};
|
|
53
|
-
}, {
|
|
54
|
-
additionalProperty: any[];
|
|
55
|
-
availability: string;
|
|
56
|
-
availableAtOrFrom: any[];
|
|
57
|
-
addOn: any[];
|
|
58
|
-
_id?: string | undefined;
|
|
59
|
-
name?: any;
|
|
60
|
-
typeOf?: string | undefined;
|
|
61
|
-
project?: any;
|
|
62
|
-
priceCurrency?: string | undefined;
|
|
63
|
-
alternateName?: any;
|
|
64
|
-
description?: any;
|
|
65
|
-
identifier?: string | undefined;
|
|
66
|
-
itemOffered?: any;
|
|
67
|
-
priceSpecification?: any;
|
|
68
|
-
color?: any;
|
|
69
|
-
category?: any;
|
|
70
|
-
eligibleSeatingType?: any;
|
|
71
|
-
eligibleMembershipType?: any;
|
|
72
|
-
eligibleMonetaryAmount?: any;
|
|
73
|
-
eligibleSubReservation?: any;
|
|
74
|
-
validFrom?: Date | undefined;
|
|
75
|
-
validThrough?: Date | undefined;
|
|
76
|
-
validRateLimit?: any;
|
|
77
|
-
advanceBookingRequirement?: any;
|
|
78
|
-
hasMerchantReturnPolicy?: any;
|
|
79
|
-
settings?: any;
|
|
80
|
-
eligibleDuration?: any;
|
|
81
|
-
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
82
|
-
additionalProperty: any[];
|
|
83
|
-
availability: string;
|
|
84
|
-
availableAtOrFrom: any[];
|
|
85
|
-
addOn: any[];
|
|
86
|
-
_id?: string | undefined;
|
|
87
|
-
name?: any;
|
|
88
|
-
typeOf?: string | undefined;
|
|
89
|
-
project?: any;
|
|
90
|
-
priceCurrency?: string | undefined;
|
|
91
|
-
alternateName?: any;
|
|
92
|
-
description?: any;
|
|
93
|
-
identifier?: string | undefined;
|
|
94
|
-
itemOffered?: any;
|
|
95
|
-
priceSpecification?: any;
|
|
96
|
-
color?: any;
|
|
97
|
-
category?: any;
|
|
98
|
-
eligibleSeatingType?: any;
|
|
99
|
-
eligibleMembershipType?: any;
|
|
100
|
-
eligibleMonetaryAmount?: any;
|
|
101
|
-
eligibleSubReservation?: any;
|
|
102
|
-
validFrom?: Date | undefined;
|
|
103
|
-
validThrough?: Date | undefined;
|
|
104
|
-
validRateLimit?: any;
|
|
105
|
-
advanceBookingRequirement?: any;
|
|
106
|
-
hasMerchantReturnPolicy?: any;
|
|
107
|
-
settings?: any;
|
|
108
|
-
eligibleDuration?: any;
|
|
109
|
-
}>> & Omit<import("mongoose").FlatRecord<{
|
|
110
|
-
additionalProperty: any[];
|
|
111
|
-
availability: string;
|
|
112
|
-
availableAtOrFrom: any[];
|
|
113
|
-
addOn: any[];
|
|
114
|
-
_id?: string | undefined;
|
|
115
|
-
name?: any;
|
|
116
|
-
typeOf?: string | undefined;
|
|
117
|
-
project?: any;
|
|
118
|
-
priceCurrency?: string | undefined;
|
|
119
|
-
alternateName?: any;
|
|
120
|
-
description?: any;
|
|
121
|
-
identifier?: string | undefined;
|
|
122
|
-
itemOffered?: any;
|
|
123
|
-
priceSpecification?: any;
|
|
124
|
-
color?: any;
|
|
125
|
-
category?: any;
|
|
126
|
-
eligibleSeatingType?: any;
|
|
127
|
-
eligibleMembershipType?: any;
|
|
128
|
-
eligibleMonetaryAmount?: any;
|
|
129
|
-
eligibleSubReservation?: any;
|
|
130
|
-
validFrom?: Date | undefined;
|
|
131
|
-
validThrough?: Date | undefined;
|
|
132
|
-
validRateLimit?: any;
|
|
133
|
-
advanceBookingRequirement?: any;
|
|
134
|
-
hasMerchantReturnPolicy?: any;
|
|
135
|
-
settings?: any;
|
|
136
|
-
eligibleDuration?: any;
|
|
137
|
-
}> & Required<{
|
|
138
|
-
_id: string;
|
|
139
|
-
}>, never>>;
|
|
140
|
-
export { modelName, schema };
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.schema = exports.modelName = void 0;
|
|
4
|
-
const mongoose_1 = require("mongoose");
|
|
5
|
-
const writeConcern_1 = require("../writeConcern");
|
|
6
|
-
const modelName = 'Offer';
|
|
7
|
-
exports.modelName = modelName;
|
|
8
|
-
/**
|
|
9
|
-
* 単価オファースキーマ
|
|
10
|
-
*/
|
|
11
|
-
const schema = new mongoose_1.Schema({
|
|
12
|
-
project: mongoose_1.SchemaTypes.Mixed,
|
|
13
|
-
_id: String,
|
|
14
|
-
identifier: String,
|
|
15
|
-
typeOf: String,
|
|
16
|
-
name: mongoose_1.SchemaTypes.Mixed,
|
|
17
|
-
description: mongoose_1.SchemaTypes.Mixed,
|
|
18
|
-
category: mongoose_1.SchemaTypes.Mixed,
|
|
19
|
-
color: mongoose_1.SchemaTypes.Mixed,
|
|
20
|
-
additionalProperty: [mongoose_1.SchemaTypes.Mixed],
|
|
21
|
-
advanceBookingRequirement: mongoose_1.SchemaTypes.Mixed,
|
|
22
|
-
alternateName: mongoose_1.SchemaTypes.Mixed,
|
|
23
|
-
// acceptedPaymentMethod: SchemaTypes.Mixed, // 削除(2023-02-27~)
|
|
24
|
-
addOn: [mongoose_1.SchemaTypes.Mixed],
|
|
25
|
-
availability: {
|
|
26
|
-
type: String,
|
|
27
|
-
required: true
|
|
28
|
-
},
|
|
29
|
-
availableAtOrFrom: [mongoose_1.SchemaTypes.Mixed],
|
|
30
|
-
hasMerchantReturnPolicy: mongoose_1.SchemaTypes.Mixed,
|
|
31
|
-
itemOffered: mongoose_1.SchemaTypes.Mixed,
|
|
32
|
-
// offers: [SchemaTypes.Mixed],
|
|
33
|
-
priceCurrency: String,
|
|
34
|
-
priceSpecification: mongoose_1.SchemaTypes.Mixed,
|
|
35
|
-
// eligibleCustomerType: SchemaTypes.Mixed,
|
|
36
|
-
eligibleDuration: mongoose_1.SchemaTypes.Mixed,
|
|
37
|
-
eligibleMembershipType: mongoose_1.SchemaTypes.Mixed,
|
|
38
|
-
eligibleMonetaryAmount: mongoose_1.SchemaTypes.Mixed,
|
|
39
|
-
// eligibleQuantity: SchemaTypes.Mixed,
|
|
40
|
-
// eligibleRegion: SchemaTypes.Mixed,
|
|
41
|
-
eligibleSeatingType: mongoose_1.SchemaTypes.Mixed,
|
|
42
|
-
eligibleSubReservation: mongoose_1.SchemaTypes.Mixed,
|
|
43
|
-
// settings追加(2023-01-26~)
|
|
44
|
-
settings: mongoose_1.SchemaTypes.Mixed,
|
|
45
|
-
validFrom: Date,
|
|
46
|
-
validThrough: Date,
|
|
47
|
-
validRateLimit: mongoose_1.SchemaTypes.Mixed
|
|
48
|
-
}, {
|
|
49
|
-
collection: 'offers',
|
|
50
|
-
id: true,
|
|
51
|
-
read: 'primaryPreferred',
|
|
52
|
-
writeConcern: writeConcern_1.writeConcern,
|
|
53
|
-
// trueに変更(2022-08-08~)
|
|
54
|
-
strict: true,
|
|
55
|
-
strictQuery: false,
|
|
56
|
-
timestamps: {
|
|
57
|
-
createdAt: 'createdAt',
|
|
58
|
-
updatedAt: 'updatedAt'
|
|
59
|
-
},
|
|
60
|
-
toJSON: {
|
|
61
|
-
getters: false,
|
|
62
|
-
virtuals: false,
|
|
63
|
-
minimize: false,
|
|
64
|
-
versionKey: false
|
|
65
|
-
},
|
|
66
|
-
toObject: {
|
|
67
|
-
getters: false,
|
|
68
|
-
virtuals: true,
|
|
69
|
-
minimize: false,
|
|
70
|
-
versionKey: false
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
exports.schema = schema;
|
|
74
|
-
schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
|
|
75
|
-
schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
|
|
76
|
-
schema.index({ 'priceSpecification.price': 1 }, {
|
|
77
|
-
name: 'searchByPriceSpecificationPrice',
|
|
78
|
-
partialFilterExpression: {
|
|
79
|
-
'priceSpecification.price': { $exists: true }
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
schema.index({ 'project.id': 1, 'priceSpecification.price': 1 }, {
|
|
83
|
-
name: 'searchByProjectId-v20220721'
|
|
84
|
-
});
|
|
85
|
-
schema.index({ identifier: 1, 'priceSpecification.price': 1 }, {
|
|
86
|
-
name: 'searchByIdentifier',
|
|
87
|
-
partialFilterExpression: {
|
|
88
|
-
identifier: { $exists: true }
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
schema.index({ 'priceSpecification.referenceQuantity.value': 1, 'priceSpecification.price': 1 }, {
|
|
92
|
-
name: 'searchByPriceSpecificationReferenceQuantityValue',
|
|
93
|
-
partialFilterExpression: {
|
|
94
|
-
'priceSpecification.referenceQuantity.value': { $exists: true }
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
schema.index({ 'priceSpecification.accounting.accountsReceivable': 1, 'priceSpecification.price': 1 }, {
|
|
98
|
-
name: 'searchByPriceSpecificationAccountingAccountsReceivable',
|
|
99
|
-
partialFilterExpression: {
|
|
100
|
-
'priceSpecification.accounting.accountsReceivable': { $exists: true }
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
schema.index({ 'priceSpecification.accounting.operatingRevenue.codeValue': 1, 'priceSpecification.price': 1 }, {
|
|
104
|
-
name: 'searchByPriceSpecificationAccountingOperatingRevenueCodeValue',
|
|
105
|
-
partialFilterExpression: {
|
|
106
|
-
'priceSpecification.accounting.operatingRevenue.codeValue': { $exists: true }
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
schema.index({ 'priceSpecification.appliesToMovieTicket.serviceType': 1, 'priceSpecification.price': 1 }, {
|
|
110
|
-
name: 'searchByPriceSpecificationAppliesToMovieTicketServiceType',
|
|
111
|
-
partialFilterExpression: {
|
|
112
|
-
'priceSpecification.appliesToMovieTicket.serviceType': { $exists: true }
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
schema.index({ 'priceSpecification.appliesToMovieTicket.serviceOutput.typeOf': 1, 'priceSpecification.price': 1 }, {
|
|
116
|
-
name: 'searchByPriceSpecificationAppliesToMovieTicketServiceOutputTypeOf',
|
|
117
|
-
partialFilterExpression: {
|
|
118
|
-
'priceSpecification.appliesToMovieTicket.serviceOutput.typeOf': { $exists: true }
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
schema.index({ 'name.ja': 1, 'priceSpecification.price': 1 }, {
|
|
122
|
-
name: 'searchByNameJa',
|
|
123
|
-
partialFilterExpression: {
|
|
124
|
-
'name.ja': { $exists: true }
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
schema.index({ 'name.en': 1, 'priceSpecification.price': 1 }, {
|
|
128
|
-
name: 'searchByNameEn',
|
|
129
|
-
partialFilterExpression: {
|
|
130
|
-
'name.en': { $exists: true }
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
schema.index({ alternateName: 1, 'priceSpecification.price': 1 }, {
|
|
134
|
-
name: 'searchByAlternateName',
|
|
135
|
-
partialFilterExpression: {
|
|
136
|
-
alternateName: { $exists: true }
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
schema.index({ 'category.id': 1, 'priceSpecification.price': 1 }, {
|
|
140
|
-
name: 'searchCategoryId',
|
|
141
|
-
partialFilterExpression: {
|
|
142
|
-
'category.id': { $exists: true }
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
schema.index({ 'category.codeValue': 1, 'priceSpecification.price': 1 }, {
|
|
146
|
-
name: 'searchByCategoryCodeValue',
|
|
147
|
-
partialFilterExpression: {
|
|
148
|
-
'category.codeValue': { $exists: true }
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
schema.index({ 'itemOffered.typeOf': 1, 'priceSpecification.price': 1 }, {
|
|
152
|
-
name: 'searchByItemOfferedTypeOf',
|
|
153
|
-
partialFilterExpression: {
|
|
154
|
-
'itemOffered.typeOf': { $exists: true }
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
schema.index({ 'availableAtOrFrom.id': 1, 'priceSpecification.price': 1 }, {
|
|
158
|
-
name: 'searchByAvailableAtOrFromId',
|
|
159
|
-
partialFilterExpression: {
|
|
160
|
-
'availableAtOrFrom.id': { $exists: true }
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
schema.index({ 'eligibleMembershipType.codeValue': 1, 'priceSpecification.price': 1 }, {
|
|
164
|
-
name: 'searchByEligibleMembershipTypeCodeValue',
|
|
165
|
-
partialFilterExpression: {
|
|
166
|
-
'eligibleMembershipType.codeValue': { $exists: true }
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
schema.index({ 'eligibleMonetaryAmount.currency': 1, 'priceSpecification.price': 1 }, {
|
|
170
|
-
name: 'searchByEligibleMonetaryAmountCurrency',
|
|
171
|
-
partialFilterExpression: {
|
|
172
|
-
'eligibleMonetaryAmount.currency': { $exists: true }
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
schema.index({ 'eligibleSeatingType.codeValue': 1, 'priceSpecification.price': 1 }, {
|
|
176
|
-
name: 'searchByEligibleSeatingTypeCodeValue',
|
|
177
|
-
partialFilterExpression: {
|
|
178
|
-
'eligibleSeatingType.codeValue': { $exists: true }
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
schema.index({ 'addOn.itemOffered.id': 1, 'priceSpecification.price': 1 }, {
|
|
182
|
-
name: 'searchByAddOnItemOfferedId',
|
|
183
|
-
partialFilterExpression: {
|
|
184
|
-
'addOn.itemOffered.id': { $exists: true }
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
schema.index({ 'hasMerchantReturnPolicy.id': 1, 'priceSpecification.price': 1 }, {
|
|
188
|
-
name: 'searchByHasMerchantReturnPolicyId',
|
|
189
|
-
partialFilterExpression: {
|
|
190
|
-
'hasMerchantReturnPolicy.id': { $exists: true }
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
schema.index({ additionalProperty: 1, 'priceSpecification.price': 1 }, {
|
|
194
|
-
name: 'searchByAdditionalProperty',
|
|
195
|
-
partialFilterExpression: {
|
|
196
|
-
additionalProperty: { $exists: true }
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
schema.index({ validFrom: 1, 'priceSpecification.price': 1 }, {
|
|
200
|
-
name: 'searchByValidFrom',
|
|
201
|
-
partialFilterExpression: {
|
|
202
|
-
validFrom: { $exists: true }
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
schema.index({ validThrough: 1, 'priceSpecification.price': 1 }, {
|
|
206
|
-
name: 'searchByValidThrough',
|
|
207
|
-
partialFilterExpression: {
|
|
208
|
-
validThrough: { $exists: true }
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
schema.index({ availability: 1, 'priceSpecification.price': 1 }, { name: 'searchByAvailability' });
|