@chevre/domain 21.30.0-alpha.23 → 21.30.0-alpha.25
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/playAroundMessage.ts +37 -33
- package/lib/chevre/repo/message.d.ts +12 -0
- package/lib/chevre/repo/message.js +18 -0
- package/lib/chevre/repo/mongoose/schemas/message.js +37 -2
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.js +1 -1
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/factory.js +2 -2
- package/lib/chevre/service/payment/movieTicket.js +2 -2
- package/lib/chevre/service/task/deleteTransaction.js +2 -0
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +29 -4
- package/package.json +4 -4
|
@@ -5,43 +5,47 @@ import { chevre } from '../../../lib/index';
|
|
|
5
5
|
|
|
6
6
|
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
7
|
|
|
8
|
+
mongoose.Model.on('index', (...args) => {
|
|
9
|
+
console.error('******** index event emitted. ********\n', args);
|
|
10
|
+
});
|
|
11
|
+
|
|
8
12
|
async function main() {
|
|
9
13
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
14
|
|
|
11
15
|
const messageRepo = await chevre.repository.Message.createInstance(mongoose.connection);
|
|
12
|
-
const createResult = await messageRepo.upsertByIdentifier(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
);
|
|
44
|
-
console.log('createResult:', createResult);
|
|
16
|
+
// const createResult = await messageRepo.upsertByIdentifier(
|
|
17
|
+
// [
|
|
18
|
+
// {
|
|
19
|
+
// project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
20
|
+
// identifier: 'SendOrder-TTT5-8982603-9533198',
|
|
21
|
+
// name: 'SendOrder-TTT5-8982603-9533198',
|
|
22
|
+
// sender: {
|
|
23
|
+
// typeOf: 'Corporation',
|
|
24
|
+
// name: 'sample sender name',
|
|
25
|
+
// email: 'text@example.com'
|
|
26
|
+
// },
|
|
27
|
+
// toRecipient: [
|
|
28
|
+
// {
|
|
29
|
+
// typeOf: 'WebApplication',
|
|
30
|
+
// name: 'sample toRecipient',
|
|
31
|
+
// email: 'text@example.com'
|
|
32
|
+
// }
|
|
33
|
+
// ],
|
|
34
|
+
// about: {
|
|
35
|
+
// typeOf: 'Thing',
|
|
36
|
+
// identifier: chevre.factory.creativeWork.message.email.AboutIdentifier.OnOrderSent,
|
|
37
|
+
// name: 'sample about name'
|
|
38
|
+
// },
|
|
39
|
+
// text: 'sample text',
|
|
40
|
+
// mainEntity: {
|
|
41
|
+
// typeOf: chevre.factory.order.OrderType.Order,
|
|
42
|
+
// orderNumber: 'TTT5-8982603-9533198'
|
|
43
|
+
// },
|
|
44
|
+
// provider: { id: '5a392dfdfca1c8737fb6da42', typeOf: chevre.factory.organizationType.Corporation }
|
|
45
|
+
// }
|
|
46
|
+
// ]
|
|
47
|
+
// );
|
|
48
|
+
// console.log('createResult:', createResult);
|
|
45
49
|
|
|
46
50
|
const messages = await messageRepo.search(
|
|
47
51
|
{
|
|
@@ -74,5 +74,17 @@ export declare class MessageRepo {
|
|
|
74
74
|
id: string;
|
|
75
75
|
};
|
|
76
76
|
}): Promise<IFindByIdentifierResult>;
|
|
77
|
+
deleteByMainEntityOrderNumber(params: {
|
|
78
|
+
project: {
|
|
79
|
+
id: string;
|
|
80
|
+
};
|
|
81
|
+
mainEntity: {
|
|
82
|
+
orderNumber: string;
|
|
83
|
+
};
|
|
84
|
+
}): Promise<{
|
|
85
|
+
n?: number;
|
|
86
|
+
ok?: number;
|
|
87
|
+
deletedCount?: number;
|
|
88
|
+
} | null>;
|
|
77
89
|
}
|
|
78
90
|
export {};
|
|
@@ -161,5 +161,23 @@ class MessageRepo {
|
|
|
161
161
|
return doc.toObject();
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
+
deleteByMainEntityOrderNumber(params) {
|
|
165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
return this.messageModel.deleteMany({
|
|
167
|
+
'project.id': { $eq: params.project.id },
|
|
168
|
+
'mainEntity.orderNumber': { $exists: true, $eq: params.mainEntity.orderNumber }
|
|
169
|
+
})
|
|
170
|
+
.exec()
|
|
171
|
+
.then((result) => {
|
|
172
|
+
return {
|
|
173
|
+
// n: result?.n,
|
|
174
|
+
// opTime: result.opTime,
|
|
175
|
+
// ok: result?.ok,
|
|
176
|
+
// operationTime,
|
|
177
|
+
deletedCount: result === null || result === void 0 ? void 0 : result.deletedCount
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
164
182
|
}
|
|
165
183
|
exports.MessageRepo = MessageRepo;
|
|
@@ -29,9 +29,15 @@ const schemaDefinition = {
|
|
|
29
29
|
},
|
|
30
30
|
mainEntity: mongoose_1.SchemaTypes.Mixed,
|
|
31
31
|
name: mongoose_1.SchemaTypes.Mixed,
|
|
32
|
-
about:
|
|
32
|
+
about: {
|
|
33
|
+
type: mongoose_1.SchemaTypes.Mixed,
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
33
36
|
sender: mongoose_1.SchemaTypes.Mixed,
|
|
34
|
-
text:
|
|
37
|
+
text: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: true
|
|
40
|
+
},
|
|
35
41
|
toRecipient: mongoose_1.SchemaTypes.Mixed
|
|
36
42
|
};
|
|
37
43
|
const schemaOptions = {
|
|
@@ -68,6 +74,35 @@ const indexes = [
|
|
|
68
74
|
[
|
|
69
75
|
{ updatedAt: 1 },
|
|
70
76
|
{ name: 'searchByUpdatedAt' }
|
|
77
|
+
],
|
|
78
|
+
[
|
|
79
|
+
{ datePublished: 1 },
|
|
80
|
+
{ name: 'searchByDatePublished' }
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
{ identifier: 1, datePublished: 1 },
|
|
84
|
+
{ name: 'searchByIdentifier' }
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
{ 'project.id': 1, datePublished: 1 },
|
|
88
|
+
{ name: 'searchByProjectId' }
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
{ 'provider.id': 1, datePublished: 1 },
|
|
92
|
+
{ name: 'searchByProviderId' }
|
|
93
|
+
],
|
|
94
|
+
[
|
|
95
|
+
{ 'about.identifier': 1, datePublished: 1 },
|
|
96
|
+
{ name: 'searchByAboutIdentifier' }
|
|
97
|
+
],
|
|
98
|
+
[
|
|
99
|
+
{ 'mainEntity.orderNumber': 1, datePublished: 1 },
|
|
100
|
+
{
|
|
101
|
+
name: 'searchByMainEntityOrderNumber',
|
|
102
|
+
partialFilterExpression: {
|
|
103
|
+
'mainEntity.orderNumber': { $exists: true }
|
|
104
|
+
}
|
|
105
|
+
}
|
|
71
106
|
]
|
|
72
107
|
];
|
|
73
108
|
exports.indexes = indexes;
|
|
@@ -69,7 +69,7 @@ function checkByIdentifier(params) {
|
|
|
69
69
|
})(repos);
|
|
70
70
|
purchaseNumberAuthIn = {
|
|
71
71
|
kgygishCd: sellerCredentials.kgygishCd,
|
|
72
|
-
jhshbtsCd: surfrock.service.auth.
|
|
72
|
+
jhshbtsCd: surfrock.factory.service.auth.purchaseNumberAuth.InformationTypeCode.All,
|
|
73
73
|
knyknrNoInfoIn: knyknrNoInfoIn,
|
|
74
74
|
skhnCd: skhnCd,
|
|
75
75
|
stCd: sellerCredentials.stCd,
|
|
@@ -50,8 +50,8 @@ function createSeatInfoSyncIn(params) {
|
|
|
50
50
|
// }
|
|
51
51
|
return {
|
|
52
52
|
kgygishCd: kgygishCd,
|
|
53
|
-
yykDvcTyp: surfrock.service.seat.
|
|
54
|
-
trkshFlg: surfrock.service.seat.
|
|
53
|
+
yykDvcTyp: surfrock.factory.service.seat.seatInfoSync.ReserveDeviceType.EntertainerSitePC,
|
|
54
|
+
trkshFlg: surfrock.factory.service.seat.seatInfoSync.DeleteFlag.False,
|
|
55
55
|
kgygishSstmZskyykNo: params.paymentMethodId,
|
|
56
56
|
// 興行会社ユーザー座席予約番号
|
|
57
57
|
kgygishUsrZskyykNo: (typeof ((_c = params.purpose) === null || _c === void 0 ? void 0 : _c.confirmationNumber) === 'string')
|
|
@@ -519,7 +519,7 @@ function createSeatInfoSyncInOnRefund(params) {
|
|
|
519
519
|
}
|
|
520
520
|
let seatInfoSyncIn;
|
|
521
521
|
// 着券時のseatInfoSyncInに対してtrkshFlgだけ変更してリクエストする
|
|
522
|
-
seatInfoSyncIn = Object.assign(Object.assign({}, seatInfoSyncInOnPay), { trkshFlg: surfrock.service.seat.
|
|
522
|
+
seatInfoSyncIn = Object.assign(Object.assign({}, seatInfoSyncInOnPay), { trkshFlg: surfrock.factory.service.seat.seatInfoSync.DeleteFlag.True // 取消フラグ
|
|
523
523
|
});
|
|
524
524
|
return seatInfoSyncIn;
|
|
525
525
|
});
|
|
@@ -552,7 +552,7 @@ function createSeatInfoSyncCancelInOnRefund(params) {
|
|
|
552
552
|
kgygishCd: seatInfoSyncInOnPay.kgygishCd,
|
|
553
553
|
kgysystmzskyykNo: seatInfoSyncInOnPay.kgygishSstmZskyykNo,
|
|
554
554
|
kgysystmzskyykNoIkktsCnclFlg: '1',
|
|
555
|
-
jyuTyp: surfrock.service.seat.factory.seatInfoSyncCancel.JyuTyp.
|
|
555
|
+
jyuTyp: surfrock.service.seat.factory.seatInfoSyncCancel.JyuTyp.JyuTyp05,
|
|
556
556
|
jyuTypRmk: ''
|
|
557
557
|
// knyknrNoInfoIn: [],
|
|
558
558
|
};
|
|
@@ -15,6 +15,7 @@ const accountingReport_1 = require("../../repo/accountingReport");
|
|
|
15
15
|
const action_1 = require("../../repo/action");
|
|
16
16
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
17
17
|
const event_1 = require("../../repo/event");
|
|
18
|
+
const message_1 = require("../../repo/message");
|
|
18
19
|
const note_1 = require("../../repo/note");
|
|
19
20
|
const order_1 = require("../../repo/order");
|
|
20
21
|
const ownershipInfo_1 = require("../../repo/ownershipInfo");
|
|
@@ -33,6 +34,7 @@ function call(data) {
|
|
|
33
34
|
action: new action_1.MongoRepository(settings.connection),
|
|
34
35
|
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
35
36
|
event: new event_1.MongoRepository(settings.connection),
|
|
37
|
+
message: new message_1.MessageRepo(settings.connection),
|
|
36
38
|
note: new note_1.MongoRepository(settings.connection),
|
|
37
39
|
order: new order_1.MongoRepository(settings.connection),
|
|
38
40
|
ownershipInfo: new ownershipInfo_1.MongoRepository(settings.connection),
|
|
@@ -4,6 +4,7 @@ import type { MongoRepository as AccountingReportRepo } from '../../repo/account
|
|
|
4
4
|
import type { MongoRepository as ActionRepo } from '../../repo/action';
|
|
5
5
|
import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
6
6
|
import type { MongoRepository as EventRepo } from '../../repo/event';
|
|
7
|
+
import type { MessageRepo } from '../../repo/message';
|
|
7
8
|
import type { MongoRepository as NoteRepo } from '../../repo/note';
|
|
8
9
|
import type { MongoRepository as OrderRepo } from '../../repo/order';
|
|
9
10
|
import type { MongoRepository as OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
@@ -20,6 +21,7 @@ export declare function deleteTransaction(params: factory.task.IData<factory.tas
|
|
|
20
21
|
action: ActionRepo;
|
|
21
22
|
assetTransaction: AssetTransactionRepo;
|
|
22
23
|
event: EventRepo;
|
|
24
|
+
message: MessageRepo;
|
|
23
25
|
note: NoteRepo;
|
|
24
26
|
order: OrderRepo;
|
|
25
27
|
ownershipInfo: OwnershipInfoRepo;
|
|
@@ -154,6 +154,7 @@ function deleteTransactionById(params) {
|
|
|
154
154
|
let deleteCancelReservationTransactionResult;
|
|
155
155
|
let deletedReservationNumbers = [];
|
|
156
156
|
let deleteActionResult;
|
|
157
|
+
let deleteMessagessResult;
|
|
157
158
|
const action = yield repos.action.start(actionAttributes);
|
|
158
159
|
try {
|
|
159
160
|
const transactionTypeOf = transaction.typeOf;
|
|
@@ -209,6 +210,11 @@ function deleteTransactionById(params) {
|
|
|
209
210
|
]
|
|
210
211
|
}
|
|
211
212
|
});
|
|
213
|
+
// messages削除(2024-05-01~)
|
|
214
|
+
const deleteMessagesByPlaceOrderResult = yield deleteMessagesByPlaceOrder({
|
|
215
|
+
transaction: params.object
|
|
216
|
+
})(repos);
|
|
217
|
+
deleteMessagessResult = deleteMessagesByPlaceOrderResult.deleteResult;
|
|
212
218
|
// 取引削除
|
|
213
219
|
yield repos.transaction.findByIdAndDelete({ id: transaction.id });
|
|
214
220
|
break;
|
|
@@ -236,16 +242,14 @@ function deleteTransactionById(params) {
|
|
|
236
242
|
throw error;
|
|
237
243
|
}
|
|
238
244
|
// アクション完了
|
|
239
|
-
const actionResult = {
|
|
240
|
-
deletePayTransactionResult,
|
|
245
|
+
const actionResult = Object.assign({ deletePayTransactionResult,
|
|
241
246
|
deleteRefundResult,
|
|
242
247
|
payTransactionNumbers,
|
|
243
248
|
deleteReservationsResult,
|
|
244
249
|
deleteReserveTransactionResult,
|
|
245
250
|
deleteCancelReservationTransactionResult,
|
|
246
251
|
deletedReservationNumbers,
|
|
247
|
-
deleteActionResult
|
|
248
|
-
};
|
|
252
|
+
deleteActionResult }, (deleteMessagessResult !== undefined) ? { deleteMessagessResult } : undefined);
|
|
249
253
|
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
250
254
|
});
|
|
251
255
|
}
|
|
@@ -359,3 +363,24 @@ function deletePayTransactionsByPlaceOrder(params) {
|
|
|
359
363
|
return { deletePayTransactionResult, deleteRefundResult, payTransactionNumbers };
|
|
360
364
|
});
|
|
361
365
|
}
|
|
366
|
+
function deleteMessagesByPlaceOrder(params) {
|
|
367
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
368
|
+
let deleteResult;
|
|
369
|
+
if (params.transaction.typeOf === factory.transactionType.PlaceOrder
|
|
370
|
+
&& params.transaction.specifyingMethod === factory.task.deleteTransaction.SpecifyingMethod.Id) {
|
|
371
|
+
const orderNumber = params.transaction.object.orderNumber;
|
|
372
|
+
if (typeof orderNumber === 'string' && orderNumber.length > 0) {
|
|
373
|
+
const deleteReservationsResult = yield repos.message.deleteByMainEntityOrderNumber({
|
|
374
|
+
project: { id: params.transaction.project.id },
|
|
375
|
+
mainEntity: { orderNumber }
|
|
376
|
+
});
|
|
377
|
+
deleteResult = {
|
|
378
|
+
n: deleteReservationsResult === null || deleteReservationsResult === void 0 ? void 0 : deleteReservationsResult.n,
|
|
379
|
+
ok: deleteReservationsResult === null || deleteReservationsResult === void 0 ? void 0 : deleteReservationsResult.ok,
|
|
380
|
+
deletedCount: deleteReservationsResult === null || deleteReservationsResult === void 0 ? void 0 : deleteReservationsResult.deletedCount
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return { deleteResult };
|
|
385
|
+
});
|
|
386
|
+
}
|
package/package.json
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.369.0-alpha.
|
|
14
|
-
"@cinerino/sdk": "5.
|
|
13
|
+
"@chevre/factory": "4.369.0-alpha.4",
|
|
14
|
+
"@cinerino/sdk": "5.18.0-alpha.16",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
17
17
|
"@sendgrid/mail": "6.4.0",
|
|
18
|
-
"@surfrock/sdk": "1.3.0-alpha.
|
|
18
|
+
"@surfrock/sdk": "1.3.0-alpha.2",
|
|
19
19
|
"cdigit": "2.6.7",
|
|
20
20
|
"debug": "^3.2.7",
|
|
21
21
|
"google-libphonenumber": "^3.2.18",
|
|
@@ -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.30.0-alpha.
|
|
113
|
+
"version": "21.30.0-alpha.25"
|
|
114
114
|
}
|