@chevre/domain 23.0.0-alpha.3 → 23.0.0-alpha.30
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/assetTransaction/processReserve.ts +102 -40
- package/example/src/chevre/categoryCode/checkUniqueness.ts +69 -0
- package/example/src/chevre/event/checkEventAdditionalPropertyUniqueness.ts +108 -0
- package/example/src/chevre/event/migrateEventAdditionalProperty2identifier.ts +121 -0
- package/example/src/chevre/event/updateSellerMakesOffersByIdentifier.ts +106 -0
- package/example/src/chevre/note/findNotes.ts +34 -0
- package/example/src/chevre/note/upsertNotesByIdentifier.ts +10 -5
- package/example/src/chevre/offerCatalog/updateManyOfferCatalogsByIds.ts +49 -0
- package/example/src/chevre/paymentServices/findPaymentServices.ts +37 -0
- package/example/src/chevre/product/findHasOfferCatalog.ts +31 -0
- package/example/src/chevre/reIndex.ts +2 -3
- package/example/src/chevre/roles/addAdminNotePermissionIfNotExists.ts +48 -0
- package/example/src/chevre/roles/{addAdminProductOfferPermissionIfNotExists.ts → addAdminPaymentServiceReadPermissionIfNotExists.ts} +20 -19
- package/example/src/chevre/roles/addAdminProductHasOfferCatalogReadPermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminSellerEventIfNotExists.ts +48 -0
- package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +1 -1
- package/example/src/chevre/roles/removePermissionIfExists.ts +1 -6
- package/example/src/chevre/unsetUnnecessaryFields.ts +5 -7
- package/example/src/objectId.ts +12 -0
- package/example/src/signPayload.ts +12 -7
- package/lib/chevre/errorHandler.d.ts +6 -2
- package/lib/chevre/errorHandler.js +18 -2
- package/lib/chevre/repo/categoryCode.d.ts +26 -14
- package/lib/chevre/repo/categoryCode.js +53 -42
- package/lib/chevre/repo/event.d.ts +25 -11
- package/lib/chevre/repo/event.js +60 -35
- package/lib/chevre/repo/eventSellerMakesOffer.d.ts +24 -39
- package/lib/chevre/repo/eventSellerMakesOffer.js +88 -43
- package/lib/chevre/repo/issuer.js +9 -5
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +48 -42
- package/lib/chevre/repo/mongoose/schemas/movieTicketTypes.d.ts +10 -0
- package/lib/chevre/repo/mongoose/schemas/movieTicketTypes.js +107 -0
- package/lib/chevre/repo/mongoose/schemas/note.js +9 -0
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +4 -4
- package/lib/chevre/repo/mongoose/schemas/product.js +2 -2
- package/lib/chevre/repo/movieTicketType.d.ts +57 -0
- package/lib/chevre/repo/movieTicketType.js +253 -0
- package/lib/chevre/repo/note.d.ts +2 -9
- package/lib/chevre/repo/note.js +52 -18
- package/lib/chevre/repo/noteAboutOrder.d.ts +4 -0
- package/lib/chevre/repo/noteAboutOrder.js +17 -0
- package/lib/chevre/repo/offerCatalog.d.ts +17 -2
- package/lib/chevre/repo/offerCatalog.js +5 -2
- package/lib/chevre/repo/product.js +15 -14
- package/lib/chevre/repo/productHasOfferCatalog.d.ts +43 -0
- package/lib/chevre/repo/productHasOfferCatalog.js +71 -0
- package/lib/chevre/repository.d.ts +10 -0
- package/lib/chevre/repository.js +28 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +15 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +159 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +16 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +184 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +4 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +25 -138
- package/lib/chevre/service/event.js +1 -1
- package/lib/chevre/service/offer/event/importFromCOA.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +3 -3
- package/lib/chevre/service/offer/onEventChanged.js +26 -30
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +39 -0
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.js +86 -0
- package/lib/chevre/service/payment/any/{handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts → authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts} +4 -4
- package/lib/chevre/service/payment/any/{handlePrePublishedPaymentMethodIdOnAuthorizing.js → authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js} +1 -1
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.d.ts +25 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.js +51 -0
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +2 -2
- package/lib/chevre/service/payment/any.js +91 -70
- package/lib/chevre/service/project.d.ts +3 -0
- package/lib/chevre/service/project.js +2 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +19 -105
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +1 -1
- package/package.json +4 -4
- package/example/src/chevre/aggregateEventSellerMakesOffer.ts +0 -32
- package/example/src/chevre/event/migrateEventIdentifier4ttts.ts +0 -96
- package/example/src/chevre/searchCategoryCodesByAggregate.ts +0 -31
- package/example/src/chevre/searchOfferCatalogItems.ts +0 -59
- package/example/src/chevre/searchPaymentServices.ts +0 -32
- package/example/src/chevre/unsetUnnecessaryFieldsInAction.ts +0 -50
- package/example/src/chevre/unsetUnnecessaryFieldsInTransaction.ts +0 -46
|
@@ -23,14 +23,14 @@ const factory = require("../../factory");
|
|
|
23
23
|
// import type { TransactionProcessRepo } from '../../repo/transactionProcess';
|
|
24
24
|
const PayTransactionService = require("../assetTransaction/pay");
|
|
25
25
|
const publishOrderNumberIfNotExist_1 = require("../transaction/placeOrder/publishOrderNumberIfNotExist");
|
|
26
|
+
const fixTransactionNumber_1 = require("./any/authorize/fixTransactionNumber");
|
|
27
|
+
const fixTransactionNumberOnPublishPaymentUrl_1 = require("./any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl");
|
|
26
28
|
const factory_1 = require("./any/factory");
|
|
27
29
|
const fixOrderAsNeeded_1 = require("./any/fixOrderAsNeeded");
|
|
28
|
-
const handlePrePublishedPaymentMethodIdOnAuthorizing_1 = require("./any/handlePrePublishedPaymentMethodIdOnAuthorizing");
|
|
29
30
|
const onPaymentStatusChanged_1 = require("./any/onPaymentStatusChanged");
|
|
30
31
|
Object.defineProperty(exports, "onPaymentStatusChanged", { enumerable: true, get: function () { return onPaymentStatusChanged_1.onPaymentStatusChanged; } });
|
|
31
32
|
const person2username_1 = require("./any/person2username");
|
|
32
33
|
Object.defineProperty(exports, "person2username", { enumerable: true, get: function () { return person2username_1.person2username; } });
|
|
33
|
-
const verifyTicketTokenAsNeeded_1 = require("./any/verifyTicketTokenAsNeeded");
|
|
34
34
|
/**
|
|
35
35
|
* 決済承認中止
|
|
36
36
|
* タスクから決済承認を取り消す
|
|
@@ -319,7 +319,9 @@ function processVoidPayTransaction(params) {
|
|
|
319
319
|
/**
|
|
320
320
|
* 外部決済ロケーションを発行する
|
|
321
321
|
*/
|
|
322
|
+
// tslint:disable-next-line:max-func-body-length
|
|
322
323
|
function publishPaymentUrl(params) {
|
|
324
|
+
// tslint:disable-next-line:max-func-body-length
|
|
323
325
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
324
326
|
var _a;
|
|
325
327
|
const { paymentServiceType, purpose, project } = params;
|
|
@@ -328,6 +330,9 @@ function publishPaymentUrl(params) {
|
|
|
328
330
|
}
|
|
329
331
|
try {
|
|
330
332
|
const transaction = yield repos.transaction.projectFieldsInProgressById({ typeOf: purpose.typeOf, id: purpose.id }, ['expires', 'seller', 'project']);
|
|
333
|
+
if (project.id !== transaction.project.id) {
|
|
334
|
+
throw new factory.errors.NotFound(factory.transactionType.PlaceOrder);
|
|
335
|
+
}
|
|
331
336
|
// publishOrderNumber(2025-03-11~)
|
|
332
337
|
yield (0, publishOrderNumberIfNotExist_1.publishOrderNumberIfNotExist)({
|
|
333
338
|
project: { id: transaction.project.id },
|
|
@@ -335,19 +340,25 @@ function publishPaymentUrl(params) {
|
|
|
335
340
|
object: { orderDate: new Date() }
|
|
336
341
|
})(repos);
|
|
337
342
|
// 取引番号生成
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
if (
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
343
|
+
const { transactionNumber } = yield (0, fixTransactionNumberOnPublishPaymentUrl_1.fixTransactionNumberOnPublishPaymentUrl)({
|
|
344
|
+
object: params.object,
|
|
345
|
+
transaction,
|
|
346
|
+
paymentServiceType
|
|
347
|
+
})(repos);
|
|
348
|
+
// let transactionNumber: string | undefined;
|
|
349
|
+
// // support ticketToken(2024-08-21~)
|
|
350
|
+
// const { permitOrInvoice } =
|
|
351
|
+
// await verifyTicketTokenAsNeeded({ project, object: params.object, paymentServiceType, purpose })(repos);
|
|
352
|
+
// if (permitOrInvoice?.typeOf === factory.permit.PermitType.Permit) {
|
|
353
|
+
// const paymentMethodIdByPermit = permitOrInvoice?.identifier;
|
|
354
|
+
// if (typeof paymentMethodIdByPermit === 'string') {
|
|
355
|
+
// transactionNumber = paymentMethodIdByPermit;
|
|
356
|
+
// }
|
|
357
|
+
// }
|
|
358
|
+
// if (typeof transactionNumber !== 'string') {
|
|
359
|
+
// const publishTransactionNumberResult = await repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
360
|
+
// transactionNumber = publishTransactionNumberResult.transactionNumber;
|
|
361
|
+
// }
|
|
351
362
|
let result;
|
|
352
363
|
// URL発行
|
|
353
364
|
const authorizeObject = Object.assign(Object.assign({}, params.object), { accountId: '', paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment });
|
|
@@ -411,67 +422,77 @@ function authorize(params) {
|
|
|
411
422
|
throw new factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
|
|
412
423
|
}
|
|
413
424
|
const transaction = yield repos.transaction.projectFieldsInProgressById({ typeOf: purpose.typeOf, id: purpose.id }, ['agent', 'expires', 'typeOf', 'project', 'seller']);
|
|
425
|
+
if (project.id !== transaction.project.id) {
|
|
426
|
+
throw new factory.errors.NotFound(factory.transactionType.PlaceOrder);
|
|
427
|
+
}
|
|
414
428
|
const { confirmationNumber, orderNumber } = yield (0, fixOrderAsNeeded_1.fixOrderAsNeeded)({
|
|
415
429
|
project: { id: transaction.project.id },
|
|
416
430
|
purpose
|
|
417
431
|
// paymentServiceType
|
|
418
432
|
})(repos);
|
|
419
433
|
// 取引番号生成
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
//
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
//
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
434
|
+
const fixTransactionNumberResult = yield (0, fixTransactionNumber_1.fixTransactionNumber)({
|
|
435
|
+
object: params.object,
|
|
436
|
+
transaction,
|
|
437
|
+
paymentServiceType
|
|
438
|
+
})(repos);
|
|
439
|
+
if (typeof fixTransactionNumberResult.id === 'string') {
|
|
440
|
+
return { id: fixTransactionNumberResult.id };
|
|
441
|
+
}
|
|
442
|
+
const { transactionNumber, pendingPaymentAgencyTransaction, creditCard, permitOrInvoice } = fixTransactionNumberResult;
|
|
443
|
+
// let transactionNumber: string | undefined;
|
|
444
|
+
// let pendingPaymentAgencyTransaction: PayTransactionService.IPaymentAgencyTransaction | undefined;
|
|
445
|
+
// let creditCard: factory.action.authorize.paymentMethod.any.ICreditCard | undefined = params.object.creditCard;
|
|
446
|
+
// // ticketTokenを解釈(2024-08-13~)
|
|
447
|
+
// const { permitOrInvoice } =
|
|
448
|
+
// await verifyTicketTokenAsNeeded({ project, object: params.object, paymentServiceType, purpose })(repos);
|
|
449
|
+
// /**
|
|
450
|
+
// * ticketTokenによって指定された決済方法ID
|
|
451
|
+
// */
|
|
452
|
+
// let paymentMethodIdByTicketToken: string | undefined;
|
|
453
|
+
// if (permitOrInvoice?.typeOf === factory.permit.PermitType.Permit) {
|
|
454
|
+
// paymentMethodIdByTicketToken = permitOrInvoice?.identifier;
|
|
455
|
+
// if (typeof paymentMethodIdByTicketToken === 'string') {
|
|
456
|
+
// transactionNumber = paymentMethodIdByTicketToken; // メンバーシップ指定の場合、取引番号に適用(2024-08-13~)
|
|
457
|
+
// }
|
|
458
|
+
// } else if (permitOrInvoice?.typeOf === 'Invoice') {
|
|
459
|
+
// // support paymentServiceType.MovieTicket(2024-11-23~)
|
|
460
|
+
// if (typeof permitOrInvoice?.paymentMethodId === 'string') {
|
|
461
|
+
// paymentMethodIdByTicketToken = permitOrInvoice?.paymentMethodId;
|
|
462
|
+
// if (typeof paymentMethodIdByTicketToken === 'string') {
|
|
463
|
+
// transactionNumber = paymentMethodIdByTicketToken;
|
|
464
|
+
// }
|
|
465
|
+
// }
|
|
466
|
+
// }
|
|
467
|
+
// // リクエストでpaymentMethodIdを指定された場合、取引に保管されたpaymentMethodIdに一致すればそちらを適用(外部サイト決済対応)
|
|
468
|
+
// if (typeof params.object.paymentMethodId === 'string' && params.object.paymentMethodId.length > 0) {
|
|
469
|
+
// if (typeof paymentMethodIdByTicketToken === 'string') {
|
|
470
|
+
// if (paymentMethodIdByTicketToken !== params.object.paymentMethodId) {
|
|
471
|
+
// throw new factory.errors.Argument('ticketToken', 'not matched with paymentMethodId');
|
|
472
|
+
// }
|
|
473
|
+
// }
|
|
474
|
+
// const { authorizeParams, existingCompletedAuthorizeAction } = await handlePrePublishedPaymentMethodIdOnAuthorizing({
|
|
475
|
+
// object: params.object,
|
|
476
|
+
// prePublishedPaymentMethodId: params.object.paymentMethodId,
|
|
477
|
+
// transaction
|
|
478
|
+
// })(repos);
|
|
479
|
+
// if (existingCompletedAuthorizeAction !== undefined) {
|
|
480
|
+
// return { id: existingCompletedAuthorizeAction.id };
|
|
481
|
+
// } else if (authorizeParams !== undefined) {
|
|
482
|
+
// // creditCardを決済URL発行時の情報で上書き(2024-01-08~)
|
|
483
|
+
// // creditCard = authorizeParams.paymentMethodByTransaction.paymentMethod?.creditCard;
|
|
484
|
+
// creditCard = authorizeParams.creditCard;
|
|
485
|
+
// transactionNumber = params.object.paymentMethodId;
|
|
486
|
+
// pendingPaymentAgencyTransaction = authorizeParams.pendingPaymentAgencyTransaction;
|
|
487
|
+
// } else {
|
|
488
|
+
// throw new factory.errors.NotImplemented('pendingPaymentAgencyTransaction requied on paymentMethodId specified');
|
|
489
|
+
// }
|
|
490
|
+
// }
|
|
491
|
+
// // 取引番号発行済でなければ発行
|
|
492
|
+
// if (typeof transactionNumber !== 'string') {
|
|
493
|
+
// const publishTransactionNumberResult = await repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
494
|
+
// transactionNumber = publishTransactionNumberResult.transactionNumber;
|
|
495
|
+
// }
|
|
475
496
|
const movieTickets = (Array.isArray(params.object.movieTickets)) ? params.object.movieTickets.map(factory_1.createMovieTicket) : undefined;
|
|
476
497
|
const { accountId } = yield fixAccountIdIfPossible({
|
|
477
498
|
object: params.object, project: { id: transaction.project.id }
|
|
@@ -8,6 +8,7 @@ import type { CategoryCodeRepo } from '../repo/categoryCode';
|
|
|
8
8
|
import type { CreativeWorkRepo } from '../repo/creativeWork';
|
|
9
9
|
import type { EventRepo } from '../repo/event';
|
|
10
10
|
import type { MemberRepo } from '../repo/member';
|
|
11
|
+
import type { MovieTicketTypeRepo } from '../repo/movieTicketType';
|
|
11
12
|
import type { OfferRepo } from '../repo/offer/unitPriceInCatalog';
|
|
12
13
|
import type { OfferCatalogRepo } from '../repo/offerCatalog';
|
|
13
14
|
import type { MovieTheaterRepo } from '../repo/place/movieTheater';
|
|
@@ -27,6 +28,7 @@ export declare function deleteProject(params: {
|
|
|
27
28
|
creativeWork: CreativeWorkRepo;
|
|
28
29
|
event: EventRepo;
|
|
29
30
|
member: MemberRepo;
|
|
31
|
+
movieTicketType: MovieTicketTypeRepo;
|
|
30
32
|
offer: OfferRepo;
|
|
31
33
|
offerCatalog: OfferCatalogRepo;
|
|
32
34
|
priceSpecification: PriceSpecificationRepo;
|
|
@@ -48,6 +50,7 @@ export declare function cleanUpDatabaseByProject(params: {
|
|
|
48
50
|
categoryCode: CategoryCodeRepo;
|
|
49
51
|
creativeWork: CreativeWorkRepo;
|
|
50
52
|
event: EventRepo;
|
|
53
|
+
movieTicketType: MovieTicketTypeRepo;
|
|
51
54
|
offer: OfferRepo;
|
|
52
55
|
offerCatalog: OfferCatalogRepo;
|
|
53
56
|
priceSpecification: PriceSpecificationRepo;
|
|
@@ -24,7 +24,8 @@ function cleanUpDatabaseByProject(params) {
|
|
|
24
24
|
yield repos.accountTitle.deleteByProject({ project: { id: params.id } });
|
|
25
25
|
yield repos.action.deleteByProject({ project: { id: params.id } });
|
|
26
26
|
yield repos.assetTransaction.deleteByProject({ project: { id: params.id } });
|
|
27
|
-
yield repos.categoryCode.
|
|
27
|
+
yield repos.categoryCode.deleteCategoryCodesByProject({ project: { id: params.id } });
|
|
28
|
+
yield repos.movieTicketType.deleteMovieTicketTypesByProject({ project: { id: params.id } });
|
|
28
29
|
yield repos.creativeWork.deleteByProject({ project: { id: params.id } });
|
|
29
30
|
yield repos.event.deleteByProject({ project: { id: params.id } });
|
|
30
31
|
yield repos.offerCatalog.deleteByProject({ project: { id: params.id } });
|
|
@@ -4,105 +4,7 @@ exports.tour2creatingEvent = tour2creatingEvent;
|
|
|
4
4
|
exports.schedule2tours = schedule2tours;
|
|
5
5
|
const moment = require("moment-timezone");
|
|
6
6
|
const factory = require("../../../../factory");
|
|
7
|
-
|
|
8
|
-
// function schedule2createEventParams(
|
|
9
|
-
// schedule: factory.schedule.IEventWithSchedule,
|
|
10
|
-
// createDate: Date
|
|
11
|
-
// ): factory.event.screeningEvent.ICreateParams[] {
|
|
12
|
-
// const eventServiceId = schedule.offers?.itemOffered?.id;
|
|
13
|
-
// const makesOffer = schedule.offers?.seller?.makesOffer;
|
|
14
|
-
// const applicationIds: string[] = (Array.isArray(makesOffer))
|
|
15
|
-
// ? makesOffer.map(({ availableAtOrFrom }) => availableAtOrFrom.id)
|
|
16
|
-
// : [];
|
|
17
|
-
// const eventSeriesId = schedule.superEvent?.id;
|
|
18
|
-
// if (typeof eventServiceId !== 'string' || eventServiceId === '') {
|
|
19
|
-
// throw new factory.errors.NotFound('schedule.offers.itemOffered.id');
|
|
20
|
-
// }
|
|
21
|
-
// if (typeof eventSeriesId !== 'string' || eventSeriesId === '') {
|
|
22
|
-
// throw new factory.errors.NotFound('schedule.superEvent.id');
|
|
23
|
-
// }
|
|
24
|
-
// // 引数情報取得
|
|
25
|
-
// if (schedule.eventSchedule === undefined) {
|
|
26
|
-
// throw new factory.errors.NotFound('eventSchedule');
|
|
27
|
-
// }
|
|
28
|
-
// const targetInfo = getTargetInfoByEventWithSchedule(schedule, createDate);
|
|
29
|
-
// debug(targetInfo.length, 'targetInfos ->', targetInfo);
|
|
30
|
-
// const createParams: factory.event.screeningEvent.ICreateParams[] = [];
|
|
31
|
-
// for (const performanceInfo of targetInfo) {
|
|
32
|
-
// const oldEventId = [
|
|
33
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
34
|
-
// performanceInfo.day.slice(-6),
|
|
35
|
-
// workPerformedIdentifier,
|
|
36
|
-
// movieTheater.branchCode,
|
|
37
|
-
// screeningRoom.branchCode,
|
|
38
|
-
// performanceInfo.start_time
|
|
39
|
-
// ].join('');
|
|
40
|
-
// const maxValue = movieTheater.offers?.eligibleQuantity?.maxValue;
|
|
41
|
-
// const availabilityEnds: Date = moment(performanceInfo.end_date)
|
|
42
|
-
// .tz('Asia/Tokyo')
|
|
43
|
-
// .endOf('date')
|
|
44
|
-
// .toDate();
|
|
45
|
-
// const availabilityStarts: Date = moment(performanceInfo.start_date)
|
|
46
|
-
// .tz('Asia/Tokyo')
|
|
47
|
-
// .startOf('date')
|
|
48
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
49
|
-
// .add(-3, 'months')
|
|
50
|
-
// .toDate();
|
|
51
|
-
// const validThrough: Date = moment(performanceInfo.end_date)
|
|
52
|
-
// .tz('Asia/Tokyo')
|
|
53
|
-
// .endOf('date')
|
|
54
|
-
// .toDate();
|
|
55
|
-
// const validFrom: Date = moment(performanceInfo.start_date)
|
|
56
|
-
// .tz('Asia/Tokyo')
|
|
57
|
-
// .startOf('date')
|
|
58
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
59
|
-
// .add(-3, 'months')
|
|
60
|
-
// .toDate();
|
|
61
|
-
// // イベント作成
|
|
62
|
-
// createParams.push({
|
|
63
|
-
// eventStatus: factory.eventStatusType.EventScheduled,
|
|
64
|
-
// doorTime: performanceInfo.door_time,
|
|
65
|
-
// startDate: performanceInfo.start_date,
|
|
66
|
-
// endDate: performanceInfo.end_date,
|
|
67
|
-
// offers: {
|
|
68
|
-
// eligibleQuantity: {
|
|
69
|
-
// ...(typeof maxValue === 'number') ? { maxValue } : undefined // ひとまず全座席予約可能なように
|
|
70
|
-
// },
|
|
71
|
-
// itemOffered: {
|
|
72
|
-
// // 興行ID追加(2022-09-01~)
|
|
73
|
-
// id: eventServiceId,
|
|
74
|
-
// serviceOutput: {
|
|
75
|
-
// typeOf: factory.reservationType.EventReservation,
|
|
76
|
-
// reservedTicket: {
|
|
77
|
-
// typeOf: 'Ticket',
|
|
78
|
-
// ticketedSeat: { typeOf: factory.placeType.Seat }
|
|
79
|
-
// }
|
|
80
|
-
// },
|
|
81
|
-
// },
|
|
82
|
-
// seller: {
|
|
83
|
-
// // event.offersにseller.makesOfferを追加(2022-11-18~)
|
|
84
|
-
// makesOffer: applicationIds.map((applicationId) => {
|
|
85
|
-
// return {
|
|
86
|
-
// typeOf: factory.offerType.Offer,
|
|
87
|
-
// availableAtOrFrom: { id: applicationId }, // support no-array(2024-10-13~),
|
|
88
|
-
// availabilityEnds,
|
|
89
|
-
// availabilityStarts,
|
|
90
|
-
// validFrom,
|
|
91
|
-
// validThrough
|
|
92
|
-
// };
|
|
93
|
-
// })
|
|
94
|
-
// }
|
|
95
|
-
// },
|
|
96
|
-
// // 旧フォーマットIDを追加特性に追加(2022-09-08~)
|
|
97
|
-
// additionalProperty: [
|
|
98
|
-
// { name: 'tourNumber', value: String(performanceInfo.tour_number) },
|
|
99
|
-
// { name: 'oldEventId', value: oldEventId }
|
|
100
|
-
// ],
|
|
101
|
-
// identifier: oldEventId
|
|
102
|
-
// });
|
|
103
|
-
// }
|
|
104
|
-
// return createParams;
|
|
105
|
-
// }
|
|
7
|
+
const TIMEZONE = 'Asia/Tokyo';
|
|
106
8
|
// tslint:disable-next-line:max-func-body-length
|
|
107
9
|
function tour2creatingEvent(tour, movieTheater, screeningRoom, existingApplicationMembers, maxValue, eventService, screeningEventSeries, project) {
|
|
108
10
|
var _a;
|
|
@@ -115,22 +17,34 @@ function tour2creatingEvent(tour, movieTheater, screeningRoom, existingApplicati
|
|
|
115
17
|
screeningRoom.branchCode,
|
|
116
18
|
tour.start_time
|
|
117
19
|
].join('');
|
|
20
|
+
// 00:00:00で再実装(2025-10-09~)
|
|
21
|
+
// const availabilityEnds: Date = moment(tour.end_date)
|
|
22
|
+
// .tz(TIMEZONE)
|
|
23
|
+
// .endOf('date')
|
|
24
|
+
// .toDate();
|
|
118
25
|
const availabilityEnds = moment(tour.end_date)
|
|
119
|
-
.tz(
|
|
120
|
-
.
|
|
26
|
+
.tz(TIMEZONE)
|
|
27
|
+
.startOf('date')
|
|
28
|
+
.add(1, 'day')
|
|
121
29
|
.toDate();
|
|
122
30
|
const availabilityStarts = moment(tour.start_date)
|
|
123
|
-
.tz(
|
|
31
|
+
.tz(TIMEZONE)
|
|
124
32
|
.startOf('date')
|
|
125
33
|
// tslint:disable-next-line:no-magic-numbers
|
|
126
34
|
.add(-3, 'months')
|
|
127
35
|
.toDate();
|
|
36
|
+
// 00:00:00で再実装(2025-10-09~)
|
|
37
|
+
// const validThrough: Date = moment(tour.end_date)
|
|
38
|
+
// .tz(TIMEZONE)
|
|
39
|
+
// .endOf('date')
|
|
40
|
+
// .toDate();
|
|
128
41
|
const validThrough = moment(tour.end_date)
|
|
129
|
-
.tz(
|
|
130
|
-
.
|
|
42
|
+
.tz(TIMEZONE)
|
|
43
|
+
.startOf('date')
|
|
44
|
+
.add(1, 'day')
|
|
131
45
|
.toDate();
|
|
132
46
|
const validFrom = moment(tour.start_date)
|
|
133
|
-
.tz(
|
|
47
|
+
.tz(TIMEZONE)
|
|
134
48
|
.startOf('date')
|
|
135
49
|
// tslint:disable-next-line:no-magic-numbers
|
|
136
50
|
.add(-3, 'months')
|
|
@@ -29,7 +29,7 @@ function syncCategoryCode(params) {
|
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
for (const categoryCodeId of params.ids) {
|
|
32
|
-
const syncingCategoryCode = (yield repos.categoryCode.
|
|
32
|
+
const syncingCategoryCode = (yield repos.categoryCode.projectCategoryCodeFields({
|
|
33
33
|
limit: 1,
|
|
34
34
|
page: 1,
|
|
35
35
|
project: { id: { $eq: params.project.id } },
|
|
@@ -348,7 +348,7 @@ function createInformCategoryCodeTasks(params, setting) {
|
|
|
348
348
|
// settings: Settings
|
|
349
349
|
) => __awaiter(this, void 0, void 0, function* () {
|
|
350
350
|
var _a;
|
|
351
|
-
const categoryCodes4inform = yield repos.categoryCode.
|
|
351
|
+
const categoryCodes4inform = yield repos.categoryCode.projectCategoryCodeFields({
|
|
352
352
|
id: { $in: params.ids },
|
|
353
353
|
// ひとまずDistributorTypeのみ
|
|
354
354
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.DistributorType } }
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
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": "5.
|
|
15
|
-
"@cinerino/sdk": "12.
|
|
14
|
+
"@chevre/factory": "5.2.0-alpha.5",
|
|
15
|
+
"@cinerino/sdk": "12.7.0-alpha.1",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
18
18
|
"@sendgrid/client": "8.1.4",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"moment-timezone": "^0.5.33",
|
|
28
28
|
"node-fpe": "1.0.0",
|
|
29
29
|
"pug": "^2.0.4",
|
|
30
|
-
"uniqid": "
|
|
30
|
+
"uniqid": "5.4.0",
|
|
31
31
|
"uuid": "^3.4.0"
|
|
32
32
|
},
|
|
33
33
|
"description": "Chevre Domain Library for Node.js",
|
|
@@ -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": "23.0.0-alpha.
|
|
118
|
+
"version": "23.0.0-alpha.30"
|
|
119
119
|
}
|
|
@@ -1,32 +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
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
const eventSellerMakesOfferRepo = await chevre.repository.EventSellerMakesOffer.createInstance(mongoose.connection);
|
|
12
|
-
const result = await eventSellerMakesOfferRepo.aggregateMakesOffer(
|
|
13
|
-
{
|
|
14
|
-
limit: 10,
|
|
15
|
-
page: 1,
|
|
16
|
-
// id: { $eq: 'bm0f0cadu' },
|
|
17
|
-
// typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
18
|
-
project: { id: { $eq: project.id } },
|
|
19
|
-
availableAtOrFrom: { id: { $eq: '3eo6okferrsdpfd9j2ce1iv9k7' } },
|
|
20
|
-
itemOffered: {
|
|
21
|
-
serviceOutput: { reservationFor: { id: { $in: ['bm0f0cadu', 'blco2394l'] } } }
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
// tslint:disable-next-line:no-null-keyword
|
|
26
|
-
console.dir(result, { depth: null });
|
|
27
|
-
console.dir(result.length, 'results found');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
main()
|
|
31
|
-
.then(console.log)
|
|
32
|
-
.catch(console.error);
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console no-magic-numbers
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
// tslint:disable-next-line:max-func-body-length
|
|
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
|
-
|
|
14
|
-
const cursor = eventRepo.getCursor(
|
|
15
|
-
{
|
|
16
|
-
// _id: { $eq: 'blwz44d0k' },
|
|
17
|
-
'project.id': { $eq: project.id }
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
_id: 1,
|
|
21
|
-
startDate: 1,
|
|
22
|
-
project: 1,
|
|
23
|
-
identifier: 1,
|
|
24
|
-
additionalProperty: 1,
|
|
25
|
-
typeOf: 1
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
console.log('events found');
|
|
29
|
-
|
|
30
|
-
let i = 0;
|
|
31
|
-
let updateCount = 0;
|
|
32
|
-
await cursor.eachAsync(async (doc) => {
|
|
33
|
-
i += 1;
|
|
34
|
-
const event: Pick<
|
|
35
|
-
chevre.factory.event.screeningEvent.IEvent,
|
|
36
|
-
'id' | 'identifier' | 'startDate' | 'project' | 'additionalProperty' | 'typeOf'
|
|
37
|
-
> = doc.toObject();
|
|
38
|
-
|
|
39
|
-
console.log(
|
|
40
|
-
'alreadyMigrated?', event.project.id, event.id, event.startDate, i);
|
|
41
|
-
const isValidProject = event.project.id.substring(0, 5) === 'ttts-';
|
|
42
|
-
if (!isValidProject) {
|
|
43
|
-
throw new Error(`${event.project.id} ${event.id} invalid project.`);
|
|
44
|
-
}
|
|
45
|
-
const eventIdentifier = event.identifier;
|
|
46
|
-
const oldEventId = event.additionalProperty?.find(({ name }) => name === 'oldEventId')?.value;
|
|
47
|
-
const tourNumber = event.additionalProperty?.find(({ name }) => name === 'tourNumber')?.value;
|
|
48
|
-
if (typeof oldEventId !== 'string' || oldEventId === '') {
|
|
49
|
-
throw new Error(`${event.project.id} ${event.id} oldEventId required: ${oldEventId}`);
|
|
50
|
-
}
|
|
51
|
-
if (typeof tourNumber !== 'string' || tourNumber === '') {
|
|
52
|
-
throw new Error(`${event.project.id} ${event.id} tourNumber required: ${tourNumber}`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const alreadyMigrated = typeof eventIdentifier === 'string' && eventIdentifier === oldEventId;
|
|
56
|
-
|
|
57
|
-
if (alreadyMigrated) {
|
|
58
|
-
console.log(
|
|
59
|
-
'already migrated.', event.project.id, event.id, event.startDate, i);
|
|
60
|
-
} else {
|
|
61
|
-
console.log(
|
|
62
|
-
'updating... oldEventId:',
|
|
63
|
-
oldEventId, event.project.id, event.id, event.startDate, i);
|
|
64
|
-
await eventRepo.updatePartiallyById({
|
|
65
|
-
project: { id: event.project.id },
|
|
66
|
-
id: event.id,
|
|
67
|
-
attributes: {
|
|
68
|
-
typeOf: event.typeOf,
|
|
69
|
-
...{
|
|
70
|
-
identifier: oldEventId
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
updateCount += 1;
|
|
75
|
-
console.log(
|
|
76
|
-
'updated.',
|
|
77
|
-
event.project.id, event.id, event.startDate, i);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
console.log(i, 'events checked');
|
|
82
|
-
console.log(updateCount, 'events updated');
|
|
83
|
-
|
|
84
|
-
// await eventRepo.projectEventFields<chevre.factory.eventType.ScreeningEvent>(
|
|
85
|
-
// {
|
|
86
|
-
// project: { id: { $eq: project.id } },
|
|
87
|
-
// typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
88
|
-
// // id
|
|
89
|
-
// },
|
|
90
|
-
// ['identifier']
|
|
91
|
-
// );
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
main()
|
|
95
|
-
.then()
|
|
96
|
-
.catch(console.error);
|
|
@@ -1,31 +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
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
10
|
-
|
|
11
|
-
const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
const categoryCodes = await categoryCodeRepo.searchByAggregate(
|
|
14
|
-
{
|
|
15
|
-
limit: 100,
|
|
16
|
-
page: 1,
|
|
17
|
-
sort: { codeValue: chevre.factory.sortType.Ascending }
|
|
18
|
-
// id: { $eq: 'xxx' }
|
|
19
|
-
// project: { id: { $eq: project.id } }
|
|
20
|
-
// paymentAccepted: { paymentMethodType: { $eq: 'Cash' } },
|
|
21
|
-
// hasMerchantReturnPolicy: { applicablePaymentMethod: {} }
|
|
22
|
-
},
|
|
23
|
-
['id']
|
|
24
|
-
);
|
|
25
|
-
console.log('categoryCodes found', categoryCodes[0]);
|
|
26
|
-
console.log(categoryCodes.length, 'categoryCodes found');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
main()
|
|
30
|
-
.then()
|
|
31
|
-
.catch(console.error);
|