@chevre/domain 28.0.0-alpha.31 → 28.0.0-alpha.33
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/accountTitle.d.ts +3 -4
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountTitle.js +6 -9
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +0 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +3 -12
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +1 -2
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +6 -15
- package/lib/chevre/repo/offerCatalog.d.ts +0 -2
- package/lib/chevre/repo/offerCatalogItem.d.ts +13 -20
- package/lib/chevre/repo/offerCatalogItem.js +8 -86
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +1 -1
- package/lib/chevre/service/offer/event/searchOfferCatalogItems.js +2 -2
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Connection } from 'mongoose';
|
|
2
|
-
import {
|
|
3
|
-
import { IModel } from './mongoose/schemas/accountTitle';
|
|
2
|
+
import { IDocType, IModel } from './mongoose/schemas/accountTitle';
|
|
4
3
|
/**
|
|
5
4
|
* 科目リポジトリ
|
|
6
5
|
*/
|
|
@@ -12,11 +11,11 @@ export declare class AccountTitleRepo {
|
|
|
12
11
|
id: string;
|
|
13
12
|
};
|
|
14
13
|
}): Promise<void>;
|
|
15
|
-
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>,
|
|
14
|
+
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & IDocType & {
|
|
16
15
|
_id: import("mongoose").Types.ObjectId;
|
|
17
16
|
} & {
|
|
18
17
|
__v: number;
|
|
19
|
-
}, import("mongoose").QueryOptions<
|
|
18
|
+
}, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & IDocType & {
|
|
20
19
|
_id: import("mongoose").Types.ObjectId;
|
|
21
20
|
} & {
|
|
22
21
|
__v: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../virtuals';
|
|
3
3
|
import { factory } from '../../../factory';
|
|
4
|
-
type IDocType = factory.accountTitle.IAccountTitle
|
|
4
|
+
type IDocType = Pick<factory.accountTitle.IAccountTitle, 'additionalProperty' | 'codeValue' | 'hasCategoryCode' | 'name' | 'project' | 'typeOf'>;
|
|
5
5
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
6
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
7
|
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
@@ -8,18 +8,15 @@ const settings_1 = require("../../../settings");
|
|
|
8
8
|
const modelName = 'AccountTitle';
|
|
9
9
|
exports.modelName = modelName;
|
|
10
10
|
const schemaDefinition = {
|
|
11
|
-
project: mongoose_1.SchemaTypes.Mixed,
|
|
12
|
-
typeOf: {
|
|
13
|
-
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
codeValue: String,
|
|
11
|
+
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
12
|
+
typeOf: { type: String, required: true },
|
|
13
|
+
codeValue: { type: String, required: true },
|
|
17
14
|
name: String,
|
|
18
|
-
inCodeSet: mongoose_1.SchemaTypes.Mixed,
|
|
19
15
|
hasCategoryCode: mongoose_1.SchemaTypes.Mixed,
|
|
20
|
-
inDefinedTermSet: mongoose_1.SchemaTypes.Mixed,
|
|
21
|
-
hasDefinedTerm: mongoose_1.SchemaTypes.Mixed,
|
|
22
16
|
additionalProperty: mongoose_1.SchemaTypes.Mixed
|
|
17
|
+
// inCodeSet: SchemaTypes.Mixed, // discontinue(2026-10-16~)
|
|
18
|
+
// inDefinedTermSet: SchemaTypes.Mixed, // discontinue(2026-10-16~)
|
|
19
|
+
// hasDefinedTerm: SchemaTypes.Mixed, // discontinue(2026-10-16~)
|
|
23
20
|
};
|
|
24
21
|
const schemaOptions = {
|
|
25
22
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -3,7 +3,6 @@ import { IVirtuals } from '../virtuals';
|
|
|
3
3
|
import { factory } from '../../../factory';
|
|
4
4
|
export type IDocType = Omit<factory.offerCatalog.IOfferCatalog, 'id'> & {
|
|
5
5
|
_id: string;
|
|
6
|
-
alternateName?: any;
|
|
7
6
|
dateSynced?: Date;
|
|
8
7
|
};
|
|
9
8
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
@@ -10,24 +10,15 @@ exports.modelName = modelName;
|
|
|
10
10
|
const schemaDefinition = {
|
|
11
11
|
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
12
12
|
_id: String,
|
|
13
|
-
identifier: {
|
|
14
|
-
type: String,
|
|
15
|
-
required: true
|
|
16
|
-
},
|
|
13
|
+
identifier: { type: String, required: true },
|
|
17
14
|
name: mongoose_1.SchemaTypes.Mixed,
|
|
18
15
|
description: mongoose_1.SchemaTypes.Mixed,
|
|
19
|
-
alternateName:
|
|
20
|
-
typeOf: {
|
|
21
|
-
type: String,
|
|
22
|
-
required: true
|
|
23
|
-
},
|
|
16
|
+
// alternateName: SchemaTypes.Mixed,
|
|
17
|
+
typeOf: { type: String, required: true },
|
|
24
18
|
itemListElement: [mongoose_1.SchemaTypes.Mixed],
|
|
25
19
|
itemOffered: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
26
20
|
additionalProperty: [mongoose_1.SchemaTypes.Mixed],
|
|
27
21
|
dateSynced: Date // 追加(2023-09-13~)
|
|
28
|
-
// createdAt: SchemaTypes.Mixed,
|
|
29
|
-
// updatedAt: SchemaTypes.Mixed,
|
|
30
|
-
// __v: SchemaTypes.Mixed
|
|
31
22
|
};
|
|
32
23
|
const schemaOptions = {
|
|
33
24
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../virtuals';
|
|
3
3
|
import { factory } from '../../../factory';
|
|
4
|
-
export type IDocType =
|
|
4
|
+
export type IDocType = Pick<factory.offerCatalog.IOfferCatalog, 'description' | 'identifier' | 'itemListElement' | 'itemOffered' | 'name' | 'project' | 'relatedOffer' | 'typeOf'> & {
|
|
5
5
|
_id: string;
|
|
6
|
-
alternateName?: any;
|
|
7
6
|
dateSynced?: Date;
|
|
8
7
|
};
|
|
9
8
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
@@ -9,25 +9,16 @@ const modelName = 'OfferCatalogItem';
|
|
|
9
9
|
exports.modelName = modelName;
|
|
10
10
|
const schemaDefinition = {
|
|
11
11
|
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
12
|
-
identifier: {
|
|
13
|
-
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
name: mongoose_1.SchemaTypes.Mixed,
|
|
17
|
-
description: mongoose_1.SchemaTypes.Mixed,
|
|
18
|
-
alternateName: mongoose_1.SchemaTypes.Mixed,
|
|
19
|
-
typeOf: {
|
|
20
|
-
type: String,
|
|
21
|
-
required: true
|
|
22
|
-
},
|
|
12
|
+
identifier: { type: String, required: true },
|
|
13
|
+
typeOf: { type: String, required: true },
|
|
23
14
|
itemListElement: [mongoose_1.SchemaTypes.Mixed],
|
|
24
15
|
itemOffered: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
25
|
-
|
|
16
|
+
name: mongoose_1.SchemaTypes.Mixed,
|
|
17
|
+
description: mongoose_1.SchemaTypes.Mixed,
|
|
18
|
+
// alternateName: SchemaTypes.Mixed,
|
|
19
|
+
// additionalProperty: [SchemaTypes.Mixed], // discontinue(2026-10-15~)
|
|
26
20
|
dateSynced: Date,
|
|
27
21
|
relatedOffer: mongoose_1.SchemaTypes.Mixed
|
|
28
|
-
// createdAt: SchemaTypes.Mixed,
|
|
29
|
-
// updatedAt: SchemaTypes.Mixed,
|
|
30
|
-
// __v: SchemaTypes.Mixed
|
|
31
22
|
};
|
|
32
23
|
const schemaOptions = {
|
|
33
24
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -170,7 +170,6 @@ export declare class OfferCatalogRepo {
|
|
|
170
170
|
}): Promise<void>;
|
|
171
171
|
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.offerCatalog.IOfferCatalog, "id"> & {
|
|
172
172
|
_id: string;
|
|
173
|
-
alternateName?: any;
|
|
174
173
|
dateSynced?: Date;
|
|
175
174
|
} & Required<{
|
|
176
175
|
_id: string;
|
|
@@ -178,7 +177,6 @@ export declare class OfferCatalogRepo {
|
|
|
178
177
|
__v: number;
|
|
179
178
|
}, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.offerCatalog.IOfferCatalog, "id"> & {
|
|
180
179
|
_id: string;
|
|
181
|
-
alternateName?: any;
|
|
182
180
|
dateSynced?: Date;
|
|
183
181
|
} & Required<{
|
|
184
182
|
_id: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Connection, FilterQuery, mongo } from 'mongoose';
|
|
2
2
|
import { factory } from '../factory';
|
|
3
|
-
|
|
3
|
+
import { IDocType } from './mongoose/schemas/offerCatalogItem';
|
|
4
|
+
type IOfferCatalogItem = Pick<factory.offerCatalog.IOfferCatalog, 'description' | 'identifier' | 'itemListElement' | 'itemOffered' | 'name' | 'project' | 'relatedOffer' | 'typeOf' | 'id'>;
|
|
5
|
+
export type IAggregatedOfferCatalog = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered' | 'relatedOffer'> & {
|
|
4
6
|
numberOfItems?: number;
|
|
5
7
|
itemListElementTypeOf: factory.offerType.Offer;
|
|
6
8
|
};
|
|
@@ -11,25 +13,25 @@ type IKeyOfProjection = 'name' | 'description' | 'project' | 'typeOf' | 'id' | '
|
|
|
11
13
|
export declare class OfferCatalogItemRepo {
|
|
12
14
|
private readonly offerCatalogItemModel;
|
|
13
15
|
constructor(connection: Connection);
|
|
14
|
-
static CREATE_MONGO_CONDITIONS(params: factory.offerCatalog.ISearchConditions):
|
|
15
|
-
save(params:
|
|
16
|
-
$unset?:
|
|
16
|
+
static CREATE_MONGO_CONDITIONS(params: factory.offerCatalog.ISearchConditions): FilterQuery<IDocType>[];
|
|
17
|
+
save(params: IOfferCatalogItem & {
|
|
18
|
+
$unset?: Partial<Record<keyof IDocType, 1>>;
|
|
17
19
|
}): Promise<{
|
|
18
20
|
id: string;
|
|
19
21
|
}>;
|
|
20
22
|
/**
|
|
21
23
|
* プロジェクトとコードから冪等保管
|
|
22
24
|
*/
|
|
23
|
-
saveByIdentifier(params:
|
|
25
|
+
saveByIdentifier(params: IOfferCatalogItem): Promise<{
|
|
24
26
|
id: string;
|
|
25
27
|
}>;
|
|
26
28
|
/**
|
|
27
29
|
* コードをキーにして冪等置換(2023-12-14~)
|
|
28
30
|
*/
|
|
29
31
|
upsertManyByIdentifier(params: {
|
|
30
|
-
$set:
|
|
32
|
+
$set: IOfferCatalogItem;
|
|
31
33
|
$unset?: {
|
|
32
|
-
[key in keyof
|
|
34
|
+
[key in keyof IDocType]?: 1;
|
|
33
35
|
};
|
|
34
36
|
}[], options: {
|
|
35
37
|
/**
|
|
@@ -73,8 +75,8 @@ export declare class OfferCatalogItemRepo {
|
|
|
73
75
|
};
|
|
74
76
|
};
|
|
75
77
|
}): Promise<void>;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
countOfferCatalogItems(params: Omit<factory.offerCatalog.ISearchConditions, 'limit' | 'page' | 'sort'>): Promise<number>;
|
|
79
|
+
findOfferCatalogItems(params: factory.offerCatalog.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IAggregatedOfferCatalog[]>;
|
|
78
80
|
findItemListElementById(params: {
|
|
79
81
|
id: string;
|
|
80
82
|
project: {
|
|
@@ -118,17 +120,8 @@ export declare class OfferCatalogItemRepo {
|
|
|
118
120
|
};
|
|
119
121
|
}): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
|
|
120
122
|
unsetUnnecessaryFields(params: {
|
|
121
|
-
filter: FilterQuery<
|
|
122
|
-
$unset:
|
|
123
|
+
filter: FilterQuery<IDocType>;
|
|
124
|
+
$unset: Partial<Record<keyof IDocType, 1>>;
|
|
123
125
|
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
124
|
-
aggregateItemList(params: {
|
|
125
|
-
itemListElement: {
|
|
126
|
-
typeOf: {
|
|
127
|
-
$eq: factory.offerType.Offer | 'OfferCatalog';
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
}): Promise<{
|
|
131
|
-
aggregation: any;
|
|
132
|
-
}>;
|
|
133
126
|
}
|
|
134
127
|
export {};
|
|
@@ -28,7 +28,7 @@ class OfferCatalogItemRepo {
|
|
|
28
28
|
}
|
|
29
29
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
30
30
|
// MongoDB検索条件
|
|
31
|
-
const andConditions = [];
|
|
31
|
+
const andConditions = [];
|
|
32
32
|
const projectIdEq = params.project?.id?.$eq;
|
|
33
33
|
if (typeof projectIdEq === 'string') {
|
|
34
34
|
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
@@ -247,7 +247,7 @@ class OfferCatalogItemRepo {
|
|
|
247
247
|
})
|
|
248
248
|
.exec();
|
|
249
249
|
}
|
|
250
|
-
async
|
|
250
|
+
async countOfferCatalogItems(params) {
|
|
251
251
|
const conditions = OfferCatalogItemRepo.CREATE_MONGO_CONDITIONS(params);
|
|
252
252
|
const matchStages = conditions.map((condition) => {
|
|
253
253
|
return { $match: condition };
|
|
@@ -261,18 +261,15 @@ class OfferCatalogItemRepo {
|
|
|
261
261
|
.exec();
|
|
262
262
|
return (result.length > 0) ? result[0].numItems : 0;
|
|
263
263
|
}
|
|
264
|
-
async
|
|
264
|
+
async findOfferCatalogItems(params, inclusion) {
|
|
265
265
|
const conditions = OfferCatalogItemRepo.CREATE_MONGO_CONDITIONS(params);
|
|
266
266
|
const matchStages = conditions.map((condition) => {
|
|
267
267
|
return { $match: condition };
|
|
268
268
|
});
|
|
269
269
|
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
270
|
-
if (Array.isArray(inclusion)
|
|
270
|
+
if (Array.isArray(inclusion)) {
|
|
271
271
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
272
272
|
}
|
|
273
|
-
else {
|
|
274
|
-
// throw new factory.errors.ArgumentNull('inclusion', 'inclusion must be specified');
|
|
275
|
-
}
|
|
276
273
|
const projection = {
|
|
277
274
|
_id: 0,
|
|
278
275
|
id: { $toString: '$_id' },
|
|
@@ -297,49 +294,6 @@ class OfferCatalogItemRepo {
|
|
|
297
294
|
return [key, value];
|
|
298
295
|
}))
|
|
299
296
|
};
|
|
300
|
-
// let projectStage: { [field: string]: AnyExpression } = {
|
|
301
|
-
// _id: 0,
|
|
302
|
-
// name: '$name',
|
|
303
|
-
// description: '$description',
|
|
304
|
-
// project: '$project',
|
|
305
|
-
// typeOf: '$typeOf',
|
|
306
|
-
// id: { $toString: '$_id' },
|
|
307
|
-
// identifier: '$identifier',
|
|
308
|
-
// itemOffered: '$itemOffered',
|
|
309
|
-
// additionalProperty: '$additionalProperty',
|
|
310
|
-
// relatedOffer: '$relatedOffer',
|
|
311
|
-
// numberOfItems: {
|
|
312
|
-
// $cond: {
|
|
313
|
-
// if: { $isArray: '$itemListElement' },
|
|
314
|
-
// then: { $size: '$itemListElement' },
|
|
315
|
-
// else: 0
|
|
316
|
-
// }
|
|
317
|
-
// },
|
|
318
|
-
// itemListElementTypeOf: { $first: '$itemListElement.typeOf' },
|
|
319
|
-
// dateSynced: '$dateSynced'
|
|
320
|
-
// };
|
|
321
|
-
// const positiveProjectionFields: string[] = Object.keys(projection)
|
|
322
|
-
// .filter((key) => projection[<KeyOfOfferCatalogItem>key] !== 0);
|
|
323
|
-
// const negativeProjectionFields: string[] = Object.keys(projection)
|
|
324
|
-
// .filter((key) => projection[<KeyOfOfferCatalogItem>key] === 0);
|
|
325
|
-
// if (positiveProjectionFields.length > 0) {
|
|
326
|
-
// projectStage = {
|
|
327
|
-
// _id: 0,
|
|
328
|
-
// id: { $toString: '$_id' }
|
|
329
|
-
// };
|
|
330
|
-
// positiveProjectionFields.forEach((field) => {
|
|
331
|
-
// if (field !== '_id' && field !== 'id') {
|
|
332
|
-
// projectStage[field] = `$${field}`;
|
|
333
|
-
// }
|
|
334
|
-
// });
|
|
335
|
-
// } else if (negativeProjectionFields.length > 0) {
|
|
336
|
-
// negativeProjectionFields.forEach((field) => {
|
|
337
|
-
// if (projectStage[field] !== undefined && projectStage[field] !== null) {
|
|
338
|
-
// // tslint:disable-next-line:no-dynamic-delete
|
|
339
|
-
// delete projectStage[field];
|
|
340
|
-
// }
|
|
341
|
-
// });
|
|
342
|
-
// }
|
|
343
297
|
const aggregate = this.offerCatalogItemModel.aggregate([
|
|
344
298
|
...(params.sort?.identifier !== undefined) ? [{ $sort: { identifier: params.sort.identifier } }] : [],
|
|
345
299
|
...matchStages,
|
|
@@ -347,8 +301,10 @@ class OfferCatalogItemRepo {
|
|
|
347
301
|
]);
|
|
348
302
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
349
303
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
350
|
-
aggregate.limit(params.limit * page)
|
|
351
|
-
|
|
304
|
+
// aggregate.limit(params.limit * page)
|
|
305
|
+
// .skip(params.limit * (page - 1));
|
|
306
|
+
aggregate.skip(params.limit * (page - 1))
|
|
307
|
+
.limit(params.limit);
|
|
352
308
|
}
|
|
353
309
|
return aggregate.exec();
|
|
354
310
|
}
|
|
@@ -413,39 +369,5 @@ class OfferCatalogItemRepo {
|
|
|
413
369
|
return this.offerCatalogItemModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
414
370
|
.exec();
|
|
415
371
|
}
|
|
416
|
-
async aggregateItemList(params) {
|
|
417
|
-
const matchConditions = {
|
|
418
|
-
'itemListElement.typeOf': { $eq: params.itemListElement.typeOf.$eq }
|
|
419
|
-
};
|
|
420
|
-
const aggregations = await this.offerCatalogItemModel.aggregate([
|
|
421
|
-
{ $match: matchConditions },
|
|
422
|
-
{
|
|
423
|
-
$project: {
|
|
424
|
-
numItemListElement: { $size: '$itemListElement' }
|
|
425
|
-
}
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
$group: {
|
|
429
|
-
_id: '$typeOf',
|
|
430
|
-
maxNumItemListElement: { $max: '$numItemListElement' },
|
|
431
|
-
minNumItemListElement: { $min: '$numItemListElement' }
|
|
432
|
-
}
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
$project: {
|
|
436
|
-
_id: 0,
|
|
437
|
-
maxNumItemListElement: '$maxNumItemListElement',
|
|
438
|
-
minNumItemListElement: '$minNumItemListElement'
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
])
|
|
442
|
-
.exec();
|
|
443
|
-
if (aggregations.length === 0) {
|
|
444
|
-
return {
|
|
445
|
-
aggregation: {}
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
return { aggregation: aggregations[0] };
|
|
449
|
-
}
|
|
450
372
|
}
|
|
451
373
|
exports.OfferCatalogItemRepo = OfferCatalogItemRepo;
|
|
@@ -65,7 +65,7 @@ function searchTicketOffersByItemOffered(params) {
|
|
|
65
65
|
// サブカタログの適用決済カード条件を考慮
|
|
66
66
|
if (isOfferCatalogItem) {
|
|
67
67
|
// サブカタログ参照
|
|
68
|
-
const offerCatalogItem = (await repos.offerCatalogItem.
|
|
68
|
+
const offerCatalogItem = (await repos.offerCatalogItem.findOfferCatalogItems({ id: { $in: [subOfferCatalogId] } }, ['relatedOffer']
|
|
69
69
|
// { relatedOffer: 1 }
|
|
70
70
|
)).shift();
|
|
71
71
|
if (offerCatalogItem === undefined) {
|
|
@@ -63,9 +63,9 @@ function searchOfferCatalogItems(params) {
|
|
|
63
63
|
});
|
|
64
64
|
if (catalogItemListElements.length > 0) {
|
|
65
65
|
// サブカタログ検索
|
|
66
|
-
const searchOfferCatalogItemsResult = await repos.offerCatalogItem.
|
|
66
|
+
const searchOfferCatalogItemsResult = await repos.offerCatalogItem.findOfferCatalogItems({
|
|
67
67
|
id: { $in: catalogItemListElements.map((element) => element.id) }
|
|
68
|
-
}, ['description', 'name', '
|
|
68
|
+
}, ['description', 'name', 'relatedOffer']);
|
|
69
69
|
offerCatalogItems = catalogItemListElements.map((element) => {
|
|
70
70
|
const offerCatalogItem = searchOfferCatalogItemsResult.find((item) => item.id === element.id);
|
|
71
71
|
if (offerCatalogItem === undefined) {
|
|
@@ -13,7 +13,7 @@ function createInformOfferCatalogTasks(params, setting) {
|
|
|
13
13
|
}
|
|
14
14
|
let offerCatalogs;
|
|
15
15
|
if (params.isOfferCatalogItem) {
|
|
16
|
-
offerCatalogs = await repos.offerCatalogItem.
|
|
16
|
+
offerCatalogs = await repos.offerCatalogItem.findOfferCatalogItems({ id: { $in: params.ids } }, ['identifier', 'name', 'numberOfItems', 'project', 'typeOf']);
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
19
|
offerCatalogs = await repos.offerCatalog.projectFields({ id: { $in: params.ids } }, ['identifier', 'name', 'numberOfItems', 'project', 'typeOf']);
|
|
@@ -25,7 +25,7 @@ function syncOfferCatalog(params) {
|
|
|
25
25
|
for (const offerCatalogId of params.ids) {
|
|
26
26
|
let offerCatalogs;
|
|
27
27
|
if (params.isOfferCatalogItem) {
|
|
28
|
-
offerCatalogs = await repos.offerCatalogItem.
|
|
28
|
+
offerCatalogs = await repos.offerCatalogItem.findOfferCatalogItems({ id: { $in: [offerCatalogId] } }, ['id', 'itemListElementTypeOf']);
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
offerCatalogs = await repos.offerCatalog.projectFields({ id: { $in: [offerCatalogId] } }, ['id', 'itemListElementTypeOf']);
|
package/package.json
CHANGED