@chevre/domain 21.2.0-alpha.36 → 21.2.0-alpha.38
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/saveTasks.ts +13 -10
- package/lib/chevre/repo/comment.d.ts +4 -1
- package/lib/chevre/repo/comment.js +20 -5
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +1 -1
- package/package.json +1 -1
|
@@ -10,16 +10,19 @@ async function main() {
|
|
|
10
10
|
|
|
11
11
|
const taskRepo = new chevre.repository.Task(mongoose.connection);
|
|
12
12
|
|
|
13
|
-
const result = await taskRepo.saveMany(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
const result = await taskRepo.saveMany(
|
|
14
|
+
[{
|
|
15
|
+
name: chevre.factory.taskName.TriggerWebhook,
|
|
16
|
+
runsAt: new Date(),
|
|
17
|
+
data: {},
|
|
18
|
+
executionResults: [],
|
|
19
|
+
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
20
|
+
numberOfTried: 0,
|
|
21
|
+
remainingNumberOfTries: 1,
|
|
22
|
+
status: chevre.factory.taskStatus.Ready
|
|
23
|
+
}],
|
|
24
|
+
{ emitImmediately: false }
|
|
25
|
+
);
|
|
23
26
|
|
|
24
27
|
console.log(result, 'tasks saved');
|
|
25
28
|
}
|
|
@@ -34,7 +34,10 @@ export declare class MongoRepository {
|
|
|
34
34
|
/**
|
|
35
35
|
* 検索
|
|
36
36
|
*/
|
|
37
|
-
search(params: factory.creativeWork.comment.ISearchConditions
|
|
37
|
+
search(params: factory.creativeWork.comment.ISearchConditions & {
|
|
38
|
+
inclusion: string[];
|
|
39
|
+
exclusion: string[];
|
|
40
|
+
}): Promise<factory.creativeWork.comment.IComment[]>;
|
|
38
41
|
findById(params: {
|
|
39
42
|
id: string;
|
|
40
43
|
}): Promise<factory.creativeWork.comment.IComment>;
|
|
@@ -42,12 +42,27 @@ class MongoRepository {
|
|
|
42
42
|
search(params) {
|
|
43
43
|
var _a;
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
let projection = {};
|
|
46
|
+
if (Array.isArray(params.inclusion) && params.inclusion.length > 0) {
|
|
47
|
+
params.inclusion.forEach((field) => {
|
|
48
|
+
projection[field] = 1;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
projection = {
|
|
53
|
+
__v: 0,
|
|
54
|
+
createdAt: 0,
|
|
55
|
+
updatedAt: 0
|
|
56
|
+
};
|
|
57
|
+
if (Array.isArray(params.exclusion) && params.exclusion.length > 0) {
|
|
58
|
+
params.exclusion.forEach((field) => {
|
|
59
|
+
projection[field] = 0;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
45
63
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
46
|
-
const query = this.commentModel.find((conditions.length > 0) ? { $and: conditions } : {}
|
|
47
|
-
|
|
48
|
-
createdAt: 0,
|
|
49
|
-
updatedAt: 0
|
|
50
|
-
});
|
|
64
|
+
const query = this.commentModel.find((conditions.length > 0) ? { $and: conditions } : {})
|
|
65
|
+
.select(projection);
|
|
51
66
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
52
67
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
53
68
|
query.limit(params.limit)
|
|
@@ -27,7 +27,7 @@ export declare class MongoRepository {
|
|
|
27
27
|
readonly taskModel: typeof Model;
|
|
28
28
|
constructor(connection: Connection);
|
|
29
29
|
static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): any[];
|
|
30
|
-
saveMany(taskAttributes: factory.task.IAttributes<factory.taskName>[], options
|
|
30
|
+
saveMany(taskAttributes: factory.task.IAttributes<factory.taskName>[], options: IOptionOnCreate): Promise<{
|
|
31
31
|
id: string;
|
|
32
32
|
}[]>;
|
|
33
33
|
createInformTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.TriggerWebhook>, options: IOptionOnCreate): Promise<void>;
|
|
@@ -92,7 +92,7 @@ function onReservationCanceled(canceledReservations, useInformReservation) {
|
|
|
92
92
|
}
|
|
93
93
|
// タスク保管
|
|
94
94
|
if (taskAttributes.length > 0) {
|
|
95
|
-
yield repos.task.saveMany(taskAttributes);
|
|
95
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
96
96
|
}
|
|
97
97
|
// 冗長な作成を避ける
|
|
98
98
|
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
|
@@ -107,7 +107,7 @@ function onReservationCheckedIn(params) {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
if (tasks.length > 0) {
|
|
110
|
-
yield repos.task.saveMany(tasks);
|
|
110
|
+
yield repos.task.saveMany(tasks, { emitImmediately: true });
|
|
111
111
|
}
|
|
112
112
|
// 冗長な作成を避ける
|
|
113
113
|
const reservationForIds = (_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.ids;
|
|
@@ -97,7 +97,7 @@ function onReservationUsed(action, attendedReservation) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
if (tasks.length > 0) {
|
|
100
|
-
yield repos.task.saveMany(tasks);
|
|
100
|
+
yield repos.task.saveMany(tasks, { emitImmediately: true });
|
|
101
101
|
}
|
|
102
102
|
// 冗長な作成を避ける
|
|
103
103
|
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
package/package.json
CHANGED