@chevre/domain 23.2.0-alpha.6 → 23.2.0-alpha.61

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.
Files changed (173) hide show
  1. package/example/src/chevre/acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts +25 -17
  2. package/example/src/chevre/confirmationNumber/testRandomness.ts +49 -0
  3. package/example/src/chevre/emailMessage/createEmailMessageText.ts +63 -0
  4. package/example/src/chevre/event/importEventsFromCOAByTitle.ts +2 -2
  5. package/example/src/chevre/event/unsetSuperEventVideoFormat.ts +30 -0
  6. package/example/src/chevre/eventSeries/unsetVideoFormat.ts +31 -0
  7. package/example/src/chevre/{upsertScreeningEventSeriesByVersion.ts → eventSeries/upsertScreeningEventSeriesByVersion.ts} +47 -43
  8. package/example/src/chevre/{upsertOfferCatalogItemsByIdentifier.ts → offerCatalog/upsertOfferCatalogItemsByIdentifier.ts} +6 -3
  9. package/example/src/chevre/{upsertOfferCatalogsByIdentifier.ts → offerCatalog/upsertOfferCatalogsByIdentifier.ts} +8 -3
  10. package/example/src/chevre/{upsertOffersByIdentifier.ts → offers/upsertOffersByIdentifier.ts} +5 -3
  11. package/example/src/chevre/orderNumber/testRandomness.ts +54 -0
  12. package/example/src/chevre/place/adminEntranceGates.ts +69 -0
  13. package/example/src/chevre/place/checkEntranceGatesCount.ts +82 -0
  14. package/example/src/chevre/place/findRooms.ts +24 -0
  15. package/example/src/chevre/place/findSections.ts +28 -0
  16. package/example/src/chevre/place/migrateSectionIdentifier.ts +92 -0
  17. package/example/src/chevre/place/seatsJson2csv.ts +63 -0
  18. package/example/src/chevre/place/upsertMovieTheatersByBranchCode.ts +41 -0
  19. package/example/src/chevre/place/upsertRoomsByBranchCode.ts +40 -0
  20. package/example/src/chevre/place/upsertSeatSectionsByBranchCode.ts +56 -0
  21. package/example/src/chevre/reIndex.ts +1 -1
  22. package/example/src/chevre/roles/addAdminAcceptedPaymentMethodReadPermissionIfNotExists.ts +33 -0
  23. package/example/src/chevre/roles/addAdminAcceptedPaymentMethodWritePermissionIfNotExists.ts +33 -0
  24. package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
  25. package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +34 -0
  26. package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +34 -0
  27. package/example/src/chevre/settings/addOrderNumberSetting.ts +44 -0
  28. package/example/src/chevre/settings/addTransactionNumberSetting.ts +40 -0
  29. package/example/src/chevre/transactionNumber/publishByTimestamp.ts +23 -0
  30. package/example/src/chevre/transactionNumber/testRandomness.ts +42 -0
  31. package/example/src/chevre/unsetUnnecessaryFields.ts +8 -4
  32. package/lib/chevre/emailMessageBuilder.js +1 -0
  33. package/lib/chevre/factory/event.d.ts +1 -1
  34. package/lib/chevre/factory/event.js +11 -5
  35. package/lib/chevre/factory/transactionNumber.d.ts +19 -0
  36. package/lib/chevre/factory/transactionNumber.js +54 -0
  37. package/lib/chevre/repo/acceptedPaymentMethod.d.ts +41 -8
  38. package/lib/chevre/repo/acceptedPaymentMethod.js +72 -27
  39. package/lib/chevre/repo/aggregateOffer.d.ts +6 -1
  40. package/lib/chevre/repo/aggregateOffer.js +11 -3
  41. package/lib/chevre/repo/aggregateOrder.js +0 -93
  42. package/lib/chevre/repo/aggregateReservation.d.ts +0 -1
  43. package/lib/chevre/repo/aggregateReservation.js +0 -2
  44. package/lib/chevre/repo/confirmationNumber.d.ts +1 -0
  45. package/lib/chevre/repo/confirmationNumber.js +32 -25
  46. package/lib/chevre/repo/event.d.ts +3 -18
  47. package/lib/chevre/repo/event.js +94 -83
  48. package/lib/chevre/repo/eventOffer.d.ts +8 -0
  49. package/lib/chevre/repo/eventOffer.js +11 -0
  50. package/lib/chevre/repo/eventSeries.d.ts +17 -30
  51. package/lib/chevre/repo/eventSeries.js +204 -146
  52. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -1
  53. package/lib/chevre/repo/mongoose/schemas/eventSeries.js +20 -5
  54. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +2 -8
  55. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +28 -2
  56. package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -2
  57. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +40 -0
  58. package/lib/chevre/repo/mongoose/schemas/setting.js +3 -0
  59. package/lib/chevre/repo/offerCatalog.d.ts +14 -1
  60. package/lib/chevre/repo/offerCatalog.js +41 -19
  61. package/lib/chevre/repo/offerCatalogItem.d.ts +10 -1
  62. package/lib/chevre/repo/offerCatalogItem.js +32 -17
  63. package/lib/chevre/repo/orderNumber.d.ts +6 -0
  64. package/lib/chevre/repo/orderNumber.js +110 -35
  65. package/lib/chevre/repo/place/entranceGate.d.ts +57 -0
  66. package/lib/chevre/repo/place/entranceGate.js +172 -0
  67. package/lib/chevre/repo/place/movieTheater.d.ts +40 -3
  68. package/lib/chevre/repo/place/movieTheater.js +77 -6
  69. package/lib/chevre/repo/place/screeningRoom.d.ts +60 -31
  70. package/lib/chevre/repo/place/screeningRoom.js +227 -135
  71. package/lib/chevre/repo/place/seat.d.ts +47 -45
  72. package/lib/chevre/repo/place/seat.js +175 -45
  73. package/lib/chevre/repo/place/section.d.ts +60 -30
  74. package/lib/chevre/repo/place/section.js +337 -127
  75. package/lib/chevre/repo/serviceOutputIdentifier.d.ts +3 -1
  76. package/lib/chevre/repo/serviceOutputIdentifier.js +42 -27
  77. package/lib/chevre/repo/setting.d.ts +1 -1
  78. package/lib/chevre/repo/setting.js +2 -2
  79. package/lib/chevre/repo/task.d.ts +1 -1
  80. package/lib/chevre/repo/transactionNumber.d.ts +5 -0
  81. package/lib/chevre/repo/transactionNumber.js +63 -27
  82. package/lib/chevre/repository.d.ts +8 -0
  83. package/lib/chevre/repository.js +16 -0
  84. package/lib/chevre/service/assetTransaction/fixInformAction.d.ts +3 -0
  85. package/lib/chevre/service/assetTransaction/fixInformAction.js +3 -0
  86. package/lib/chevre/service/assetTransaction/pay/cancel.d.ts +12 -0
  87. package/lib/chevre/service/assetTransaction/pay/cancel.js +25 -0
  88. package/lib/chevre/service/assetTransaction/pay/check.d.ts +23 -0
  89. package/lib/chevre/service/assetTransaction/pay/check.js +37 -0
  90. package/lib/chevre/service/assetTransaction/pay/confirm.d.ts +24 -0
  91. package/lib/chevre/service/assetTransaction/pay/confirm.js +72 -0
  92. package/lib/chevre/service/assetTransaction/pay/exportTasksById.d.ts +18 -0
  93. package/lib/chevre/service/assetTransaction/pay/exportTasksById.js +111 -0
  94. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.d.ts +48 -0
  95. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +164 -0
  96. package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.d.ts +20 -0
  97. package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.js +59 -0
  98. package/lib/chevre/service/assetTransaction/pay/{account → start/account}/validation.d.ts +2 -2
  99. package/lib/chevre/service/assetTransaction/pay/{account → start/account}/validation.js +1 -1
  100. package/lib/chevre/service/assetTransaction/pay/{factory.d.ts → start/factory.d.ts} +1 -1
  101. package/lib/chevre/service/assetTransaction/pay/{factory.js → start/factory.js} +1 -1
  102. package/lib/chevre/service/assetTransaction/pay/{validateAcceptedPaymentMethodIfNeeded.d.ts → start/preStart/validateAcceptedPaymentMethodIfNeeded.d.ts} +4 -4
  103. package/lib/chevre/service/assetTransaction/pay/{validateAcceptedPaymentMethodIfNeeded.js → start/preStart/validateAcceptedPaymentMethodIfNeeded.js} +1 -4
  104. package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.d.ts +8 -0
  105. package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.js +54 -0
  106. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeAccount.d.ts +13 -0
  107. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeAccount.js +49 -0
  108. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeCreditCard.d.ts +29 -0
  109. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeCreditCard.js +37 -0
  110. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +42 -0
  111. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.js +31 -0
  112. package/lib/chevre/service/assetTransaction/pay/start.d.ts +60 -0
  113. package/lib/chevre/service/assetTransaction/pay/start.js +145 -0
  114. package/lib/chevre/service/assetTransaction/pay.d.ts +8 -170
  115. package/lib/chevre/service/assetTransaction/pay.js +16 -623
  116. package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +10 -2
  117. package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
  118. package/lib/chevre/service/event/processUpdateMovieTheater.js +13 -11
  119. package/lib/chevre/service/event/saveScreeningEventSeries.js +4 -5
  120. package/lib/chevre/service/event/saveScreeningEvents.d.ts +2 -2
  121. package/lib/chevre/service/event/saveScreeningEvents.js +16 -12
  122. package/lib/chevre/service/offer/event/authorize/factory.js +9 -1
  123. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +7 -4
  124. package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +9 -6
  125. package/lib/chevre/service/offer/event/searchOffersByIds.js +7 -4
  126. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +7 -1
  127. package/lib/chevre/service/offer/onEventChanged.js +10 -6
  128. package/lib/chevre/service/offer/product.js +1 -1
  129. package/lib/chevre/service/offer.d.ts +5 -0
  130. package/lib/chevre/service/offer.js +34 -9
  131. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  132. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  133. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  134. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +13 -0
  135. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +53 -0
  136. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +13 -0
  137. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +56 -0
  138. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +15 -0
  139. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +58 -0
  140. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +17 -0
  141. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +75 -0
  142. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +19 -0
  143. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +60 -0
  144. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +20 -0
  145. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +51 -0
  146. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +27 -0
  147. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +100 -0
  148. package/lib/chevre/service/task/onResourceDeleted.d.ts +6 -0
  149. package/lib/chevre/service/task/onResourceDeleted.js +168 -0
  150. package/lib/chevre/service/task/onResourceUpdated.js +205 -42
  151. package/lib/chevre/service/task/syncResourcesFromCOA.js +4 -2
  152. package/lib/chevre/service/taskHandler.js +1 -0
  153. package/package.json +9 -9
  154. package/example/src/chevre/event/upsertManyScreeningEventByIdentifier.ts +0 -191
  155. package/example/src/chevre/eventSeries/migrateEventSeriesUnacceptedPaymentMethod.ts +0 -93
  156. package/example/src/chevre/offers/createSampleOffers.ts +0 -154
  157. package/example/src/chevre/settings/addSettings.ts +0 -46
  158. package/lib/chevre/service/eventOld.d.ts +0 -60
  159. package/lib/chevre/service/eventOld.js +0 -864
  160. package/lib/chevre/service/task/createEvent/createEvent.d.ts +0 -25
  161. package/lib/chevre/service/task/createEvent/createEvent.js +0 -45
  162. package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +0 -22
  163. package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +0 -188
  164. package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.d.ts +0 -15
  165. package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +0 -116
  166. package/lib/chevre/service/task/createEvent/createEventBySchedule.d.ts +0 -25
  167. package/lib/chevre/service/task/createEvent/createEventBySchedule.js +0 -107
  168. package/lib/chevre/service/task/createEvent/createEventSeries.d.ts +0 -13
  169. package/lib/chevre/service/task/createEvent/createEventSeries.js +0 -118
  170. package/lib/chevre/service/task/createEvent.d.ts +0 -6
  171. package/lib/chevre/service/task/createEvent.js +0 -46
  172. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +0 -45
  173. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +0 -447
@@ -1,25 +0,0 @@
1
- import * as factory from '../../../factory';
2
- import type { ActionRepo } from '../../../repo/action';
3
- import type { EventRepo } from '../../../repo/event';
4
- import type { EventSeriesRepo } from '../../../repo/eventSeries';
5
- import type { MemberRepo } from '../../../repo/member';
6
- import type { MovieTheaterRepo } from '../../../repo/place/movieTheater';
7
- import type { ScreeningRoomRepo } from '../../../repo/place/screeningRoom';
8
- import type { ProductRepo } from '../../../repo/product';
9
- import type { ProjectRepo } from '../../../repo/project';
10
- import type { ScheduleRepo } from '../../../repo/schedule';
11
- import type { SettingRepo } from '../../../repo/setting';
12
- import type { TaskRepo } from '../../../repo/task';
13
- export declare function createEvent(params: factory.task.createEvent.IData): (repos: {
14
- action: ActionRepo;
15
- event: EventRepo;
16
- eventSeries: EventSeriesRepo;
17
- member: MemberRepo;
18
- movieTheater: MovieTheaterRepo;
19
- screeningRoom: ScreeningRoomRepo;
20
- product: ProductRepo;
21
- project: ProjectRepo;
22
- schedule: ScheduleRepo;
23
- setting: SettingRepo;
24
- task: TaskRepo;
25
- }) => Promise<void>;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createEvent = createEvent;
13
- const factory = require("../../../factory");
14
- // import { Settings } from '../../../settings';
15
- const createEventBySchedule_1 = require("./createEventBySchedule");
16
- const createEventSeries_1 = require("./createEventSeries");
17
- function createEvent(params) {
18
- return (repos
19
- // settings: Settings
20
- ) => __awaiter(this, void 0, void 0, function* () {
21
- if (Array.isArray(params.object) && params.instrument !== undefined) {
22
- yield (0, createEventSeries_1.createEventSeries)({
23
- agent: params.agent,
24
- object: params.object,
25
- project: params.project,
26
- targetCollection: params.targetCollection,
27
- typeOf: params.typeOf,
28
- instrument: params.instrument
29
- })(repos);
30
- }
31
- else if (!Array.isArray(params.object)) {
32
- // support schedule4ttts(2024-11-08~)
33
- yield (0, createEventBySchedule_1.createEventBySchedule)({
34
- agent: params.agent,
35
- object: params.object,
36
- project: params.project,
37
- targetCollection: params.targetCollection,
38
- typeOf: params.typeOf
39
- })(repos);
40
- }
41
- else {
42
- throw new factory.errors.NotImplemented('unexpected task not implemented');
43
- }
44
- });
45
- }
@@ -1,22 +0,0 @@
1
- import type { ICreatingEvent4ttts } from '../../../../repo/event';
2
- import type { ICustomerMember } from '../../../../repo/member';
3
- import * as factory from '../../../../factory';
4
- declare function tour2creatingEvent(tour: ITourBySchedule, movieTheater: Pick<factory.place.movieTheater.IPlace, 'id' | 'branchCode' | 'parentOrganization'>, screeningRoom: Omit<factory.place.screeningRoom.IPlace, 'containsPlace' | 'parentOrganization'>, existingApplicationMembers: {
5
- member: ICustomerMember;
6
- }[], maxValue: number, eventService: Pick<factory.product.IProduct, 'id' | 'name'> & {
7
- id: string;
8
- }, screeningEventSeries: Pick<factory.eventSeries.IEvent, 'location' | 'additionalProperty' | 'description' | 'endDate' | 'headline' | 'id' | 'kanaName' | 'name' | 'soundFormat' | 'startDate' | 'typeOf' | 'videoFormat' | 'workPerformed'>, project: {
9
- id: string;
10
- }): ICreatingEvent4ttts;
11
- interface ITourBySchedule {
12
- day: string;
13
- start_time: string;
14
- end_time?: never;
15
- door_time: Date;
16
- start_date: Date;
17
- end_date: Date;
18
- duration?: never;
19
- tour_number: string;
20
- }
21
- declare function schedule2tours(settings: factory.schedule.IEventWithSchedule, createDate: Date): ITourBySchedule[];
22
- export { tour2creatingEvent, schedule2tours };
@@ -1,188 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tour2creatingEvent = tour2creatingEvent;
4
- exports.schedule2tours = schedule2tours;
5
- const moment = require("moment-timezone");
6
- const factory = require("../../../../factory");
7
- const TIMEZONE = 'Asia/Tokyo';
8
- // tslint:disable-next-line:max-func-body-length
9
- function tour2creatingEvent(tour, movieTheater, screeningRoom, existingApplicationMembers, maxValue, eventService, screeningEventSeries, project) {
10
- var _a;
11
- const workPerformedIdentifier = screeningEventSeries.workPerformed.identifier;
12
- const oldEventId = [
13
- // tslint:disable-next-line:no-magic-numbers
14
- tour.day.slice(-6),
15
- workPerformedIdentifier,
16
- movieTheater.branchCode,
17
- screeningRoom.branchCode,
18
- tour.start_time
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();
25
- const availabilityEnds = moment(tour.end_date)
26
- .tz(TIMEZONE)
27
- .startOf('date')
28
- .add(1, 'day')
29
- .toDate();
30
- const availabilityStarts = moment(tour.start_date)
31
- .tz(TIMEZONE)
32
- .startOf('date')
33
- // tslint:disable-next-line:no-magic-numbers
34
- .add(-3, 'months')
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();
41
- const validThrough = moment(tour.end_date)
42
- .tz(TIMEZONE)
43
- .startOf('date')
44
- .add(1, 'day')
45
- .toDate();
46
- const validFrom = moment(tour.start_date)
47
- .tz(TIMEZONE)
48
- .startOf('date')
49
- // tslint:disable-next-line:no-magic-numbers
50
- .add(-3, 'months')
51
- .toDate();
52
- const seller = movieTheater.parentOrganization;
53
- const offersSeller = {
54
- typeOf: factory.organizationType.Corporation,
55
- id: seller.id,
56
- // event.offersにseller.makesOfferを追加(2022-11-18~)
57
- makesOffer: existingApplicationMembers.map((a) => {
58
- return {
59
- typeOf: factory.offerType.Offer,
60
- availableAtOrFrom: { id: a.member.id }, // support no-array(2024-10-13~),
61
- availabilityEnds,
62
- availabilityStarts,
63
- validFrom,
64
- validThrough
65
- };
66
- })
67
- };
68
- const offers = {
69
- typeOf: factory.offerType.Offer,
70
- eligibleQuantity: {
71
- typeOf: 'QuantitativeValue',
72
- unitCode: factory.unitCode.C62,
73
- maxValue
74
- },
75
- itemOffered: Object.assign({
76
- // 興行ID追加(2022-09-01~)
77
- id: eventService.id, serviceOutput: {
78
- typeOf: factory.reservationType.EventReservation,
79
- reservedTicket: {
80
- typeOf: 'Ticket',
81
- ticketedSeat: { typeOf: factory.placeType.Seat }
82
- }
83
- }, typeOf: factory.product.ProductType.EventService, availableChannel: {
84
- typeOf: 'ServiceChannel',
85
- serviceLocation: {
86
- typeOf: screeningRoom.typeOf,
87
- branchCode: screeningRoom.branchCode,
88
- name: screeningRoom.name,
89
- containedInPlace: Object.assign({ typeOf: screeningEventSeries.location.typeOf, id: screeningEventSeries.location.id, branchCode: screeningEventSeries.location.branchCode }, (screeningEventSeries.location.name !== undefined)
90
- ? { name: screeningEventSeries.location.name }
91
- : undefined)
92
- }
93
- } }, { name: { ja: (typeof eventService.name === 'string') ? eventService.name : String((_a = eventService.name) === null || _a === void 0 ? void 0 : _a.ja) } }),
94
- seller: offersSeller
95
- };
96
- const screeningEventSuperEvent = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: screeningEventSeries.typeOf, id: screeningEventSeries.id, videoFormat: screeningEventSeries.videoFormat, soundFormat: screeningEventSeries.soundFormat, workPerformed: screeningEventSeries.workPerformed, location: screeningEventSeries.location, kanaName: screeningEventSeries.kanaName, name: screeningEventSeries.name }, (Array.isArray(screeningEventSeries.additionalProperty))
97
- ? { additionalProperty: screeningEventSeries.additionalProperty }
98
- : undefined), (screeningEventSeries.startDate !== undefined)
99
- ? { startDate: screeningEventSeries.startDate }
100
- : undefined), (screeningEventSeries.endDate !== undefined)
101
- ? { endDate: screeningEventSeries.endDate }
102
- : undefined), (screeningEventSeries.description !== undefined)
103
- ? { description: screeningEventSeries.description }
104
- : undefined), (screeningEventSeries.headline !== undefined)
105
- ? { headline: screeningEventSeries.headline }
106
- : undefined);
107
- const location = Object.assign({ typeOf: screeningRoom.typeOf, branchCode: screeningRoom.branchCode, name: screeningRoom.name }, (screeningRoom.address !== undefined) ? { address: screeningRoom.address } : undefined);
108
- return {
109
- project: { id: project.id, typeOf: factory.organizationType.Project },
110
- typeOf: factory.eventType.ScreeningEvent,
111
- eventStatus: factory.eventStatusType.EventScheduled,
112
- name: screeningEventSeries.name,
113
- doorTime: tour.door_time,
114
- startDate: tour.start_date,
115
- endDate: tour.end_date,
116
- superEvent: screeningEventSuperEvent,
117
- location,
118
- offers,
119
- // 旧フォーマットIDを追加特性に追加(2022-09-08~)
120
- additionalProperty: [
121
- { name: 'tourNumber', value: String(tour.tour_number) },
122
- { name: 'oldEventId', value: oldEventId }
123
- ],
124
- // organizer追加(2023-07-12~)
125
- organizer: { id: seller.id },
126
- identifier: oldEventId
127
- };
128
- }
129
- function schedule2tours(settings, createDate) {
130
- const tours = [];
131
- const { eventSchedule } = settings;
132
- // 作成対象時間: 9,10,11など
133
- // const hours: string[] = ['9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22'];
134
- // const minutes = ['00', '15', '30', '45'];
135
- // const tours = ['1', '2', '3', '4'];
136
- // 1日分作成する
137
- const now = (createDate instanceof Date)
138
- ? moment(createDate)
139
- : moment();
140
- let startDate = moment.tz(`${now.tz(eventSchedule.scheduleTimezone)
141
- .format('YYYYMMDD')} ${eventSchedule.startTime}`, 'YYYYMMDD HH:mm:ss', eventSchedule.scheduleTimezone);
142
- const startDateShouldBeLte = moment.tz(`${now.tz(eventSchedule.scheduleTimezone)
143
- .format('YYYYMMDD')} ${eventSchedule.endTime}`, 'YYYYMMDD HH:mm:ss', eventSchedule.scheduleTimezone);
144
- const frequencyInMinutes = moment.duration(eventSchedule.repeatFrequency)
145
- .asMinutes();
146
- // tslint:disable-next-line:no-magic-numbers
147
- const repeatCountInHour = Math.floor(60 / frequencyInMinutes);
148
- let i = 0;
149
- while (startDate < startDateShouldBeLte) {
150
- i += 1;
151
- if (i > 1) {
152
- startDate = moment(startDate)
153
- .add(moment.duration(eventSchedule.repeatFrequency));
154
- }
155
- const hour = `0${moment(startDate)
156
- .format('HH')}`
157
- // 2桁でない時は'0'詰め
158
- // tslint:disable-next-line:no-magic-numbers
159
- .slice(-2);
160
- let tourIndex = i % repeatCountInHour;
161
- if (tourIndex === 0) {
162
- tourIndex = repeatCountInHour;
163
- }
164
- const tourNumber = `${hour}${tourIndex}`;
165
- const endDate = moment(startDate)
166
- .add(moment.duration(eventSchedule.duration));
167
- const day = moment(startDate)
168
- .tz(eventSchedule.scheduleTimezone)
169
- .format('YYYYMMDD');
170
- const startTime = moment(startDate)
171
- .tz(eventSchedule.scheduleTimezone)
172
- .format('HHmm');
173
- // const endTime = moment(endDate)
174
- // .tz(eventSchedule.scheduleTimezone)
175
- // .format('HHmm');
176
- tours.push({
177
- day: day,
178
- start_time: startTime,
179
- // end_time: endTime,
180
- door_time: startDate.toDate(),
181
- start_date: startDate.toDate(),
182
- end_date: endDate.toDate(),
183
- tour_number: tourNumber
184
- // duration: eventSchedule.duration
185
- });
186
- }
187
- return tours;
188
- }
@@ -1,15 +0,0 @@
1
- import type { ICreatingEvent4ttts } from '../../../../repo/event';
2
- import type { EventSeriesRepo } from '../../../../repo/eventSeries';
3
- import type { MemberRepo } from '../../../../repo/member';
4
- import type { MovieTheaterRepo } from '../../../../repo/place/movieTheater';
5
- import type { ScreeningRoomRepo } from '../../../../repo/place/screeningRoom';
6
- import type { ProductRepo } from '../../../../repo/product';
7
- import * as factory from '../../../../factory';
8
- declare function schedule2events(schedule: factory.schedule.IEventWithSchedule, createDate: Date): (repos: {
9
- eventSeries: EventSeriesRepo;
10
- member: MemberRepo;
11
- movieTheater: MovieTheaterRepo;
12
- screeningRoom: ScreeningRoomRepo;
13
- product: ProductRepo;
14
- }) => Promise<ICreatingEvent4ttts[]>;
15
- export { schedule2events };
@@ -1,116 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.schedule2events = schedule2events;
13
- const createDebug = require("debug");
14
- const factory = require("../../../../factory");
15
- const factory_1 = require("./factory");
16
- const debug = createDebug('chevre-domain:service:task:createEvent');
17
- function schedule2relatedResources(schedule) {
18
- // tslint:disable-next-line:max-func-body-length
19
- return (repos) => __awaiter(this, void 0, void 0, function* () {
20
- var _a, _b, _c, _d, _e, _f, _g, _h;
21
- debug('schedule2relatedResources processing...', JSON.stringify(schedule));
22
- const eventServiceId = (_b = (_a = schedule.offers) === null || _a === void 0 ? void 0 : _a.itemOffered) === null || _b === void 0 ? void 0 : _b.id;
23
- const makesOffer = (_d = (_c = schedule.offers) === null || _c === void 0 ? void 0 : _c.seller) === null || _d === void 0 ? void 0 : _d.makesOffer;
24
- const applicationIds = (Array.isArray(makesOffer))
25
- ? makesOffer.map(({ availableAtOrFrom }) => availableAtOrFrom.id)
26
- : [];
27
- const eventSeriesId = (_e = schedule.superEvent) === null || _e === void 0 ? void 0 : _e.id;
28
- const maxValue = (_g = (_f = schedule.offers) === null || _f === void 0 ? void 0 : _f.eligibleQuantity) === null || _g === void 0 ? void 0 : _g.maxValue;
29
- const locationBranchCode = (_h = schedule.location) === null || _h === void 0 ? void 0 : _h.branchCode;
30
- if (typeof eventServiceId !== 'string' || eventServiceId === '') {
31
- throw new factory.errors.NotFound('schedule.offers.itemOffered.id required');
32
- }
33
- if (typeof eventSeriesId !== 'string' || eventSeriesId === '') {
34
- throw new factory.errors.NotFound('schedule.superEvent.id required');
35
- }
36
- if (typeof maxValue !== 'number') {
37
- throw new factory.errors.NotFound('schedule.offers.eligibleQuantity.maxValue required');
38
- }
39
- if (typeof locationBranchCode !== 'string' || locationBranchCode === '') {
40
- throw new factory.errors.NotFound('location.branchCode required');
41
- }
42
- const project = schedule.project;
43
- // 施設コンテンツ検索
44
- const screeningEventSeries = (yield repos.eventSeries.projectEventSeriesFields({
45
- project: { id: { $eq: project.id } },
46
- id: { $eq: eventSeriesId }
47
- }, [
48
- 'location', 'additionalProperty', 'description', 'endDate', 'headline', 'kanaName', 'name',
49
- 'soundFormat', 'startDate', 'typeOf', 'videoFormat', 'workPerformed'
50
- ])).shift();
51
- if (screeningEventSeries === undefined) {
52
- throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
53
- }
54
- // 劇場検索
55
- const movieTheater = (yield repos.movieTheater.projectFields({
56
- limit: 1,
57
- page: 1,
58
- project: { id: { $eq: project.id } },
59
- branchCode: { $eq: screeningEventSeries.location.branchCode }
60
- }, ['id', 'branchCode', 'parentOrganization'])).shift();
61
- if (movieTheater === undefined) {
62
- throw new factory.errors.NotFound(factory.placeType.MovieTheater);
63
- }
64
- const screeningRoom = (yield repos.screeningRoom.searchScreeningRooms({
65
- limit: 1,
66
- page: 1,
67
- project: { id: { $eq: project.id } },
68
- containedInPlace: { id: { $eq: movieTheater.id } },
69
- branchCode: { $eq: locationBranchCode }
70
- })).shift();
71
- if (screeningRoom === undefined) {
72
- throw new factory.errors.NotFound(factory.placeType.ScreeningRoom, `${factory.placeType.ScreeningRoom} ${locationBranchCode} not found`);
73
- }
74
- // 興行検索
75
- const eventService = (yield repos.product.projectFields({
76
- limit: 1,
77
- page: 1,
78
- project: { id: { $eq: project.id } },
79
- id: { $eq: eventServiceId }
80
- // productID: { $eq: eventServiceProductID }
81
- }, ['name'])).shift();
82
- if (typeof (eventService === null || eventService === void 0 ? void 0 : eventService.id) !== 'string') {
83
- throw new Error(`EventService ${eventServiceId} not found`);
84
- }
85
- let existingApplicationMembers = [];
86
- if (applicationIds.length > 0) {
87
- existingApplicationMembers = yield repos.member.searchCustomerMembers({
88
- limit: 100,
89
- page: 1,
90
- project: { id: project.id },
91
- member: {
92
- // typeOf: {
93
- // $eq: factory.creativeWorkType.WebApplication
94
- // },
95
- id: { $in: applicationIds }
96
- }
97
- });
98
- }
99
- return {
100
- movieTheater, screeningRoom,
101
- existingApplicationMembers, maxValue, eventService, screeningEventSeries
102
- };
103
- });
104
- }
105
- function schedule2events(schedule, createDate) {
106
- return (repos) => __awaiter(this, void 0, void 0, function* () {
107
- if (schedule.eventSchedule === undefined) {
108
- throw new factory.errors.NotFound('schedule.eventSchedule required');
109
- }
110
- const { movieTheater, screeningRoom, existingApplicationMembers, maxValue, eventService, screeningEventSeries } = yield schedule2relatedResources(schedule)(repos);
111
- const project = schedule.project;
112
- const tours = (0, factory_1.schedule2tours)(schedule, createDate);
113
- debug(tours.length, 'tours ->', JSON.stringify(tours));
114
- return tours.map((tour) => (0, factory_1.tour2creatingEvent)(tour, movieTheater, screeningRoom, existingApplicationMembers, maxValue, eventService, screeningEventSeries, project));
115
- });
116
- }
@@ -1,25 +0,0 @@
1
- import type { ActionRepo } from '../../../repo/action';
2
- import type { EventRepo } from '../../../repo/event';
3
- import type { EventSeriesRepo } from '../../../repo/eventSeries';
4
- import type { MemberRepo } from '../../../repo/member';
5
- import type { MovieTheaterRepo } from '../../../repo/place/movieTheater';
6
- import type { ScreeningRoomRepo } from '../../../repo/place/screeningRoom';
7
- import type { ProductRepo } from '../../../repo/product';
8
- import type { ProjectRepo } from '../../../repo/project';
9
- import type { ScheduleRepo } from '../../../repo/schedule';
10
- import type { SettingRepo } from '../../../repo/setting';
11
- import type { TaskRepo } from '../../../repo/task';
12
- import * as factory from '../../../factory';
13
- export declare function createEventBySchedule(params: factory.task.createEvent.IAddEventByScheduleAction): (repos: {
14
- action: ActionRepo;
15
- event: EventRepo;
16
- eventSeries: EventSeriesRepo;
17
- member: MemberRepo;
18
- movieTheater: MovieTheaterRepo;
19
- screeningRoom: ScreeningRoomRepo;
20
- product: ProductRepo;
21
- project: ProjectRepo;
22
- schedule: ScheduleRepo;
23
- setting: SettingRepo;
24
- task: TaskRepo;
25
- }) => Promise<void>;
@@ -1,107 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createEventBySchedule = createEventBySchedule;
13
- const createDebug = require("debug");
14
- const factory = require("../../../factory");
15
- const onEventChanged_1 = require("../../offer/onEventChanged");
16
- // import { Settings } from '../../../settings';
17
- const schedule2events_1 = require("./createEventBySchedule/schedule2events");
18
- const debug = createDebug('chevre-domain:service:task:createEvent');
19
- /**
20
- * イベントコード指定でtttsイベントを冪等更新する
21
- */
22
- function updateEvent4ttts(params) {
23
- return (repos) => __awaiter(this, void 0, void 0, function* () {
24
- const updateObject = {
25
- id: params.attributes.identifier,
26
- identifier: params.attributes.identifier, // support identifier(2025-09-03~)
27
- typeOf: factory.eventType.ScreeningEvent
28
- };
29
- const actionAttributes = {
30
- project: { typeOf: factory.organizationType.Project, id: params.project.id },
31
- typeOf: factory.actionType.UpdateAction,
32
- agent: { typeOf: factory.organizationType.Project, id: params.project.id },
33
- object: updateObject,
34
- // replacee: reservation,
35
- // replacer: params.attributes, // $unsetもありうるのでいったん保留
36
- targetCollection: {
37
- // id: params.attributes.identifier,
38
- typeOf: factory.eventType.ScreeningEvent
39
- },
40
- instrument: { typeOf: 'Task' }
41
- };
42
- const action = yield repos.action.start(actionAttributes);
43
- let savedEvent;
44
- try {
45
- savedEvent = yield repos.event.saveEventByIdentifier4ttts({
46
- // oldEventId: params.oldEventId,
47
- attributes: params.attributes
48
- });
49
- }
50
- catch (error) {
51
- try {
52
- yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
53
- }
54
- catch (__) {
55
- // 失敗したら仕方ない
56
- }
57
- throw error;
58
- }
59
- yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: { id: savedEvent.id } });
60
- yield (0, onEventChanged_1.onEventChanged)({
61
- id: [savedEvent.id],
62
- project: { id: params.project.id },
63
- typeOf: factory.eventType.ScreeningEvent,
64
- isNew: false,
65
- useInform: true
66
- })(repos
67
- // スケジュールによるイベント作成ではendDateに変更がないのでpendingReservationsへの同期はひとまず必要なし
68
- );
69
- });
70
- }
71
- function createEvents(
72
- // schedule: factory.schedule.ISchedule4ttts | factory.schedule.IEventWithSchedule,
73
- schedule, createDate) {
74
- return (repos
75
- // settings: Settings
76
- ) => __awaiter(this, void 0, void 0, function* () {
77
- const creatingEvents = yield (0, schedule2events_1.schedule2events)(schedule, createDate)(repos);
78
- for (const eventAttributes of creatingEvents) {
79
- // domain.serviceで実装(2022-09-10~)
80
- debug('updating event...', eventAttributes.identifier, eventAttributes.startDate);
81
- yield updateEvent4ttts({
82
- // oldEventId,
83
- attributes: eventAttributes,
84
- project: { id: eventAttributes.project.id }
85
- // agent: eventAttributes.project
86
- })(repos
87
- // settings
88
- );
89
- debug('event update(updateEvent4ttts)', eventAttributes.identifier, eventAttributes.startDate);
90
- }
91
- debug(creatingEvents.length, 'events updated');
92
- });
93
- }
94
- function createEventBySchedule(params) {
95
- return (repos
96
- // settings: Settings
97
- ) => __awaiter(this, void 0, void 0, function* () {
98
- const schedule = yield repos.schedule.findOne({
99
- id: { $eq: params.object.eventSchedule.id },
100
- project: { id: { $eq: params.project.id } }
101
- });
102
- if (schedule === null) {
103
- throw new factory.errors.NotFound('Schedule');
104
- }
105
- yield createEvents(schedule, (params.object.startDate instanceof Date) ? params.object.startDate : new Date())(repos);
106
- });
107
- }
@@ -1,13 +0,0 @@
1
- import * as factory from '../../../factory';
2
- import type { ActionRepo } from '../../../repo/action';
3
- import type { EventRepo } from '../../../repo/event';
4
- import type { EventSeriesRepo } from '../../../repo/eventSeries';
5
- import type { MovieTheaterRepo } from '../../../repo/place/movieTheater';
6
- import type { TaskRepo } from '../../../repo/task';
7
- export declare function createEventSeries(params: factory.task.createEvent.IAddEventSeriesAction): (repos: {
8
- action: ActionRepo;
9
- event: EventRepo;
10
- eventSeries: EventSeriesRepo;
11
- movieTheater: MovieTheaterRepo;
12
- task: TaskRepo;
13
- }) => Promise<void>;