@chevre/domain 22.14.0-alpha.2 → 22.14.0-alpha.21
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/{createEventBySchedule.ts → addEventBySchedule.ts} +2 -2
- package/example/src/chevre/authorizeEventServiceOffer.ts +119 -0
- package/example/src/chevre/findReservationByCode.ts +0 -1
- package/example/src/chevre/productOffer/publishMemberTierToken.ts +92 -0
- package/lib/chevre/repo/accountingReport.d.ts +4 -4
- package/lib/chevre/repo/accountingReport.js +1 -1
- package/lib/chevre/repo/action.d.ts +1 -1
- package/lib/chevre/repo/creativeWork.d.ts +1 -3
- package/lib/chevre/repo/creativeWork.js +65 -47
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +2 -15
- package/lib/chevre/repo/mongoose/schemas/productOffer.d.ts +36 -0
- package/lib/chevre/repo/mongoose/schemas/{offer/event.js → productOffer.js} +9 -53
- package/lib/chevre/repo/note.d.ts +15 -3
- package/lib/chevre/repo/note.js +19 -1
- package/lib/chevre/repo/productOffer.d.ts +63 -65
- package/lib/chevre/repo/productOffer.js +121 -163
- package/lib/chevre/repo/task.js +2 -2
- package/lib/chevre/repository.d.ts +0 -5
- package/lib/chevre/repository.js +2 -15
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.d.ts +0 -2
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +0 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +79 -57
- package/lib/chevre/service/event.js +10 -2
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize/factory.js +2 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -3
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.js +2 -2
- package/lib/chevre/service/offer/product.d.ts +0 -3
- package/lib/chevre/service/offer/product.js +29 -38
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +0 -1
- package/lib/chevre/service/order/deleteOrder.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -1
- package/lib/chevre/service/reserve/useReservation.js +2 -3
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +0 -2
- package/lib/chevre/service/task/checkResource.d.ts +2 -2
- package/lib/chevre/service/task/checkResource.js +8 -6
- package/lib/chevre/service/task/createAccountingReport.d.ts +2 -2
- package/lib/chevre/service/task/createAccountingReport.js +15 -15
- package/lib/chevre/service/task/createEvent/createEventBySchedule.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +3 -2
- package/lib/chevre/service/task/createEvent/createEventSeries.d.ts +1 -1
- package/lib/chevre/service/task/deletePerson.js +11 -10
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -2
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +13 -6
- package/lib/chevre/service/task/onResourceUpdated.js +1 -2
- package/lib/chevre/service/task/useReservation.js +1 -2
- package/lib/chevre/service/taskHandler.js +2 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +9 -9
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +0 -1
- package/package.json +2 -2
- package/example/src/chevre/eventOffer/adminEventOffers.ts +0 -67
- package/example/src/chevre/migrateDeleteTransactionTasks.ts +0 -132
- package/example/src/chevre/optimizeDeleteTransactionTasks.ts +0 -119
- package/example/src/chevre/upsertMoviesByIdentifier.ts +0 -58
- package/lib/chevre/repo/mongoose/schemas/offer/event.d.ts +0 -10
- package/lib/chevre/repo/offer/event.d.ts +0 -38
- package/lib/chevre/repo/offer/event.js +0 -142
|
@@ -19,9 +19,9 @@ const createAccountingReportIfNotExist_1 = require("../order/createAccountingRep
|
|
|
19
19
|
/**
|
|
20
20
|
* タスク実行関数
|
|
21
21
|
*/
|
|
22
|
-
function call(
|
|
22
|
+
function call(params) {
|
|
23
23
|
return (_a) => __awaiter(this, [_a], void 0, function* ({ connection }) {
|
|
24
|
-
yield createAccountingReport(
|
|
24
|
+
yield createAccountingReport(params)({
|
|
25
25
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
26
26
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
27
27
|
action: new action_1.ActionRepo(connection),
|
|
@@ -31,8 +31,9 @@ function call(data) {
|
|
|
31
31
|
}
|
|
32
32
|
function createAccountingReport(params) {
|
|
33
33
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const { data } = params;
|
|
34
35
|
const order = yield repos.order.projectFieldsByOrderNumber({
|
|
35
|
-
orderNumber:
|
|
36
|
+
orderNumber: data.object.mainEntity.orderNumber,
|
|
36
37
|
project: { id: params.project.id },
|
|
37
38
|
inclusion: [
|
|
38
39
|
'orderNumber', 'project', 'customer', 'confirmationNumber',
|
|
@@ -41,28 +42,26 @@ function createAccountingReport(params) {
|
|
|
41
42
|
});
|
|
42
43
|
const simpleOrder = {
|
|
43
44
|
typeOf: order.typeOf,
|
|
44
|
-
// seller: {
|
|
45
|
-
// id: order.seller.id,
|
|
46
|
-
// typeOf: order.seller.typeOf,
|
|
47
|
-
// name: order.seller.name
|
|
48
|
-
// }, // 廃止(2024-03-06~)
|
|
49
|
-
// customer: { typeOf: order.customer.typeOf, id: order.customer.id }, // 廃止(2024-03-06~)
|
|
50
45
|
orderNumber: order.orderNumber,
|
|
51
|
-
// price: order.price,
|
|
52
|
-
// priceCurrency: order.priceCurrency,
|
|
53
46
|
orderDate: order.orderDate
|
|
54
47
|
};
|
|
48
|
+
const actionObject = {
|
|
49
|
+
// ...params,
|
|
50
|
+
mainEntity: { orderNumber: simpleOrder.orderNumber },
|
|
51
|
+
typeOf: 'Report'
|
|
52
|
+
};
|
|
55
53
|
const actionAttributes = {
|
|
56
54
|
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
57
55
|
typeOf: factory.actionType.CreateAction,
|
|
58
56
|
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
59
|
-
object:
|
|
60
|
-
purpose: simpleOrder
|
|
57
|
+
object: actionObject,
|
|
58
|
+
purpose: simpleOrder,
|
|
59
|
+
sameAs: { id: params.id, typeOf: 'Task' } // add sameAs(2025-09-21~)
|
|
61
60
|
};
|
|
62
61
|
const action = yield repos.action.start(actionAttributes);
|
|
63
62
|
try {
|
|
64
63
|
const acceptedOffers = yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
65
|
-
orderNumber: { $eq:
|
|
64
|
+
orderNumber: { $eq: data.object.mainEntity.orderNumber },
|
|
66
65
|
project: { id: { $eq: params.project.id } }
|
|
67
66
|
});
|
|
68
67
|
yield (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)(Object.assign(Object.assign({}, order), { acceptedOffers }))(repos);
|
|
@@ -76,6 +75,7 @@ function createAccountingReport(params) {
|
|
|
76
75
|
}
|
|
77
76
|
throw error;
|
|
78
77
|
}
|
|
79
|
-
|
|
78
|
+
const result = {};
|
|
79
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -10,7 +10,7 @@ import type { ScheduleRepo } from '../../../repo/schedule';
|
|
|
10
10
|
import type { SettingRepo } from '../../../repo/setting';
|
|
11
11
|
import type { TaskRepo } from '../../../repo/task';
|
|
12
12
|
import * as factory from '../../../factory';
|
|
13
|
-
export declare function createEventBySchedule(params: factory.task.createEvent.
|
|
13
|
+
export declare function createEventBySchedule(params: factory.task.createEvent.IAddEventByScheduleAction): (repos: {
|
|
14
14
|
action: ActionRepo;
|
|
15
15
|
event: EventRepo;
|
|
16
16
|
eventSeries: EventSeriesRepo;
|
|
@@ -34,9 +34,10 @@ function updateEvent4ttts(params) {
|
|
|
34
34
|
// replacee: reservation,
|
|
35
35
|
// replacer: params.attributes, // $unsetもありうるのでいったん保留
|
|
36
36
|
targetCollection: {
|
|
37
|
-
id: params.attributes.identifier,
|
|
37
|
+
// id: params.attributes.identifier,
|
|
38
38
|
typeOf: factory.eventType.ScreeningEvent
|
|
39
|
-
}
|
|
39
|
+
},
|
|
40
|
+
instrument: { typeOf: 'Task' }
|
|
40
41
|
};
|
|
41
42
|
const action = yield repos.action.start(actionAttributes);
|
|
42
43
|
let savedEvent;
|
|
@@ -4,7 +4,7 @@ import type { EventRepo } from '../../../repo/event';
|
|
|
4
4
|
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
5
5
|
import type { MovieTheaterRepo } from '../../../repo/place/movieTheater';
|
|
6
6
|
import type { TaskRepo } from '../../../repo/task';
|
|
7
|
-
export declare function createEventSeries(params: factory.task.createEvent.
|
|
7
|
+
export declare function createEventSeries(params: factory.task.createEvent.IAddEventSeriesAction): (repos: {
|
|
8
8
|
action: ActionRepo;
|
|
9
9
|
event: EventRepo;
|
|
10
10
|
eventSeries: EventSeriesRepo;
|
|
@@ -95,17 +95,18 @@ function deleteById(params, setting) {
|
|
|
95
95
|
// tslint:disable-next-line:max-func-body-length
|
|
96
96
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
97
97
|
var _a;
|
|
98
|
+
const deleteObject = {
|
|
99
|
+
id: params.id,
|
|
100
|
+
typeOf: factory.personType.Person,
|
|
101
|
+
migrate: params.migrate,
|
|
102
|
+
physically: params.physically
|
|
103
|
+
// discontinue(2025-03-29~)
|
|
104
|
+
// ...(typeof params.migratePersonRecipientUrl === 'string')
|
|
105
|
+
// ? { migratePersonRecipientUrl: params.migratePersonRecipientUrl } : undefined
|
|
106
|
+
};
|
|
98
107
|
const deleteMemberAction = {
|
|
99
108
|
agent: params.agent,
|
|
100
|
-
object:
|
|
101
|
-
id: params.id,
|
|
102
|
-
typeOf: factory.personType.Person,
|
|
103
|
-
migrate: params.migrate,
|
|
104
|
-
physically: params.physically
|
|
105
|
-
// discontinue(2025-03-29~)
|
|
106
|
-
// ...(typeof params.migratePersonRecipientUrl === 'string')
|
|
107
|
-
// ? { migratePersonRecipientUrl: params.migratePersonRecipientUrl } : undefined
|
|
108
|
-
},
|
|
109
|
+
object: deleteObject,
|
|
109
110
|
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
110
111
|
typeOf: factory.actionType.DeleteAction
|
|
111
112
|
};
|
|
@@ -386,7 +387,7 @@ function createDeleteTransactionTask(params) {
|
|
|
386
387
|
executionResults: [],
|
|
387
388
|
data: {
|
|
388
389
|
object: {
|
|
389
|
-
specifyingMethod: factory.
|
|
390
|
+
specifyingMethod: factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.AgentId,
|
|
390
391
|
agent: { id: params.id },
|
|
391
392
|
project: { id: params.project.id },
|
|
392
393
|
typeOf: transactionType
|
|
@@ -7,6 +7,7 @@ import type { CreativeWorkRepo } from '../../../repo/creativeWork';
|
|
|
7
7
|
import type { EventRepo } from '../../../repo/event';
|
|
8
8
|
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
9
9
|
import type { MemberRepo } from '../../../repo/member';
|
|
10
|
+
import type { NoteRepo } from '../../../repo/note';
|
|
10
11
|
import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
|
|
11
12
|
import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
12
13
|
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
@@ -16,7 +17,6 @@ import type { MovieTheaterRepo } from '../../../repo/place/movieTheater';
|
|
|
16
17
|
import type { ScreeningRoomRepo } from '../../../repo/place/screeningRoom';
|
|
17
18
|
import type { ProductRepo } from '../../../repo/product';
|
|
18
19
|
import type { ProductModelRepo } from '../../../repo/productModel';
|
|
19
|
-
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
20
20
|
import type { SettingRepo } from '../../../repo/setting';
|
|
21
21
|
import type { TaskRepo } from '../../../repo/task';
|
|
22
22
|
export declare function onResourceDeleted(params: factory.task.onResourceUpdated.IData): (repos: {
|
|
@@ -30,6 +30,7 @@ export declare function onResourceDeleted(params: factory.task.onResourceUpdated
|
|
|
30
30
|
hasPOS: HasPOSRepo;
|
|
31
31
|
member: MemberRepo;
|
|
32
32
|
movieTheater: MovieTheaterRepo;
|
|
33
|
+
note: NoteRepo;
|
|
33
34
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
34
35
|
offer: OfferRepo;
|
|
35
36
|
offerCatalog: OfferCatalogRepo;
|
|
@@ -37,7 +38,6 @@ export declare function onResourceDeleted(params: factory.task.onResourceUpdated
|
|
|
37
38
|
screeningRoom: ScreeningRoomRepo;
|
|
38
39
|
product: ProductRepo;
|
|
39
40
|
productModel: ProductModelRepo;
|
|
40
|
-
productOffer: ProductOfferRepo;
|
|
41
41
|
setting: SettingRepo;
|
|
42
42
|
task: TaskRepo;
|
|
43
43
|
}) => Promise<void>;
|
|
@@ -252,11 +252,12 @@ function deleteResourcesBySeller(params) {
|
|
|
252
252
|
project: { id: params.project.id },
|
|
253
253
|
id: sellerId
|
|
254
254
|
});
|
|
255
|
+
// productsドキュメント参照のoffers検証は廃止(2025-09-22~)
|
|
255
256
|
// プロダクトオファー削除
|
|
256
|
-
const deleteProductOfferResult =
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
});
|
|
257
|
+
// const deleteProductOfferResult = await repos.productOffer.deleteManyBySellerId({
|
|
258
|
+
// project: { id: params.project.id },
|
|
259
|
+
// seller: { id: sellerId }
|
|
260
|
+
// });
|
|
260
261
|
// イベント削除
|
|
261
262
|
const deleteEventResult = yield repos.event.deleteManyEventByOrganizerId({
|
|
262
263
|
project: { id: params.project.id },
|
|
@@ -278,7 +279,8 @@ function deleteResourcesBySeller(params) {
|
|
|
278
279
|
parentOrganization: { id: sellerId }
|
|
279
280
|
});
|
|
280
281
|
deleteResult = {
|
|
281
|
-
deleteMemberResult, deletePaymentServiceProviderResult,
|
|
282
|
+
deleteMemberResult, deletePaymentServiceProviderResult,
|
|
283
|
+
// deleteProductOfferResult,
|
|
282
284
|
deleteEventResult, deleteEventSeriesResult, deleteScreeningRoomResult, deleteMovieTheaterResult
|
|
283
285
|
};
|
|
284
286
|
}
|
|
@@ -414,6 +416,7 @@ function deleteResourcesByProduct(params) {
|
|
|
414
416
|
try {
|
|
415
417
|
let deleteEventResult;
|
|
416
418
|
let updateOfferResult;
|
|
419
|
+
let deleteNoteResult;
|
|
417
420
|
// 興行を設定されたイベント削除
|
|
418
421
|
deleteEventResult = yield repos.event.deleteManyEventsByItemOfferedId({
|
|
419
422
|
project: { id: params.project.id },
|
|
@@ -424,7 +427,11 @@ function deleteResourcesByProduct(params) {
|
|
|
424
427
|
project: { id: params.project.id },
|
|
425
428
|
addOn: { itemOffered: { id: { $in: [productId] } } }
|
|
426
429
|
});
|
|
427
|
-
|
|
430
|
+
// メモを削除(2025-09-18~)
|
|
431
|
+
deleteNoteResult = yield repos.note.deleteNotesByAbout({
|
|
432
|
+
about: { id: productId, typeOf: params.typeOf }
|
|
433
|
+
});
|
|
434
|
+
deleteResult = { deleteEventResult, updateOfferResult, deleteNoteResult };
|
|
428
435
|
}
|
|
429
436
|
catch (error) {
|
|
430
437
|
try {
|
|
@@ -29,7 +29,6 @@ const movieTheater_1 = require("../../repo/place/movieTheater");
|
|
|
29
29
|
const screeningRoom_1 = require("../../repo/place/screeningRoom");
|
|
30
30
|
const product_1 = require("../../repo/product");
|
|
31
31
|
const productModel_1 = require("../../repo/productModel");
|
|
32
|
-
const productOffer_1 = require("../../repo/productOffer");
|
|
33
32
|
const setting_1 = require("../../repo/setting");
|
|
34
33
|
const task_1 = require("../../repo/task");
|
|
35
34
|
const onAggregateOfferUpdated_1 = require("./onResourceUpdated/onAggregateOfferUpdated");
|
|
@@ -61,7 +60,7 @@ function call(data) {
|
|
|
61
60
|
screeningRoom: new screeningRoom_1.ScreeningRoomRepo(connection),
|
|
62
61
|
product: new product_1.ProductRepo(connection),
|
|
63
62
|
productModel: new productModel_1.ProductModelRepo(connection),
|
|
64
|
-
productOffer: new
|
|
63
|
+
// productOffer: new ProductOfferRepo(connection),
|
|
65
64
|
setting: new setting_1.SettingRepo(connection),
|
|
66
65
|
task: new task_1.TaskRepo(connection)
|
|
67
66
|
});
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = call;
|
|
13
|
-
const factory = require("../../factory");
|
|
14
13
|
const action_1 = require("../../repo/action");
|
|
15
14
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
15
|
const authorization_1 = require("../../repo/authorization");
|
|
@@ -31,7 +30,7 @@ function call(data) {
|
|
|
31
30
|
instrument = data.instrument;
|
|
32
31
|
}
|
|
33
32
|
else {
|
|
34
|
-
if (((_b = data.instrument) === null || _b === void 0 ? void 0 : _b.typeOf) ===
|
|
33
|
+
if (((_b = data.instrument) === null || _b === void 0 ? void 0 : _b.typeOf) === 'Ticket') {
|
|
35
34
|
instrument = [data.instrument];
|
|
36
35
|
}
|
|
37
36
|
}
|
|
@@ -50,6 +50,8 @@ function executeTask(task, next) {
|
|
|
50
50
|
case factory.taskName.AuthorizePayment:
|
|
51
51
|
case factory.taskName.CancelPendingReservation:
|
|
52
52
|
case factory.taskName.CheckMovieTicket:
|
|
53
|
+
case factory.taskName.CheckResource:
|
|
54
|
+
case factory.taskName.CreateAccountingReport:
|
|
53
55
|
case factory.taskName.DeletePerson:
|
|
54
56
|
case factory.taskName.HandleNotification:
|
|
55
57
|
case factory.taskName.ImportEventCapacitiesFromCOA:
|
|
@@ -19,7 +19,7 @@ const deleteOrder_1 = require("../order/deleteOrder");
|
|
|
19
19
|
function deleteTransaction(params) {
|
|
20
20
|
// tslint:disable-next-line:max-func-body-length
|
|
21
21
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
if (params.object.specifyingMethod === factory.
|
|
22
|
+
if (params.object.specifyingMethod === factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.AgentId) {
|
|
23
23
|
// transaction.agent.id指定による取引削除に対応(2023-06-30~)
|
|
24
24
|
yield createDeleteTransactionTasksByAgentId(params)(repos);
|
|
25
25
|
}
|
|
@@ -31,8 +31,8 @@ function deleteTransaction(params) {
|
|
|
31
31
|
function createDeleteTransactionTasksByAgentId(params) {
|
|
32
32
|
// tslint:disable-next-line:max-func-body-length
|
|
33
33
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
if (params.object.specifyingMethod !== factory.
|
|
35
|
-
throw new factory.errors.Argument('object.specifyingMethod', `must be ${factory.
|
|
34
|
+
if (params.object.specifyingMethod !== factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.AgentId) {
|
|
35
|
+
throw new factory.errors.Argument('object.specifyingMethod', `must be ${factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.AgentId}`);
|
|
36
36
|
}
|
|
37
37
|
const agentIdSpecified = params.object.agent.id;
|
|
38
38
|
// agentIdによる全取引についてDeleteTransactionタスクを作成する
|
|
@@ -61,7 +61,7 @@ function createDeleteTransactionTasksByAgentId(params) {
|
|
|
61
61
|
numberOfTried: 0,
|
|
62
62
|
executionResults: [],
|
|
63
63
|
data: {
|
|
64
|
-
object: Object.assign({ specifyingMethod: factory.
|
|
64
|
+
object: Object.assign({ specifyingMethod: factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id, id: transaction.id, object: Object.assign(Object.assign({}, (typeof transaction.object.confirmationNumber === 'string')
|
|
65
65
|
? { confirmationNumber: transaction.object.confirmationNumber }
|
|
66
66
|
: undefined), (typeof transaction.object.orderNumber === 'string')
|
|
67
67
|
? { orderNumber: transaction.object.orderNumber }
|
|
@@ -81,7 +81,7 @@ function createDeleteTransactionTasksByAgentId(params) {
|
|
|
81
81
|
numberOfTried: 0,
|
|
82
82
|
executionResults: [],
|
|
83
83
|
data: {
|
|
84
|
-
object: Object.assign({ specifyingMethod: factory.
|
|
84
|
+
object: Object.assign({ specifyingMethod: factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id, id: transaction.id, object: {
|
|
85
85
|
order: transaction.object.order
|
|
86
86
|
}, project: transaction.project, startDate: transaction.startDate, typeOf: transaction.typeOf }, (transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined)
|
|
87
87
|
}
|
|
@@ -99,7 +99,7 @@ function createDeleteTransactionTasksByAgentId(params) {
|
|
|
99
99
|
numberOfTried: 0,
|
|
100
100
|
executionResults: [],
|
|
101
101
|
data: {
|
|
102
|
-
object: Object.assign({ specifyingMethod: factory.
|
|
102
|
+
object: Object.assign({ specifyingMethod: factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id, id: transaction.id, object: Object.assign({}, (transaction.object.pendingTransaction !== undefined)
|
|
103
103
|
? { pendingTransaction: transaction.object.pendingTransaction }
|
|
104
104
|
: undefined), project: transaction.project, startDate: transaction.startDate, typeOf: transaction.typeOf }, (transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined)
|
|
105
105
|
}
|
|
@@ -120,8 +120,8 @@ function deleteTransactionById(params) {
|
|
|
120
120
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
121
121
|
var _a;
|
|
122
122
|
if (typeof params.object.specifyingMethod === 'string'
|
|
123
|
-
&& params.object.specifyingMethod !== factory.
|
|
124
|
-
throw new factory.errors.Argument('object.specifyingMethod', `must be ${factory.
|
|
123
|
+
&& params.object.specifyingMethod !== factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id) {
|
|
124
|
+
throw new factory.errors.Argument('object.specifyingMethod', `must be ${factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id}`);
|
|
125
125
|
}
|
|
126
126
|
const deletingTransactionId = params.object.id;
|
|
127
127
|
if (typeof deletingTransactionId !== 'string' || deletingTransactionId.length === 0) {
|
|
@@ -364,7 +364,7 @@ function deleteMessagesByPlaceOrder(params) {
|
|
|
364
364
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
365
365
|
let deleteResult;
|
|
366
366
|
if (params.transaction.typeOf === factory.transactionType.PlaceOrder
|
|
367
|
-
&& params.transaction.specifyingMethod === factory.
|
|
367
|
+
&& params.transaction.specifyingMethod === factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id) {
|
|
368
368
|
const orderNumber = params.transaction.object.orderNumber;
|
|
369
369
|
if (typeof orderNumber === 'string' && orderNumber.length > 0) {
|
|
370
370
|
const deleteReservationsResult = yield repos.message.deleteByMainEntityOrderNumber({
|
|
@@ -53,7 +53,7 @@ function createTasks(params, setting
|
|
|
53
53
|
numberOfTried: 0,
|
|
54
54
|
executionResults: [],
|
|
55
55
|
data: {
|
|
56
|
-
object: Object.assign({ specifyingMethod: factory.
|
|
56
|
+
object: Object.assign({ specifyingMethod: factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id, id: transaction.id, object: Object.assign({}, (transaction.object.pendingTransaction !== undefined)
|
|
57
57
|
? { pendingTransaction: transaction.object.pendingTransaction }
|
|
58
58
|
: undefined), project: transaction.project, startDate: transaction.startDate, typeOf: transaction.typeOf }, (transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined)
|
|
59
59
|
}
|
|
@@ -87,7 +87,7 @@ function createTasks(params, setting
|
|
|
87
87
|
numberOfTried: 0,
|
|
88
88
|
executionResults: [],
|
|
89
89
|
data: {
|
|
90
|
-
object: Object.assign({ specifyingMethod: factory.
|
|
90
|
+
object: Object.assign({ specifyingMethod: factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id, id: transaction.id, object: Object.assign(Object.assign({}, (typeof transaction.object.confirmationNumber === 'string')
|
|
91
91
|
? { confirmationNumber: transaction.object.confirmationNumber }
|
|
92
92
|
: undefined), (typeof transaction.object.orderNumber === 'string')
|
|
93
93
|
? { orderNumber: transaction.object.orderNumber }
|
|
@@ -53,7 +53,7 @@ function createTasks(params, setting
|
|
|
53
53
|
numberOfTried: 0,
|
|
54
54
|
executionResults: [],
|
|
55
55
|
data: {
|
|
56
|
-
object: Object.assign({ specifyingMethod: factory.
|
|
56
|
+
object: Object.assign({ specifyingMethod: factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id, id: transaction.id, object: {
|
|
57
57
|
order: transaction.object.order
|
|
58
58
|
}, project: transaction.project, startDate: transaction.startDate, typeOf: transaction.typeOf }, (transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined)
|
|
59
59
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "4.399.0-alpha.
|
|
14
|
+
"@chevre/factory": "4.399.0-alpha.18",
|
|
15
15
|
"@cinerino/sdk": "12.2.0",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "22.14.0-alpha.
|
|
118
|
+
"version": "22.14.0-alpha.21"
|
|
119
119
|
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
const IDENTIFIER = 'xxx';
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
-
|
|
12
|
-
// const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
13
|
-
const eventOfferRepo = await chevre.repository.EventOffer.createInstance(mongoose.connection);
|
|
14
|
-
|
|
15
|
-
let docs = await eventOfferRepo.projectFields(
|
|
16
|
-
{
|
|
17
|
-
project: { id: { $eq: project.id } },
|
|
18
|
-
identifier: { $eq: IDENTIFIER }
|
|
19
|
-
},
|
|
20
|
-
['availableAtOrFrom', 'identifier', 'itemOffered', 'project', 'validFrom']
|
|
21
|
-
);
|
|
22
|
-
console.log('docs:', docs);
|
|
23
|
-
console.log(docs.length, 'docs found');
|
|
24
|
-
|
|
25
|
-
if (docs.length > 0) {
|
|
26
|
-
await eventOfferRepo.deleteById({
|
|
27
|
-
project: { id: docs[0].project.id },
|
|
28
|
-
id: docs[0].id
|
|
29
|
-
});
|
|
30
|
-
console.log('deleted', docs[0].id);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
await eventOfferRepo.save({
|
|
34
|
-
attributes: {
|
|
35
|
-
identifier: IDENTIFIER,
|
|
36
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
37
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
38
|
-
itemOffered: {
|
|
39
|
-
id: 'xxxxx',
|
|
40
|
-
typeOf: chevre.factory.eventType.ScreeningEvent
|
|
41
|
-
},
|
|
42
|
-
seller: {
|
|
43
|
-
id: 'xxxxx',
|
|
44
|
-
typeOf: chevre.factory.organizationType.Organization
|
|
45
|
-
},
|
|
46
|
-
availableAtOrFrom: { id: 'xxx' },
|
|
47
|
-
validFrom: new Date(),
|
|
48
|
-
validThrough: new Date(),
|
|
49
|
-
validForMemberTier: { identifier: 'xxx', typeOf: 'MemberProgramTier' }
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
console.log('created.');
|
|
53
|
-
|
|
54
|
-
docs = await await eventOfferRepo.projectFields(
|
|
55
|
-
{
|
|
56
|
-
project: { id: { $eq: project.id } },
|
|
57
|
-
identifier: { $eq: IDENTIFIER }
|
|
58
|
-
},
|
|
59
|
-
['availableAtOrFrom', 'identifier', 'itemOffered', 'project', 'validFrom']
|
|
60
|
-
);
|
|
61
|
-
console.log('docs:', docs);
|
|
62
|
-
console.log(docs.length, 'docs found');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
main()
|
|
66
|
-
.then()
|
|
67
|
-
.catch(console.error);
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
const STORAGE_PERIOD_IN_DAYS = 30;
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
15
|
-
const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
|
|
16
|
-
|
|
17
|
-
const cursor = taskRepo.getCursor(
|
|
18
|
-
{
|
|
19
|
-
name: { $eq: chevre.factory.taskName.DeleteTransaction },
|
|
20
|
-
status: { $eq: chevre.factory.taskStatus.Ready }
|
|
21
|
-
// runsAt: {
|
|
22
|
-
// $gte: moment()
|
|
23
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
24
|
-
// .add(29, 'days')
|
|
25
|
-
// .toDate(),
|
|
26
|
-
// $lte: moment()
|
|
27
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
28
|
-
// .add(365, 'days')
|
|
29
|
-
// .toDate()
|
|
30
|
-
// },
|
|
31
|
-
// _id: { $eq: '6440d8cf9e4983c32ade65de' }
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
_id: 1,
|
|
35
|
-
project: 1,
|
|
36
|
-
data: 1,
|
|
37
|
-
status: 1,
|
|
38
|
-
name: 1,
|
|
39
|
-
runsAt: 1
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
console.log('tasks found');
|
|
43
|
-
|
|
44
|
-
let i = 0;
|
|
45
|
-
let updateCount = 0;
|
|
46
|
-
await cursor.eachAsync(async (doc) => {
|
|
47
|
-
i += 1;
|
|
48
|
-
const deleteTransactionTask: Pick<
|
|
49
|
-
chevre.factory.task.deleteTransaction.ITask,
|
|
50
|
-
'id' | 'project' | 'data' | 'status' | 'name' | 'runsAt'
|
|
51
|
-
> = doc.toObject();
|
|
52
|
-
|
|
53
|
-
let placeOrderTransactionId: string | undefined;
|
|
54
|
-
if (deleteTransactionTask.data.object.typeOf === chevre.factory.transactionType.PlaceOrder) {
|
|
55
|
-
if (
|
|
56
|
-
(typeof deleteTransactionTask.data.object.specifyingMethod !== 'string')
|
|
57
|
-
|| (deleteTransactionTask.data.object.specifyingMethod === chevre.factory.task.deleteTransaction.SpecifyingMethod.Id)
|
|
58
|
-
) {
|
|
59
|
-
placeOrderTransactionId = deleteTransactionTask.data.object.id;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
let alreadyMigrated = true;
|
|
64
|
-
let runsAtExpected: moment.Moment | undefined;
|
|
65
|
-
if (typeof placeOrderTransactionId === 'string') {
|
|
66
|
-
console.log(
|
|
67
|
-
'checking transaction...',
|
|
68
|
-
deleteTransactionTask.project.id, deleteTransactionTask.name, deleteTransactionTask.id, deleteTransactionTask.runsAt,
|
|
69
|
-
placeOrderTransactionId
|
|
70
|
-
);
|
|
71
|
-
const placeOrderTransaction = (await transactionRepo.projectFields({
|
|
72
|
-
limit: 1,
|
|
73
|
-
page: 1,
|
|
74
|
-
typeOf: chevre.factory.transactionType.PlaceOrder,
|
|
75
|
-
ids: [placeOrderTransactionId],
|
|
76
|
-
inclusion: ['endDate', 'status']
|
|
77
|
-
})).shift();
|
|
78
|
-
if (placeOrderTransaction !== undefined) {
|
|
79
|
-
const { endDate, status } = placeOrderTransaction;
|
|
80
|
-
runsAtExpected = moment(endDate)
|
|
81
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
82
|
-
.add(STORAGE_PERIOD_IN_DAYS, 'days');
|
|
83
|
-
|
|
84
|
-
// if (status !== chevre.factory.transactionStatusType.Confirmed) {
|
|
85
|
-
const taskRunsTooLate = moment(deleteTransactionTask.runsAt)
|
|
86
|
-
.isAfter(runsAtExpected);
|
|
87
|
-
const diff = moment(deleteTransactionTask.runsAt)
|
|
88
|
-
.diff(moment(endDate));
|
|
89
|
-
console.log('taskRunsTooLate?:', taskRunsTooLate, placeOrderTransactionId, endDate, status, diff.toLocaleString());
|
|
90
|
-
if (taskRunsTooLate) {
|
|
91
|
-
alreadyMigrated = false;
|
|
92
|
-
}
|
|
93
|
-
// }
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (alreadyMigrated) {
|
|
98
|
-
console.log(
|
|
99
|
-
'already migrated.',
|
|
100
|
-
deleteTransactionTask.project.id, deleteTransactionTask.name, deleteTransactionTask.id, deleteTransactionTask.runsAt,
|
|
101
|
-
i, updateCount);
|
|
102
|
-
} else {
|
|
103
|
-
console.log(
|
|
104
|
-
'updating...',
|
|
105
|
-
deleteTransactionTask.project.id, deleteTransactionTask.name, deleteTransactionTask.id, deleteTransactionTask.runsAt,
|
|
106
|
-
i, updateCount, runsAtExpected);
|
|
107
|
-
if (runsAtExpected !== undefined) {
|
|
108
|
-
await taskRepo.taskModel.findByIdAndUpdate(
|
|
109
|
-
deleteTransactionTask.id,
|
|
110
|
-
{
|
|
111
|
-
$set: {
|
|
112
|
-
runsAt: runsAtExpected.toDate()
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
)
|
|
116
|
-
.exec();
|
|
117
|
-
}
|
|
118
|
-
updateCount += 1;
|
|
119
|
-
console.log(
|
|
120
|
-
'updated.',
|
|
121
|
-
deleteTransactionTask.project.id, deleteTransactionTask.name, deleteTransactionTask.id, deleteTransactionTask.runsAt,
|
|
122
|
-
i, updateCount, runsAtExpected);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
console.log(i, 'tasks checked');
|
|
127
|
-
console.log(updateCount, 'tasks updated');
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
main()
|
|
131
|
-
.then()
|
|
132
|
-
.catch(console.error);
|