@chevre/domain 20.1.0-alpha.14 → 20.1.0-alpha.15
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/event.d.ts +9 -4
- package/lib/chevre/repo/event.js +43 -40
- package/package.json +1 -1
|
@@ -29,13 +29,14 @@ export interface IUpdateAggregateUseActionsParams {
|
|
|
29
29
|
noExistingAttributeName: 1;
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
+
export declare type ISearchConditions<T extends factory.eventType> = factory.event.ISearchConditions<T>;
|
|
32
33
|
/**
|
|
33
34
|
* イベントリポジトリ
|
|
34
35
|
*/
|
|
35
36
|
export declare class MongoRepository {
|
|
36
37
|
private readonly eventModel;
|
|
37
38
|
constructor(connection: Connection);
|
|
38
|
-
static CREATE_MONGO_CONDITIONS<T extends factory.eventType>(conditions:
|
|
39
|
+
static CREATE_MONGO_CONDITIONS<T extends factory.eventType>(conditions: ISearchConditions<T>): any[];
|
|
39
40
|
/**
|
|
40
41
|
* 複数イベントを作成する
|
|
41
42
|
*/
|
|
@@ -71,14 +72,18 @@ export declare class MongoRepository {
|
|
|
71
72
|
attributes: factory.event.IAttributes<factory.eventType.ScreeningEvent>;
|
|
72
73
|
useOldEventId: boolean;
|
|
73
74
|
}): Promise<factory.event.IEvent<factory.eventType.ScreeningEvent>>;
|
|
74
|
-
count<T extends factory.eventType>(params:
|
|
75
|
+
count<T extends factory.eventType>(params: ISearchConditions<T>): Promise<number>;
|
|
75
76
|
/**
|
|
76
77
|
* イベントを検索する
|
|
77
78
|
*/
|
|
78
|
-
search<T extends factory.eventType>(params:
|
|
79
|
+
search<T extends factory.eventType>(params: ISearchConditions<T>, projection?: {
|
|
80
|
+
[key: string]: number;
|
|
81
|
+
}): Promise<factory.event.IEvent<T>[]>;
|
|
79
82
|
findById<T extends factory.eventType>(params: {
|
|
80
83
|
id: string;
|
|
81
|
-
}, projection?:
|
|
84
|
+
}, projection?: {
|
|
85
|
+
[key: string]: number;
|
|
86
|
+
}): Promise<factory.event.IEvent<T>>;
|
|
82
87
|
/**
|
|
83
88
|
* イベントをキャンセルする
|
|
84
89
|
*/
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -24,6 +24,7 @@ exports.MongoRepository = void 0;
|
|
|
24
24
|
const uniqid = require("uniqid");
|
|
25
25
|
const factory = require("../factory");
|
|
26
26
|
const event_1 = require("./mongoose/model/event");
|
|
27
|
+
const USE_DEPRECATED_EVENT_SEARCH_CONDITIONS = process.env.USE_DEPRECATED_EVENT_SEARCH_CONDITIONS === '1';
|
|
27
28
|
/**
|
|
28
29
|
* イベントリポジトリ
|
|
29
30
|
*/
|
|
@@ -144,7 +145,7 @@ class MongoRepository {
|
|
|
144
145
|
}
|
|
145
146
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
146
147
|
/* istanbul ignore else */
|
|
147
|
-
const superEventLocationIdEq = (_k = (_j = (_h =
|
|
148
|
+
const superEventLocationIdEq = (_k = (_j = (_h = params.superEvent) === null || _h === void 0 ? void 0 : _h.location) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
148
149
|
if (typeof superEventLocationIdEq === 'string') {
|
|
149
150
|
andConditions.push({
|
|
150
151
|
'superEvent.location.id': {
|
|
@@ -190,45 +191,47 @@ class MongoRepository {
|
|
|
190
191
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
191
192
|
/* istanbul ignore else */
|
|
192
193
|
if (params.offers !== undefined) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
194
|
+
if (USE_DEPRECATED_EVENT_SEARCH_CONDITIONS) {
|
|
195
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
196
|
+
/* istanbul ignore else */
|
|
197
|
+
if (params.offers.availableFrom instanceof Date) {
|
|
198
|
+
andConditions.push({
|
|
199
|
+
'offers.availabilityEnds': {
|
|
200
|
+
$exists: true,
|
|
201
|
+
$gte: params.offers.availableFrom
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
206
|
+
/* istanbul ignore else */
|
|
207
|
+
if (params.offers.availableThrough instanceof Date) {
|
|
208
|
+
andConditions.push({
|
|
209
|
+
'offers.availabilityStarts': {
|
|
210
|
+
$exists: true,
|
|
211
|
+
$lte: params.offers.availableThrough
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
216
|
+
/* istanbul ignore else */
|
|
217
|
+
if (params.offers.validFrom instanceof Date) {
|
|
218
|
+
andConditions.push({
|
|
219
|
+
'offers.validThrough': {
|
|
220
|
+
$exists: true,
|
|
221
|
+
$gte: params.offers.validFrom
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
226
|
+
/* istanbul ignore else */
|
|
227
|
+
if (params.offers.validThrough instanceof Date) {
|
|
228
|
+
andConditions.push({
|
|
229
|
+
'offers.validFrom': {
|
|
230
|
+
$exists: true,
|
|
231
|
+
$lte: params.offers.validThrough
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
232
235
|
}
|
|
233
236
|
const itemOfferedIdIn = (_m = (_l = params.offers.itemOffered) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$in;
|
|
234
237
|
if (Array.isArray(itemOfferedIdIn)) {
|
package/package.json
CHANGED