@chevre/domain 21.2.0-alpha.37 → 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.
|
@@ -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)
|
package/package.json
CHANGED