@chevre/domain 21.32.0-alpha.21 → 21.32.0-alpha.23
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/transaction/acceptCOAOffer.ts +1 -3
- 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/event/voidTransaction/processVoidTransaction4coa.js +4 -4
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +12 -7
- package/lib/chevre/service/task/acceptCOAOffer.js +2 -2
- package/package.json +3 -3
|
@@ -49,10 +49,8 @@ async function main() {
|
|
|
49
49
|
// typeOf: chevre.factory.creativeWorkType.WebApplication
|
|
50
50
|
// },
|
|
51
51
|
purpose: { id: '664e80c79801179aabb0476f', typeOf: chevre.factory.transactionType.PlaceOrder },
|
|
52
|
-
sameAs: { id: 'xxx'
|
|
52
|
+
sameAs: { id: 'xxx' },
|
|
53
53
|
potentialActions: { typeOf: chevre.factory.actionType.AuthorizeAction }
|
|
54
|
-
// typeOf: chevre.factory.actionType.AcceptAction,
|
|
55
|
-
// project: { id: project.id, typeOf: chevre.factory.organizationType.Project }
|
|
56
54
|
})({
|
|
57
55
|
action: await chevre.repository.Action.createInstance(mongoose.connection),
|
|
58
56
|
event: await chevre.repository.Event.createInstance(mongoose.connection),
|
|
@@ -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([
|
|
@@ -82,12 +82,12 @@ function processVoidTransaction4coa(params) {
|
|
|
82
82
|
}
|
|
83
83
|
exports.processVoidTransaction4coa = processVoidTransaction4coa;
|
|
84
84
|
function processVoidTransactionByAcceptAction4coa(params) {
|
|
85
|
-
var _a, _b, _c
|
|
85
|
+
var _a, _b, _c;
|
|
86
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
//
|
|
87
|
+
// instrument,resultに連携内容情報が保管されているので、その情報を元に仮予約を取り消す
|
|
88
88
|
let delTmpReserveParams;
|
|
89
|
-
const coaRequestBody = (
|
|
90
|
-
const coaResponseBody = (
|
|
89
|
+
const coaRequestBody = (_a = params.action.instrument) === null || _a === void 0 ? void 0 : _a.requestBody;
|
|
90
|
+
const coaResponseBody = (_c = (_b = params.action.result) === null || _b === void 0 ? void 0 : _b.result) === null || _c === void 0 ? void 0 : _c.responseBody;
|
|
91
91
|
if (coaRequestBody !== undefined && coaResponseBody !== undefined) {
|
|
92
92
|
delTmpReserveParams = {
|
|
93
93
|
theaterCode: coaRequestBody.theaterCode,
|
|
@@ -10,7 +10,7 @@ interface IAcceptRepos {
|
|
|
10
10
|
reserveService: COA.service.Reserve;
|
|
11
11
|
masterService: COA.service.Master;
|
|
12
12
|
}
|
|
13
|
-
type IAccepteOfferParams = Pick<factory.task.acceptCOAOffer.IData, 'object' | 'potentialActions' | 'purpose'
|
|
13
|
+
type IAccepteOfferParams = Pick<factory.task.acceptCOAOffer.IData, 'object' | 'potentialActions' | 'purpose'> & {
|
|
14
14
|
sameAs: {
|
|
15
15
|
id: string;
|
|
16
16
|
};
|
|
@@ -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 };
|
|
@@ -50,6 +50,8 @@ function acceptOffer(params) {
|
|
|
50
50
|
id: params.object.event.id,
|
|
51
51
|
project: { id: transaction.project.id }
|
|
52
52
|
})(repos);
|
|
53
|
+
let requestBody;
|
|
54
|
+
requestBody = (0, factory_1.createUpdTmpReserveSeatArgs)({ object: params.object, coaInfo });
|
|
53
55
|
const actionAttributes = {
|
|
54
56
|
project: transaction.project,
|
|
55
57
|
typeOf: factory.actionType.AcceptAction,
|
|
@@ -57,10 +59,10 @@ function acceptOffer(params) {
|
|
|
57
59
|
agent: { id: transaction.agent.id, typeOf: transaction.agent.typeOf },
|
|
58
60
|
purpose: { id: transaction.id, typeOf: transaction.typeOf },
|
|
59
61
|
sameAs: { id: params.sameAs.id, typeOf: 'Task' },
|
|
60
|
-
potentialActions: params.potentialActions
|
|
62
|
+
potentialActions: params.potentialActions,
|
|
63
|
+
instrument: { typeOf: 'COAReserveTransaction', requestBody }
|
|
61
64
|
};
|
|
62
65
|
let acceptedOffer;
|
|
63
|
-
let requestBody;
|
|
64
66
|
let responseBody;
|
|
65
67
|
const action = yield repos.action.start(actionAttributes);
|
|
66
68
|
try {
|
|
@@ -77,7 +79,6 @@ function acceptOffer(params) {
|
|
|
77
79
|
reserveService: repos.reserveService,
|
|
78
80
|
masterService: repos.masterService
|
|
79
81
|
});
|
|
80
|
-
requestBody = (0, factory_1.createUpdTmpReserveSeatArgs)({ object: params.object, coaInfo });
|
|
81
82
|
try {
|
|
82
83
|
responseBody = yield repos.reserveService.updTmpReserveSeat(requestBody);
|
|
83
84
|
}
|
|
@@ -99,10 +100,10 @@ function acceptOffer(params) {
|
|
|
99
100
|
acceptedOffer,
|
|
100
101
|
event: { id: params.object.event.id }
|
|
101
102
|
},
|
|
102
|
-
result: {
|
|
103
|
+
result: { responseBody },
|
|
103
104
|
typeOf: factory.actionType.AuthorizeAction
|
|
104
105
|
};
|
|
105
|
-
|
|
106
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
109
|
exports.acceptOffer = acceptOffer;
|
|
@@ -135,7 +136,11 @@ function reAcceptOffer(params) {
|
|
|
135
136
|
agent: { id: transaction.agent.id, typeOf: transaction.agent.typeOf },
|
|
136
137
|
purpose: { id: transaction.id, typeOf: transaction.typeOf },
|
|
137
138
|
sameAs: { id: params.sameAs.id, typeOf: 'Task' },
|
|
138
|
-
potentialActions: params.potentialActions
|
|
139
|
+
potentialActions: params.potentialActions,
|
|
140
|
+
instrument: {
|
|
141
|
+
typeOf: 'COAReserveTransaction'
|
|
142
|
+
// requestBody: {}
|
|
143
|
+
}
|
|
139
144
|
};
|
|
140
145
|
let acceptedOffer;
|
|
141
146
|
const action = yield repos.action.start(actionAttributes);
|
|
@@ -171,7 +176,7 @@ function reAcceptOffer(params) {
|
|
|
171
176
|
},
|
|
172
177
|
typeOf: factory.actionType.AuthorizeAction
|
|
173
178
|
};
|
|
174
|
-
|
|
179
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
175
180
|
});
|
|
176
181
|
}
|
|
177
182
|
exports.reAcceptOffer = reAcceptOffer;
|
|
@@ -55,7 +55,7 @@ function call(params) {
|
|
|
55
55
|
object,
|
|
56
56
|
purpose,
|
|
57
57
|
potentialActions: Object.assign(Object.assign({}, potentialActions), { id: potentialActions.id }),
|
|
58
|
-
sameAs: { id: params.id
|
|
58
|
+
sameAs: { id: params.id }
|
|
59
59
|
})({
|
|
60
60
|
action: actionRepo,
|
|
61
61
|
event: new event_1.MongoRepository(settings.connection),
|
|
@@ -69,7 +69,7 @@ function call(params) {
|
|
|
69
69
|
object,
|
|
70
70
|
potentialActions,
|
|
71
71
|
purpose,
|
|
72
|
-
sameAs: { id: params.id
|
|
72
|
+
sameAs: { id: params.id }
|
|
73
73
|
})({
|
|
74
74
|
action: actionRepo,
|
|
75
75
|
event: new event_1.MongoRepository(settings.connection),
|
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.371.0-alpha.
|
|
14
|
-
"@cinerino/sdk": "7.0.0-alpha.
|
|
13
|
+
"@chevre/factory": "4.371.0-alpha.6",
|
|
14
|
+
"@cinerino/sdk": "7.0.0-alpha.10",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
17
17
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "21.32.0-alpha.
|
|
113
|
+
"version": "21.32.0-alpha.23"
|
|
114
114
|
}
|