@chevre/domain 21.32.0-alpha.21 → 21.32.0-alpha.22
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/unsetUnnecessaryFields.ts +11 -5
- package/lib/chevre/repo/aggregation.d.ts +4 -0
- package/lib/chevre/repo/aggregation.js +6 -0
- package/lib/chevre/repo/mongoose/schemas/aggregation.js +3 -14
- package/lib/chevre/repo/mongoose/schemas/task.js +2 -12
- package/lib/chevre/repo/task.d.ts +4 -0
- package/lib/chevre/repo/task.js +6 -0
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment';
|
|
2
3
|
import * as mongoose from 'mongoose';
|
|
3
4
|
|
|
4
5
|
import { chevre } from '../../../lib/index';
|
|
@@ -8,10 +9,10 @@ async function main() {
|
|
|
8
9
|
|
|
9
10
|
let updateResult: any;
|
|
10
11
|
|
|
11
|
-
const
|
|
12
|
-
const
|
|
12
|
+
const aggregationRepo = await chevre.repository.Aggregation.createInstance(mongoose.connection);
|
|
13
|
+
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
13
14
|
|
|
14
|
-
updateResult = await
|
|
15
|
+
updateResult = await aggregationRepo.unsetUnnecessaryFields({
|
|
15
16
|
filter: {
|
|
16
17
|
_id: { $exists: true }
|
|
17
18
|
},
|
|
@@ -23,9 +24,14 @@ async function main() {
|
|
|
23
24
|
});
|
|
24
25
|
console.log('unset processed.', updateResult);
|
|
25
26
|
|
|
26
|
-
updateResult = await
|
|
27
|
+
updateResult = await taskRepo.unsetUnnecessaryFields({
|
|
27
28
|
filter: {
|
|
28
|
-
_id: { $exists: true }
|
|
29
|
+
// _id: { $exists: true },
|
|
30
|
+
runsAt: {
|
|
31
|
+
$gte: moment()
|
|
32
|
+
.add(-1, 'days')
|
|
33
|
+
.toDate()
|
|
34
|
+
}
|
|
29
35
|
},
|
|
30
36
|
$unset: {
|
|
31
37
|
__v: 1,
|
|
@@ -38,4 +38,8 @@ export declare class MongoRepository {
|
|
|
38
38
|
readonly aggregationModel: typeof Model;
|
|
39
39
|
constructor(connection: Connection);
|
|
40
40
|
saveAggregation(params: IAggregation): Promise<any>;
|
|
41
|
+
unsetUnnecessaryFields(params: {
|
|
42
|
+
filter: any;
|
|
43
|
+
$unset: any;
|
|
44
|
+
}): Promise<import("mongodb").UpdateResult>;
|
|
41
45
|
}
|
|
@@ -67,5 +67,11 @@ class MongoRepository {
|
|
|
67
67
|
return doc.toObject();
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
+
unsetUnnecessaryFields(params) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
return this.aggregationModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
73
|
+
.exec();
|
|
74
|
+
});
|
|
75
|
+
}
|
|
70
76
|
}
|
|
71
77
|
exports.MongoRepository = MongoRepository;
|
|
@@ -16,10 +16,8 @@ const schemaOptions = {
|
|
|
16
16
|
writeConcern: writeConcern_1.writeConcern,
|
|
17
17
|
strict: false,
|
|
18
18
|
strictQuery: false,
|
|
19
|
-
timestamps:
|
|
20
|
-
|
|
21
|
-
updatedAt: 'updatedAt'
|
|
22
|
-
},
|
|
19
|
+
timestamps: false,
|
|
20
|
+
versionKey: false,
|
|
23
21
|
toJSON: {
|
|
24
22
|
getters: false,
|
|
25
23
|
virtuals: false,
|
|
@@ -44,14 +42,5 @@ function createSchema() {
|
|
|
44
42
|
return schema;
|
|
45
43
|
}
|
|
46
44
|
exports.createSchema = createSchema;
|
|
47
|
-
const indexes = [
|
|
48
|
-
[
|
|
49
|
-
{ createdAt: 1 },
|
|
50
|
-
{ name: 'searchByCreatedAt' }
|
|
51
|
-
],
|
|
52
|
-
[
|
|
53
|
-
{ updatedAt: 1 },
|
|
54
|
-
{ name: 'searchByUpdatedAt' }
|
|
55
|
-
]
|
|
56
|
-
];
|
|
45
|
+
const indexes = [];
|
|
57
46
|
exports.indexes = indexes;
|
|
@@ -33,10 +33,8 @@ const schemaOptions = {
|
|
|
33
33
|
writeConcern: writeConcern_1.writeConcern,
|
|
34
34
|
strict: true,
|
|
35
35
|
strictQuery: false,
|
|
36
|
-
timestamps:
|
|
37
|
-
|
|
38
|
-
updatedAt: 'updatedAt'
|
|
39
|
-
},
|
|
36
|
+
timestamps: false,
|
|
37
|
+
versionKey: false,
|
|
40
38
|
toJSON: {
|
|
41
39
|
getters: false,
|
|
42
40
|
virtuals: false,
|
|
@@ -51,14 +49,6 @@ const schemaOptions = {
|
|
|
51
49
|
}
|
|
52
50
|
};
|
|
53
51
|
const indexes = [
|
|
54
|
-
[
|
|
55
|
-
{ createdAt: 1 },
|
|
56
|
-
{ name: 'searchByCreatedAt' }
|
|
57
|
-
],
|
|
58
|
-
[
|
|
59
|
-
{ updatedAt: 1 },
|
|
60
|
-
{ name: 'searchByUpdatedAt' }
|
|
61
|
-
],
|
|
62
52
|
[
|
|
63
53
|
{ 'project.id': 1, runsAt: -1 },
|
|
64
54
|
{ name: 'searchByProjectId-v20220721' }
|
|
@@ -168,6 +168,10 @@ export declare class MongoRepository {
|
|
|
168
168
|
};
|
|
169
169
|
}): Promise<number>;
|
|
170
170
|
getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
|
|
171
|
+
unsetUnnecessaryFields(params: {
|
|
172
|
+
filter: any;
|
|
173
|
+
$unset: any;
|
|
174
|
+
}): Promise<import("mongodb").UpdateResult>;
|
|
171
175
|
aggregateTask(params: {
|
|
172
176
|
project?: {
|
|
173
177
|
id?: {
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -645,6 +645,12 @@ class MongoRepository {
|
|
|
645
645
|
.sort({ runsAt: factory.sortType.Ascending })
|
|
646
646
|
.cursor();
|
|
647
647
|
}
|
|
648
|
+
unsetUnnecessaryFields(params) {
|
|
649
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
650
|
+
return this.taskModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
651
|
+
.exec();
|
|
652
|
+
});
|
|
653
|
+
}
|
|
648
654
|
aggregateTask(params) {
|
|
649
655
|
return __awaiter(this, void 0, void 0, function* () {
|
|
650
656
|
const statuses = yield Promise.all([
|
|
@@ -18,7 +18,7 @@ type IAccepteOfferParams = Pick<factory.task.acceptCOAOffer.IData, 'object' | 'p
|
|
|
18
18
|
/**
|
|
19
19
|
* COA興行オファー採用
|
|
20
20
|
*/
|
|
21
|
-
declare function acceptOffer(params: IAccepteOfferParams): (repos: IAcceptRepos) => Promise<
|
|
21
|
+
declare function acceptOffer(params: IAccepteOfferParams): (repos: IAcceptRepos) => Promise<void>;
|
|
22
22
|
/**
|
|
23
23
|
* COA興行オファー採用変更
|
|
24
24
|
*/
|
|
@@ -29,5 +29,5 @@ declare function reAcceptOffer(params: IAccepteOfferParams & {
|
|
|
29
29
|
*/
|
|
30
30
|
id: string;
|
|
31
31
|
};
|
|
32
|
-
}): (repos: IAcceptRepos) => Promise<
|
|
32
|
+
}): (repos: IAcceptRepos) => Promise<void>;
|
|
33
33
|
export { acceptOffer, reAcceptOffer };
|
|
@@ -102,7 +102,7 @@ function acceptOffer(params) {
|
|
|
102
102
|
result: { requestBody, responseBody },
|
|
103
103
|
typeOf: factory.actionType.AuthorizeAction
|
|
104
104
|
};
|
|
105
|
-
|
|
105
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
exports.acceptOffer = acceptOffer;
|
|
@@ -171,7 +171,7 @@ function reAcceptOffer(params) {
|
|
|
171
171
|
},
|
|
172
172
|
typeOf: factory.actionType.AuthorizeAction
|
|
173
173
|
};
|
|
174
|
-
|
|
174
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
exports.reAcceptOffer = reAcceptOffer;
|
package/package.json
CHANGED