@chevre/domain 21.15.0-alpha.7 → 21.15.0-alpha.9
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/searchCategoryCodesByAggregate.ts +3 -3
- package/lib/chevre/repo/categoryCode.d.ts +1 -1
- package/lib/chevre/repo/categoryCode.js +12 -2
- package/lib/chevre/repo/place.d.ts +7 -6
- package/lib/chevre/repo/place.js +6 -9
- package/lib/chevre/service/offer.js +5 -5
- package/package.json +3 -3
|
@@ -20,10 +20,10 @@ async function main() {
|
|
|
20
20
|
// paymentAccepted: { paymentMethodType: { $eq: 'Cash' } },
|
|
21
21
|
// hasMerchantReturnPolicy: { applicablePaymentMethod: {} }
|
|
22
22
|
},
|
|
23
|
-
[],
|
|
24
|
-
[
|
|
23
|
+
['_id'],
|
|
24
|
+
[]
|
|
25
25
|
);
|
|
26
|
-
console.log('categoryCodes found', categoryCodes);
|
|
26
|
+
console.log('categoryCodes found', categoryCodes[0]);
|
|
27
27
|
console.log(categoryCodes.length, 'categoryCodes found');
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -32,7 +32,7 @@ export declare class MongoRepository {
|
|
|
32
32
|
private readonly categoryCodeModel;
|
|
33
33
|
constructor(connection: Connection);
|
|
34
34
|
static CREATE_MONGO_CONDITIONS(params: factory.categoryCode.ISearchConditions): FilterQuery<factory.categoryCode.ICategoryCode>[];
|
|
35
|
-
static CREATE_AGGREGATE_PROJECTION(inclusion:
|
|
35
|
+
static CREATE_AGGREGATE_PROJECTION(inclusion: IKeyOfProjection[], exclusion: IKeyOfProjection[]): {
|
|
36
36
|
[field: string]: AnyExpression;
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
@@ -152,7 +152,7 @@ class MongoRepository {
|
|
|
152
152
|
return andConditions;
|
|
153
153
|
}
|
|
154
154
|
static CREATE_AGGREGATE_PROJECTION(inclusion, exclusion) {
|
|
155
|
-
|
|
155
|
+
let projectStage = {
|
|
156
156
|
_id: 0,
|
|
157
157
|
id: { $toString: '$_id' },
|
|
158
158
|
project: '$project',
|
|
@@ -166,7 +166,17 @@ class MongoRepository {
|
|
|
166
166
|
paymentMethod: '$paymentMethod'
|
|
167
167
|
};
|
|
168
168
|
if (inclusion.length > 0) {
|
|
169
|
-
|
|
169
|
+
projectStage = { _id: 0 };
|
|
170
|
+
inclusion.forEach((field) => {
|
|
171
|
+
switch (field) {
|
|
172
|
+
case '_id':
|
|
173
|
+
case 'id':
|
|
174
|
+
projectStage.id = { $toString: '$_id' };
|
|
175
|
+
break;
|
|
176
|
+
default:
|
|
177
|
+
projectStage[field] = `$${field}`;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
170
180
|
}
|
|
171
181
|
else if (exclusion.length > 0) {
|
|
172
182
|
exclusion.forEach((field) => {
|
|
@@ -22,21 +22,22 @@
|
|
|
22
22
|
/// <reference types="mongoose/types/validation" />
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import type { AnyExpression, Connection } from 'mongoose';
|
|
25
|
+
import type { AnyExpression, Connection, FilterQuery } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
27
|
type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
|
|
28
28
|
export type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace' | 'seatCount' | 'parentOrganization'>;
|
|
29
29
|
export type IMovieTheaterIncludingScreeningRooms = factory.place.movieTheater.IPlace & {
|
|
30
30
|
containsPlace: factory.place.screeningRoom.IPlace[];
|
|
31
31
|
};
|
|
32
|
+
type IKeyOfProjectionMovieTheater = keyof factory.place.movieTheater.IPlace | '_id';
|
|
32
33
|
/**
|
|
33
34
|
* 施設リポジトリ
|
|
34
35
|
*/
|
|
35
36
|
export declare class MongoRepository {
|
|
36
37
|
private readonly placeModel;
|
|
37
38
|
constructor(connection: Connection);
|
|
38
|
-
static CREATE_BUS_STOP_MONGO_CONDITIONS(params: factory.place.busStop.ISearchConditions):
|
|
39
|
-
static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params: factory.place.movieTheater.ISearchConditions):
|
|
39
|
+
static CREATE_BUS_STOP_MONGO_CONDITIONS(params: factory.place.busStop.ISearchConditions): FilterQuery<import("@chevre/factory/lib/place/busStop").IPlace>[];
|
|
40
|
+
static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params: factory.place.movieTheater.ISearchConditions): FilterQuery<import("@chevre/factory/lib/place/movieTheater").IPlace>[];
|
|
40
41
|
static CREATE_SEARCH_SEATS_PROJECTION(params: factory.place.seat.IProjection): {
|
|
41
42
|
[field: string]: AnyExpression;
|
|
42
43
|
};
|
|
@@ -48,7 +49,7 @@ export declare class MongoRepository {
|
|
|
48
49
|
/**
|
|
49
50
|
* 施設検索
|
|
50
51
|
*/
|
|
51
|
-
searchMovieTheaters(params: factory.place.movieTheater.ISearchConditions, inclusion:
|
|
52
|
+
searchMovieTheaters(params: factory.place.movieTheater.ISearchConditions, inclusion: IKeyOfProjectionMovieTheater[], exclusion: IKeyOfProjectionMovieTheater[]): Promise<factory.place.movieTheater.IPlace[]>;
|
|
52
53
|
deleteMovieTheaterById(params: {
|
|
53
54
|
project: {
|
|
54
55
|
id: string;
|
|
@@ -284,7 +285,7 @@ export declare class MongoRepository {
|
|
|
284
285
|
typeOf: factory.placeType.ScreeningRoom;
|
|
285
286
|
}>;
|
|
286
287
|
unsetUnnecessaryFieldsFromMovieTheater(params: {
|
|
287
|
-
filter: any
|
|
288
|
+
filter: FilterQuery<any>;
|
|
288
289
|
$unset: any;
|
|
289
290
|
}): Promise<import("mongodb").UpdateResult>;
|
|
290
291
|
deleteManyByParentOrganizationId(params: {
|
|
@@ -320,6 +321,6 @@ export declare class MongoRepository {
|
|
|
320
321
|
};
|
|
321
322
|
id: string;
|
|
322
323
|
}): Promise<void>;
|
|
323
|
-
getCursor(conditions: any
|
|
324
|
+
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
|
|
324
325
|
}
|
|
325
326
|
export {};
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -24,7 +24,6 @@ exports.MongoRepository = void 0;
|
|
|
24
24
|
const place_1 = require("./mongoose/schemas/place");
|
|
25
25
|
const factory = require("../factory");
|
|
26
26
|
const settings_1 = require("../settings");
|
|
27
|
-
// const debug = createDebug('chevre-domain:repo:place');
|
|
28
27
|
/**
|
|
29
28
|
* 施設リポジトリ
|
|
30
29
|
*/
|
|
@@ -210,17 +209,17 @@ class MongoRepository {
|
|
|
210
209
|
return andConditions;
|
|
211
210
|
}
|
|
212
211
|
static CREATE_SEARCH_SEATS_PROJECTION(params) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
const includeSectionBranchCode = params['containedInPlace.branchCode'] !== 0;
|
|
213
|
+
const includeSectionName = params['containedInPlace.name'] !== 0;
|
|
214
|
+
const includeSectionTypeOf = params['containedInPlace.typeOf'] !== 0;
|
|
215
|
+
const includeScreeningRooms = params['containedInPlace.containedInPlace'] !== 0;
|
|
217
216
|
const projectStage = {
|
|
218
217
|
_id: 0,
|
|
219
218
|
typeOf: '$containsPlace.containsPlace.typeOf',
|
|
220
219
|
branchCode: '$containsPlace.containsPlace.branchCode',
|
|
221
220
|
name: '$containsPlace.containsPlace.name',
|
|
222
221
|
seatingType: '$containsPlace.containsPlace.seatingType',
|
|
223
|
-
containedInPlace: Object.assign({
|
|
222
|
+
containedInPlace: Object.assign(Object.assign(Object.assign(Object.assign({}, (includeSectionBranchCode) ? { branchCode: '$containsPlace.branchCode' } : undefined), (includeSectionName) ? { name: '$containsPlace.name' } : undefined), (includeSectionTypeOf) ? { typeOf: '$containsPlace.typeOf' } : undefined), (includeScreeningRooms)
|
|
224
223
|
? {
|
|
225
224
|
containedInPlace: {
|
|
226
225
|
typeOf: '$typeOf',
|
|
@@ -333,9 +332,7 @@ class MongoRepository {
|
|
|
333
332
|
/**
|
|
334
333
|
* 施設検索
|
|
335
334
|
*/
|
|
336
|
-
searchMovieTheaters(params,
|
|
337
|
-
// projection明示指定化(2023-06-22~)
|
|
338
|
-
inclusion, exclusion) {
|
|
335
|
+
searchMovieTheaters(params, inclusion, exclusion) {
|
|
339
336
|
var _a;
|
|
340
337
|
return __awaiter(this, void 0, void 0, function* () {
|
|
341
338
|
const conditions = MongoRepository.CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params);
|
|
@@ -46,11 +46,11 @@ function addOffers2Seat(params) {
|
|
|
46
46
|
if (typeof params.availability === 'string') {
|
|
47
47
|
availability = params.availability;
|
|
48
48
|
}
|
|
49
|
-
return Object.assign(Object.assign({}, params.seat), { offers: [{
|
|
50
|
-
typeOf: factory.offerType.Offer,
|
|
51
|
-
availability,
|
|
52
|
-
priceSpecification
|
|
53
|
-
|
|
49
|
+
return Object.assign(Object.assign({}, params.seat), { offers: [Object.assign({
|
|
50
|
+
// typeOf: factory.offerType.Offer, // optimize(2023-11-08~)
|
|
51
|
+
availability }, (priceSpecification.priceComponent.length > 0)
|
|
52
|
+
? { priceSpecification } // priceComponentの存在する場合のみ追加(2023-11-08~)
|
|
53
|
+
: undefined)] });
|
|
54
54
|
}
|
|
55
55
|
exports.addOffers2Seat = addOffers2Seat;
|
|
56
56
|
/**
|
package/package.json
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.
|
|
14
|
-
"@cinerino/sdk": "5.0.0-alpha.
|
|
13
|
+
"@chevre/factory": "4.339.0",
|
|
14
|
+
"@cinerino/sdk": "5.0.0-alpha.11",
|
|
15
15
|
"@motionpicture/coa-service": "9.2.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.2.0",
|
|
17
17
|
"@sendgrid/mail": "6.4.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.15.0-alpha.
|
|
120
|
+
"version": "21.15.0-alpha.9"
|
|
121
121
|
}
|