@chevre/domain 28.0.0-alpha.4 → 28.0.0-alpha.40

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 (150) hide show
  1. package/lib/chevre/emailMessageBuilder.js +1 -1
  2. package/lib/chevre/factory/event.d.ts +1 -1
  3. package/lib/chevre/factory/event.js +1 -5
  4. package/lib/chevre/repo/acceptedOffer.d.ts +6 -5
  5. package/lib/chevre/repo/acceptedOffer.js +14 -9
  6. package/lib/chevre/repo/acceptedOfferInReserve.d.ts +6 -8
  7. package/lib/chevre/repo/acceptedOfferInReserve.js +13 -7
  8. package/lib/chevre/repo/adminAcceptedOffer.d.ts +25 -12
  9. package/lib/chevre/repo/adminAcceptedOffer.js +20 -10
  10. package/lib/chevre/repo/adminAccountTitle.d.ts +49 -0
  11. package/lib/chevre/repo/adminAccountTitle.js +212 -0
  12. package/lib/chevre/repo/adminAccountTitleCategory.d.ts +37 -0
  13. package/lib/chevre/repo/adminAccountTitleCategory.js +127 -0
  14. package/lib/chevre/repo/adminAccountTitleSet.d.ts +42 -0
  15. package/lib/chevre/repo/adminAccountTitleSet.js +149 -0
  16. package/lib/chevre/repo/adminEvent.d.ts +1 -7
  17. package/lib/chevre/repo/adminEvent.js +3 -9
  18. package/lib/chevre/repo/adminEventSeries.d.ts +67 -0
  19. package/lib/chevre/repo/adminEventSeries.js +178 -0
  20. package/lib/chevre/repo/{paymentServiceChannel.d.ts → adminPaymentServiceChannel.d.ts} +13 -11
  21. package/lib/chevre/repo/{paymentServiceChannel.js → adminPaymentServiceChannel.js} +20 -19
  22. package/lib/chevre/repo/adminTask.d.ts +2 -2
  23. package/lib/chevre/repo/adminTransaction.d.ts +20 -30
  24. package/lib/chevre/repo/aggregateEvent.js +0 -1
  25. package/lib/chevre/repo/categoryCode.js +0 -21
  26. package/lib/chevre/repo/event.d.ts +2 -2
  27. package/lib/chevre/repo/event.js +71 -110
  28. package/lib/chevre/repo/eventSeries.d.ts +5 -84
  29. package/lib/chevre/repo/eventSeries.js +21 -212
  30. package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.d.ts +1 -1
  31. package/lib/chevre/repo/issuer.d.ts +2 -6
  32. package/lib/chevre/repo/memberProgram.d.ts +1 -38
  33. package/lib/chevre/repo/memberProgram.js +1 -62
  34. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +1 -1
  35. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +21 -25
  36. package/lib/chevre/repo/mongoose/schemas/civicStructure.d.ts +1 -0
  37. package/lib/chevre/repo/mongoose/schemas/event.js +0 -13
  38. package/lib/chevre/repo/mongoose/schemas/eventSeries.js +1 -18
  39. package/lib/chevre/repo/mongoose/schemas/issuer.d.ts +1 -3
  40. package/lib/chevre/repo/mongoose/schemas/issuer.js +0 -10
  41. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +0 -1
  42. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +3 -12
  43. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +1 -2
  44. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +6 -15
  45. package/lib/chevre/repo/mongoose/schemas/order.d.ts +22 -1
  46. package/lib/chevre/repo/mongoose/schemas/paymentServiceChannel.d.ts +1 -1
  47. package/lib/chevre/repo/mongoose/schemas/place.js +0 -9
  48. package/lib/chevre/repo/mongoose/schemas/project.d.ts +1 -2
  49. package/lib/chevre/repo/mongoose/schemas/project.js +1 -1
  50. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +3 -1
  51. package/lib/chevre/repo/mongoose/schemas/seller.js +0 -2
  52. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +1 -1
  53. package/lib/chevre/repo/mongoose/schemas/transaction.js +51 -52
  54. package/lib/chevre/repo/offerCatalog.d.ts +0 -2
  55. package/lib/chevre/repo/offerCatalogItem.d.ts +13 -20
  56. package/lib/chevre/repo/offerCatalogItem.js +8 -86
  57. package/lib/chevre/repo/order.d.ts +2 -2
  58. package/lib/chevre/repo/order.js +0 -31
  59. package/lib/chevre/repo/orderInTransaction.d.ts +5 -25
  60. package/lib/chevre/repo/place/movieTheater.d.ts +3 -1
  61. package/lib/chevre/repo/place/movieTheater.js +3 -1
  62. package/lib/chevre/repo/place/{hasPOS.d.ts → pos.d.ts} +13 -20
  63. package/lib/chevre/repo/place/{hasPOS.js → pos.js} +66 -29
  64. package/lib/chevre/repo/place/screeningRoom.d.ts +24 -3
  65. package/lib/chevre/repo/place/screeningRoom.js +28 -17
  66. package/lib/chevre/repo/priceSpecification.d.ts +8 -8
  67. package/lib/chevre/repo/project.d.ts +2 -8
  68. package/lib/chevre/repo/project.js +0 -12
  69. package/lib/chevre/repo/projectMakesOffer.js +2 -2
  70. package/lib/chevre/repo/role.d.ts +1 -1
  71. package/lib/chevre/repo/role.js +1 -30
  72. package/lib/chevre/repo/seller.d.ts +11 -4
  73. package/lib/chevre/repo/seller.js +31 -58
  74. package/lib/chevre/repo/sellerPaymentAccepted.d.ts +14 -21
  75. package/lib/chevre/repo/sellerPaymentAccepted.js +65 -38
  76. package/lib/chevre/repo/task.d.ts +3 -3
  77. package/lib/chevre/repo/transaction/placeOrder.d.ts +2 -3
  78. package/lib/chevre/repo/transaction/placeOrder.js +15 -36
  79. package/lib/chevre/repository.d.ts +30 -15
  80. package/lib/chevre/repository.js +63 -30
  81. package/lib/chevre/service/aggregation/event/aggregateOffers.js +1 -2
  82. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -2
  83. package/lib/chevre/service/aggregation.d.ts +0 -2
  84. package/lib/chevre/service/aggregation.js +1 -3
  85. package/lib/chevre/service/assetTransaction/pay/start/preStart/validateAcceptedPaymentMethodIfNeeded.js +1 -2
  86. package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.js +2 -2
  87. package/lib/chevre/service/assetTransaction/reserve/start.js +2 -1
  88. package/lib/chevre/service/delivery/reservation/factory.d.ts +1 -1
  89. package/lib/chevre/service/event/saveScreeningEventSeries.d.ts +2 -2
  90. package/lib/chevre/service/event/saveScreeningEventSeries.js +2 -3
  91. package/lib/chevre/service/event/saveScreeningEvents.d.ts +2 -0
  92. package/lib/chevre/service/event/saveScreeningEvents.js +4 -4
  93. package/lib/chevre/service/event.d.ts +2 -0
  94. package/lib/chevre/service/event.js +0 -1
  95. package/lib/chevre/service/notification/sendEmailMessage.d.ts +2 -0
  96. package/lib/chevre/service/notification/sendEmailMessage.js +23 -6
  97. package/lib/chevre/service/offer/any.d.ts +1 -1
  98. package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -3
  99. package/lib/chevre/service/offer/event/authorize/factory.js +1 -8
  100. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
  101. package/lib/chevre/service/offer/event/issueEventOfferTicket.js +0 -11
  102. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -10
  103. package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +2 -8
  104. package/lib/chevre/service/offer/event/searchOfferCatalogItems.js +2 -2
  105. package/lib/chevre/service/offer/event/searchOffersByIds.js +3 -9
  106. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +0 -1
  107. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -1
  108. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +0 -7
  109. package/lib/chevre/service/offer/onEventChanged.js +9 -21
  110. package/lib/chevre/service/offer.js +1 -2
  111. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +4 -6
  112. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +23 -4
  113. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +1 -1
  114. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.d.ts +1 -1
  115. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +1 -1
  116. package/lib/chevre/service/order/placeOrder/factory/orderedItem.d.ts +1 -1
  117. package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
  118. package/lib/chevre/service/order/sendOrder.js +2 -14
  119. package/lib/chevre/service/payment/creditCard/getGMOInfoFromSeller.js +1 -1
  120. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.d.ts +3 -3
  121. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +1 -1
  122. package/lib/chevre/service/payment/movieTicket/payMovieTicket/payActionParams2seatInfoSyncIn.js +1 -1
  123. package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
  124. package/lib/chevre/service/project.d.ts +3 -3
  125. package/lib/chevre/service/project.js +1 -1
  126. package/lib/chevre/service/task/importEventsFromCOA.js +2 -0
  127. package/lib/chevre/service/task/onResourceDeleted.js +8 -8
  128. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +7 -3
  129. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +51 -50
  130. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +1 -1
  131. package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +1 -1
  132. package/lib/chevre/service/task/onResourceUpdated.js +10 -47
  133. package/lib/chevre/service/task/sendEmailMessage.js +3 -1
  134. package/lib/chevre/service/task/syncResourcesFromCOA.js +5 -3
  135. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +1 -2
  136. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +0 -5
  137. package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +1 -1
  138. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +1 -1
  139. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.d.ts +1 -1
  140. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +2 -2
  141. package/lib/chevre/service/transaction/placeOrder/confirm.js +0 -5
  142. package/lib/chevre/service/transaction/returnOrder/preStart/factory.d.ts +1 -1
  143. package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -2
  144. package/package.json +2 -2
  145. package/lib/chevre/repo/accountTitle.d.ts +0 -28
  146. package/lib/chevre/repo/accountTitle.js +0 -30
  147. package/lib/chevre/service/aggregation/project.d.ts +0 -17
  148. package/lib/chevre/service/aggregation/project.js +0 -98
  149. package/lib/chevre/service/delivery/factory.d.ts +0 -16
  150. package/lib/chevre/service/delivery/factory.js +0 -124
@@ -71,7 +71,7 @@ function createEmailMessageSender(params, setting) {
71
71
  name: (typeof params.email?.sender?.name === 'string')
72
72
  ? params.email.sender.name
73
73
  : defaultSellerName,
74
- email: setting.defaultSenderEmail
74
+ email: setting.defaultSenderEmail // 送信元未指定であればタスクで自動設定されるがとりあえず指定(2026-10-20~)
75
75
  };
76
76
  }
77
77
  /**
@@ -4,5 +4,5 @@ export type IMinimizedIndividualEvent = Pick<factory.event.screeningEvent.IEvent
4
4
  * 興行イベントのsuperEventを作成する
5
5
  */
6
6
  export declare function minimizeSuperEvent(params: {
7
- superEventFromDB: Pick<factory.eventSeries.IEvent, 'additionalProperty' | 'alternativeHeadline' | 'description' | 'dubLanguage' | 'endDate' | 'headline' | 'id' | 'kanaName' | 'location' | 'name' | 'soundFormat' | 'startDate' | 'subtitleLanguage' | 'typeOf' | 'workPerformed'>;
7
+ superEventFromDB: Pick<factory.eventSeries.IEvent, 'additionalProperty' | 'alternativeHeadline' | 'description' | 'dubLanguage' | 'endDate' | 'headline' | 'id' | 'kanaName' | 'location' | 'name' | 'startDate' | 'subtitleLanguage' | 'typeOf' | 'workPerformed'>;
8
8
  }): factory.event.screeningEvent.ISuperEvent;
@@ -29,15 +29,11 @@ function minimizeSuperEvent(params) {
29
29
  ...(params.superEventFromDB.location.name !== undefined)
30
30
  ? { name: params.superEventFromDB.location.name }
31
31
  : undefined
32
- // 廃止(2024-03-05~)
33
- // ...(typeof params.superEventFromDB.location.kanaName === 'string')
34
- // ? { kanaName: params.superEventFromDB.location.kanaName }
35
- // : undefined
36
32
  };
37
33
  return {
38
34
  typeOf: factory_1.factory.eventType.ScreeningEventSeries,
39
35
  id: params.superEventFromDB.id,
40
- soundFormat: params.superEventFromDB.soundFormat,
36
+ // soundFormat: params.superEventFromDB.soundFormat, // discontinue(2026-10-05~)
41
37
  workPerformed,
42
38
  location,
43
39
  kanaName: params.superEventFromDB.kanaName,
@@ -1,9 +1,9 @@
1
1
  import type { Connection } from 'mongoose';
2
- import { AcceptedOfferInReserveRepo, IAcceptedOffer } from './acceptedOfferInReserve';
2
+ import { factory } from '../factory';
3
+ import { AcceptedOfferInReserveRepo } from './acceptedOfferInReserve';
3
4
  type IDistinctField = 'acceptedOffers.id' | 'acceptedOffers.itemOffered.reservationNumber' | 'acceptedOffers.itemOffered.reservationFor.id' | 'acceptedOffers.serialNumber' | 'acceptedOffers.offeredThrough.identifier' | 'acceptedOffers.itemOffered.reservationFor.superEvent.location.branchCode';
4
5
  interface ISearchSlicedAcceptedOffersResult {
5
- acceptedOffers: Pick<IAcceptedOffer, 'id' | 'itemOffered' | 'offeredThrough' | 'priceSpecification' | 'serialNumber' | 'typeOf'>[];
6
- numAcceptedOffers: number;
6
+ partialAcceptedOffers: Pick<factory.acceptedOffer.IAcceptedOffer, 'id' | 'itemOffered' | 'offeredThrough' | 'priceSpecification' | 'serialNumber' | 'typeOf'>[];
7
7
  }
8
8
  /**
9
9
  * 注文オファーリポジトリ
@@ -41,11 +41,12 @@ export declare class AcceptedOfferRepo extends AcceptedOfferInReserveRepo {
41
41
  reservedTicket?: never;
42
42
  };
43
43
  };
44
- }): Promise<Pick<IAcceptedOffer, 'id' | 'itemOffered' | 'offeredThrough' | 'priceSpecification' | 'serialNumber' | 'typeOf'>[]>;
44
+ }): Promise<Pick<factory.acceptedOffer.IAcceptedOffer, 'id' | 'itemOffered' | 'offeredThrough' | 'priceSpecification' | 'serialNumber' | 'typeOf'>[]>;
45
45
  /**
46
46
  * 注文オファーをsliceして検索する(2024-01-10~)
47
+ * 注文通知に渡すオファーを参照するためにのみ使用
47
48
  */
48
- searchSlicedAcceptedOffersByOrderNumber(filter: {
49
+ findPartialAcceptedOffersByOrderNumber(filter: {
49
50
  $slice: [number, number];
50
51
  orderNumber: {
51
52
  $eq: string;
@@ -69,17 +69,22 @@ class AcceptedOfferRepo extends acceptedOfferInReserve_1.AcceptedOfferInReserveR
69
69
  }
70
70
  /**
71
71
  * 注文オファーをsliceして検索する(2024-01-10~)
72
+ * 注文通知に渡すオファーを参照するためにのみ使用
72
73
  */
73
- async searchSlicedAcceptedOffersByOrderNumber(filter) {
74
+ async findPartialAcceptedOffersByOrderNumber(filter) {
74
75
  const aggregate = this.orderModel.aggregate([
75
- { $match: { orderNumber: { $eq: filter.orderNumber.$eq } } },
76
- { $match: { 'project.id': { $eq: filter.project.id.$eq } } },
77
- { $match: { typeOf: { $eq: factory_1.factory.order.OrderType.Order } } },
76
+ {
77
+ $match: {
78
+ orderNumber: { $eq: filter.orderNumber.$eq },
79
+ 'project.id': { $eq: filter.project.id.$eq },
80
+ typeOf: { $eq: factory_1.factory.order.OrderType.Order }
81
+ }
82
+ },
78
83
  {
79
84
  $project: {
80
85
  _id: 0,
81
- acceptedOffers: { $slice: ['$acceptedOffers', ...filter.$slice] },
82
- numAcceptedOffers: { $size: '$acceptedOffers' }
86
+ partialAcceptedOffers: { $slice: ['$acceptedOffers', ...filter.$slice] },
87
+ // numAcceptedOffers: { $size: '$acceptedOffers' }
83
88
  }
84
89
  }
85
90
  ]);
@@ -89,11 +94,11 @@ class AcceptedOfferRepo extends acceptedOfferInReserve_1.AcceptedOfferInReserveR
89
94
  if (result === undefined) {
90
95
  throw new factory_1.factory.errors.NotFound(factory_1.factory.order.OrderType.Order);
91
96
  }
92
- const { acceptedOffers, numAcceptedOffers } = result;
97
+ const { partialAcceptedOffers } = result;
93
98
  // 予約取引を参照(2026-05-18~)
94
99
  return {
95
- acceptedOffers: await this.addAcceptedOffersDetails(acceptedOffers),
96
- numAcceptedOffers
100
+ partialAcceptedOffers: await this.addAcceptedOffersDetails(partialAcceptedOffers),
101
+ // numAcceptedOffers
97
102
  };
98
103
  }
99
104
  async countByOrderNumber(filter) {
@@ -1,14 +1,8 @@
1
1
  import type { Connection } from 'mongoose';
2
2
  import { factory } from '../factory';
3
3
  import { IModel } from './mongoose/schemas/assetTransaction';
4
+ import type { IAcceptedOfferInDoc } from './mongoose/schemas/order';
4
5
  import { IAcceptedOfferByReserveTransaction } from './factory/acceptedOffer/reserveTransaction2itemOffered';
5
- export type IAcceptedOffer = Pick<factory.order.IAcceptedOffer, 'id' | 'itemOffered' | 'offeredThrough' | 'serialNumber' | 'typeOf'> & {
6
- /**
7
- * COA以外では注文ドキュメントにpriceSpecificationが存在しないのでIFを補完
8
- */
9
- priceSpecification?: factory.order.ITicketPriceSpecification;
10
- name?: never;
11
- };
12
6
  /**
13
7
  * 予約取引に依存した注文オファーリポジトリ
14
8
  */
@@ -27,5 +21,9 @@ export declare class AcceptedOfferInReserveRepo {
27
21
  /**
28
22
  * 予約取引からオファー詳細情報を付加する
29
23
  */
30
- protected addAcceptedOffersDetails(acceptedOffers: IAcceptedOffer[]): Promise<IAcceptedOffer[]>;
24
+ protected addAcceptedOffersDetails(
25
+ /**
26
+ * 注文ドキュメント内の生オファーを受け取る
27
+ */
28
+ acceptedOffers: IAcceptedOfferInDoc[]): Promise<factory.acceptedOffer.IAcceptedOffer[]>;
31
29
  }
@@ -41,7 +41,11 @@ class AcceptedOfferInReserveRepo {
41
41
  /**
42
42
  * 予約取引からオファー詳細情報を付加する
43
43
  */
44
- async addAcceptedOffersDetails(acceptedOffers) {
44
+ async addAcceptedOffersDetails(
45
+ /**
46
+ * 注文ドキュメント内の生オファーを受け取る
47
+ */
48
+ acceptedOffers) {
45
49
  const offeredThroughIdentifier = acceptedOffers.at(0)?.offeredThrough?.identifier;
46
50
  if (offeredThroughIdentifier === factory_1.factory.service.webAPI.Identifier.COA) {
47
51
  // COAでは予約取引を参照しない
@@ -67,18 +71,20 @@ class AcceptedOfferInReserveRepo {
67
71
  // itemOfferedByReserveは必ず存在するはず
68
72
  if (itemOfferedByReserve === undefined) {
69
73
  console.error('repo:acceptedOffer: addAcceptedOffersDetails: itemOfferedByReserve: undefined!!!', acceptedOffer.itemOffered.id);
74
+ throw new factory_1.factory.errors.Internal(`itemOfferedByReserve not found. itemOffered.id:${acceptedOffer.itemOffered.id}`);
70
75
  }
71
- const nameByReserveTransaction = acceptedOfferByReserveTransaction?.name;
76
+ // const nameByReserveTransaction = acceptedOfferByReserveTransaction?.name;
72
77
  const { priceSpecification: _originalPriceSpec, // 注文ドキュメントのpriceSpecificationはもう採用しない(2026-05-21~)
73
78
  name: _originalName, // 注文ドキュメントのnameはもう採用しない(2026-06-09~)
74
- itemOffered, ...acceptedOfferWithoutPrice } = acceptedOffer;
79
+ itemOffered: _itemOffered, ...acceptedOfferWithoutPrice } = acceptedOffer;
75
80
  return {
76
81
  ...acceptedOfferWithoutPrice,
77
- ...((nameByReserveTransaction !== undefined) && { name: nameByReserveTransaction }), // 予約取引参照の値で上書き(2026-06-09~)
82
+ // ...((nameByReserveTransaction !== undefined) && { name: nameByReserveTransaction }), // 予約取引参照の値で上書き(2026-06-09~)
78
83
  ...((priceSpecByReserveTransaction !== undefined) && { priceSpecification: priceSpecByReserveTransaction }), // 予約取引参照の値で上書き
79
- ...(itemOfferedByReserve !== undefined)
80
- ? { itemOffered: itemOfferedByReserve } // 予約取引参照の値で上書き
81
- : { itemOffered }
84
+ itemOffered: itemOfferedByReserve // 予約取引参照の値で上書き
85
+ // ...(itemOfferedByReserve !== undefined)
86
+ // ? { itemOffered: itemOfferedByReserve } // 予約取引参照の値で上書き
87
+ // : { itemOffered }
82
88
  };
83
89
  });
84
90
  }
@@ -1,22 +1,23 @@
1
1
  import type { Connection } from 'mongoose';
2
2
  import { factory } from '../factory';
3
- import { AcceptedOfferInReserveRepo, IAcceptedOffer } from './acceptedOfferInReserve';
3
+ import { AcceptedOfferInReserveRepo } from './acceptedOfferInReserve';
4
4
  type IProjection4searchWithUnwoundAcceptedOffers = {
5
5
  [key in keyof factory.order.IOrder]?: 1;
6
6
  } & {};
7
- type IMinimizedReservationFor = Pick<IAcceptedOffer['itemOffered']['reservationFor'], 'id' | 'typeOf'>;
8
- type IMinimizedItemOffered = Pick<IAcceptedOffer['itemOffered'], 'additionalProperty' | 'additionalTicketText' | 'id' | 'issuedThrough' | 'programMembershipUsed' | 'reservationNumber' | 'reservedTicket' | 'typeOf'> & {
7
+ type IMinimizedReservationFor = Pick<factory.acceptedOffer.IAcceptedOffer['itemOffered']['reservationFor'], 'id' | 'typeOf'>;
8
+ type IMinimizedItemOffered = Pick<factory.acceptedOffer.IAcceptedOffer['itemOffered'], 'additionalProperty' | 'additionalTicketText' | 'programMembershipUsed' | 'id' | 'reservationNumber' | 'reservedTicket' | 'typeOf'> & {
9
9
  reservationFor: IMinimizedReservationFor;
10
+ issuedThrough?: factory.acceptedOffer.IAcceptedOffer['itemOffered']['issuedThrough'];
10
11
  };
11
- type IMinimizedAcceptedOffer = Pick<IAcceptedOffer, 'id' | 'name' | 'offeredThrough' | 'priceSpecification' | 'serialNumber' | 'typeOf'> & {
12
+ type IMinimizedAcceptedOffer = Pick<factory.acceptedOffer.IAcceptedOffer, 'id' | 'name' | 'offeredThrough' | 'priceSpecification' | 'serialNumber' | 'typeOf'> & {
12
13
  itemOffered: IMinimizedItemOffered;
13
14
  };
14
- type IAcceptedOfferInOrder = Pick<IAcceptedOffer, 'id' | 'offeredThrough' | 'priceSpecification' | 'serialNumber' | 'typeOf'> & {
15
+ type IAcceptedOfferAsFindResult = Pick<factory.acceptedOffer.IAcceptedOffer, 'id' | 'offeredThrough' | 'priceSpecification' | 'serialNumber' | 'typeOf'> & {
15
16
  /**
16
- * reservationFor最小化に対応
17
- * 2026-09-01~
17
+ * 常に最小化
18
+ * 2026-10-08~
18
19
  */
19
- itemOffered: IAcceptedOffer['itemOffered'] | IMinimizedItemOffered;
20
+ itemOffered: IMinimizedItemOffered;
20
21
  };
21
22
  /**
22
23
  * 注文オファー管理リポジトリ
@@ -36,10 +37,16 @@ export declare class AdminAcceptedOfferRepo extends AcceptedOfferInReserveRepo {
36
37
  /**
37
38
  * reservationForをid属性のみにするオプション
38
39
  * 2026-08-31~
40
+ * always true(2026-10-08~)
41
+ */
42
+ minimizeReservationFor: true;
43
+ /**
44
+ * reservedTicket以外の属性を除外するオプション
45
+ * 2026-10-08~
39
46
  */
40
- minimizeReservationFor: boolean;
47
+ onlyReservedTicket: boolean;
41
48
  }): Promise<(factory.order.IOrder & {
42
- acceptedOffers: [IAcceptedOffer | IMinimizedAcceptedOffer];
49
+ acceptedOffers: [IMinimizedAcceptedOffer];
43
50
  _id?: never;
44
51
  })[]>;
45
52
  /**
@@ -57,8 +64,14 @@ export declare class AdminAcceptedOfferRepo extends AcceptedOfferInReserveRepo {
57
64
  /**
58
65
  * reservationForをid属性のみにするオプション
59
66
  * 2026-08-31~
67
+ * always true(2026-10-08~)
68
+ */
69
+ minimizeReservationFor: true;
70
+ /**
71
+ * reservedTicket以外の属性を除外するオプション
72
+ * 2026-10-08~
60
73
  */
61
- minimizeReservationFor: boolean;
62
- }): Promise<IAcceptedOfferInOrder[]>;
74
+ onlyReservedTicket: boolean;
75
+ }): Promise<IAcceptedOfferAsFindResult[]>;
63
76
  }
64
77
  export {};
@@ -7,14 +7,22 @@ const settings_1 = require("../settings");
7
7
  const acceptedOfferInReserve_1 = require("./acceptedOfferInReserve");
8
8
  const order_2 = require("./order");
9
9
  function minimizeItemOffered(itemOffered, options) {
10
- const { minimizeReservationFor } = options;
10
+ const { minimizeReservationFor, onlyReservedTicket } = options;
11
11
  if (minimizeReservationFor) {
12
12
  const { reservationFor, ...itemOfferedWithoutEvent } = itemOffered;
13
- const { id, typeOf } = reservationFor;
14
- return {
15
- ...itemOfferedWithoutEvent,
16
- reservationFor: { id, typeOf }
17
- };
13
+ if (onlyReservedTicket) {
14
+ const { id, reservationNumber, reservedTicket, typeOf } = itemOfferedWithoutEvent;
15
+ return {
16
+ id, reservationNumber, reservedTicket, typeOf,
17
+ reservationFor: { id: reservationFor.id, typeOf: reservationFor.typeOf }
18
+ };
19
+ }
20
+ else {
21
+ return {
22
+ ...itemOfferedWithoutEvent,
23
+ reservationFor: { id: reservationFor.id, typeOf: reservationFor.typeOf }
24
+ };
25
+ }
18
26
  }
19
27
  else {
20
28
  return itemOffered;
@@ -94,11 +102,12 @@ class AdminAcceptedOfferRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
94
102
  // itemOfferedByReserveは必ず存在するはず
95
103
  if (itemOfferedByReserve === undefined) {
96
104
  console.error('repo:acceptedOffer: searchWithUnwoundAcceptedOffers: itemOfferedByReserve: undefined!!!', acceptedOffer.itemOffered.id);
105
+ throw new factory_1.factory.errors.Internal(`itemOfferedByReserve not found. itemOffered.id:${acceptedOffer.itemOffered.id}`);
97
106
  }
98
107
  const nameByReserveTransaction = acceptedOfferByReserveTransaction?.name;
99
108
  const { priceSpecification: _originalPriceSpec, // 注文ドキュメントのpriceSpecificationはもう採用しない(2026-05-21~)
100
109
  name: _originalName, // 注文ドキュメントのnameはもう採用しない(2026-06-09~)
101
- itemOffered, ...acceptedOfferWithoutPrice } = acceptedOffer;
110
+ itemOffered: _itemOffered, ...acceptedOfferWithoutPrice } = acceptedOffer;
102
111
  return {
103
112
  ...order,
104
113
  acceptedOffers: [
@@ -106,9 +115,10 @@ class AdminAcceptedOfferRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
106
115
  ...acceptedOfferWithoutPrice,
107
116
  ...((nameByReserveTransaction !== undefined) && { name: nameByReserveTransaction }), // 予約取引参照の値で上書き(2026-06-09~)
108
117
  ...((priceSpecByReserveTransaction !== undefined) && { priceSpecification: priceSpecByReserveTransaction }), // 予約取引参照の値で上書き
109
- ...(itemOfferedByReserve !== undefined)
110
- ? { itemOffered: minimizeItemOffered(itemOfferedByReserve, options) } // 予約取引参照の値で上書き(2026-05-25~)
111
- : { itemOffered: minimizeItemOffered(itemOffered, options) }
118
+ itemOffered: minimizeItemOffered(itemOfferedByReserve, options) // 予約取引参照の値で上書き(2026-05-25~)
119
+ // ...(itemOfferedByReserve !== undefined)
120
+ // ? { itemOffered: minimizeItemOffered(itemOfferedByReserve, options) } // 予約取引参照の値で上書き(2026-05-25~)
121
+ // : { itemOffered: minimizeItemOffered(itemOffered, options) }
112
122
  }
113
123
  ]
114
124
  };
@@ -0,0 +1,49 @@
1
+ import type { Connection } from 'mongoose';
2
+ import { factory } from '../factory';
3
+ type IFindParams = Pick<factory.accountTitle.ISearchConditions, 'codeValue' | 'limit' | 'name' | 'page' | 'project' | 'additionalProperty' | 'inCodeSet'>;
4
+ /**
5
+ * 細目管理リポジトリ
6
+ */
7
+ export declare class AdminAccountTitleRepo {
8
+ private readonly accountTitleModel;
9
+ constructor(connection: Connection);
10
+ addAccountTitle(params: Pick<factory.accountTitle.IAccountTitle, 'codeValue' | 'name' | 'project' | 'additionalProperty'> & {
11
+ inCodeSet: {
12
+ codeValue: string;
13
+ inCodeSet: {
14
+ codeValue: string;
15
+ };
16
+ };
17
+ }): Promise<{
18
+ id: string;
19
+ }>;
20
+ updateAccountTitle(params: Pick<factory.accountTitle.IAccountTitle, 'codeValue' | 'name' | 'project' | 'additionalProperty'> & {
21
+ inCodeSet: {
22
+ codeValue: string;
23
+ inCodeSet: {
24
+ codeValue: string;
25
+ };
26
+ };
27
+ }): Promise<{
28
+ id: string;
29
+ }>;
30
+ findAccountTitles(params: IFindParams): Promise<(Pick<factory.accountTitle.IAccountTitle, 'codeValue' | 'name' | 'additionalProperty'> & {
31
+ inCodeSet: {
32
+ codeValue: string;
33
+ name?: string;
34
+ inCodeSet: {
35
+ codeValue: string;
36
+ name?: string;
37
+ };
38
+ };
39
+ })[]>;
40
+ deleteAccountTitleByCodeValue(params: {
41
+ projectId: string;
42
+ codeValue: string;
43
+ accountTitleCategoryCode: string;
44
+ accountTitleSetCode: string;
45
+ }): Promise<{
46
+ id: string;
47
+ }>;
48
+ }
49
+ export {};
@@ -0,0 +1,212 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdminAccountTitleRepo = void 0;
4
+ const factory_1 = require("../factory");
5
+ const accountTitle_1 = require("./mongoose/schemas/accountTitle");
6
+ function createMatchStages(params) {
7
+ const matchStages = [];
8
+ const projectIdEq = params.project?.id?.$eq;
9
+ if (typeof projectIdEq === 'string') {
10
+ matchStages.push({
11
+ $match: { 'project.id': { $eq: projectIdEq } }
12
+ });
13
+ }
14
+ const nameRegex = params.name;
15
+ if (typeof nameRegex === 'string') {
16
+ matchStages.push({
17
+ $match: { 'hasCategoryCode.hasCategoryCode.name': { $exists: true, $regex: new RegExp(nameRegex) } }
18
+ });
19
+ }
20
+ if (typeof params.codeValue === 'string') {
21
+ matchStages.push({
22
+ $match: { 'hasCategoryCode.hasCategoryCode.codeValue': { $exists: true, $regex: new RegExp(params.codeValue) } }
23
+ });
24
+ }
25
+ else {
26
+ const codeValueEq = params.codeValue?.$eq;
27
+ if (typeof codeValueEq === 'string') {
28
+ matchStages.push({
29
+ $match: { 'hasCategoryCode.hasCategoryCode.codeValue': { $exists: true, $eq: codeValueEq } }
30
+ });
31
+ }
32
+ }
33
+ const inCodeSetCodeValue = params.inCodeSet?.codeValue;
34
+ if (typeof inCodeSetCodeValue === 'string') {
35
+ matchStages.push({
36
+ $match: { 'hasCategoryCode.codeValue': { $exists: true, $regex: new RegExp(inCodeSetCodeValue) } }
37
+ });
38
+ }
39
+ else {
40
+ const inCodeSetCodeValueEq = inCodeSetCodeValue?.$eq;
41
+ if (typeof inCodeSetCodeValueEq === 'string') {
42
+ matchStages.push({
43
+ $match: { 'hasCategoryCode.codeValue': { $exists: true, $eq: inCodeSetCodeValueEq } }
44
+ });
45
+ }
46
+ }
47
+ const accountTitleCategoryCode = params.inCodeSet?.inCodeSet?.codeValue;
48
+ if (typeof accountTitleCategoryCode === 'string') {
49
+ matchStages.push({
50
+ $match: { codeValue: { $exists: true, $regex: new RegExp(accountTitleCategoryCode) } }
51
+ });
52
+ }
53
+ else {
54
+ const accountTitleCategoryCodeEq = accountTitleCategoryCode?.$eq;
55
+ if (typeof accountTitleCategoryCodeEq === 'string') {
56
+ matchStages.push({
57
+ $match: { codeValue: { $exists: true, $eq: accountTitleCategoryCodeEq } }
58
+ });
59
+ }
60
+ }
61
+ const additionalPropertyElemMatch = params.additionalProperty?.$elemMatch;
62
+ if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
63
+ matchStages.push({
64
+ $match: { 'hasCategoryCode.hasCategoryCode.additionalProperty': { $exists: true, $elemMatch: additionalPropertyElemMatch } }
65
+ });
66
+ }
67
+ return matchStages;
68
+ }
69
+ /**
70
+ * 細目管理リポジトリ
71
+ */
72
+ class AdminAccountTitleRepo {
73
+ accountTitleModel;
74
+ constructor(connection) {
75
+ this.accountTitleModel = connection.model(accountTitle_1.modelName, (0, accountTitle_1.createSchema)());
76
+ }
77
+ async addAccountTitle(params) {
78
+ const { codeValue, name, project, inCodeSet, additionalProperty } = params;
79
+ // 科目の存在確認
80
+ const categoryDoc = await this.accountTitleModel.findOne({
81
+ 'project.id': { $eq: project.id },
82
+ codeValue: { $eq: inCodeSet.inCodeSet.codeValue },
83
+ 'hasCategoryCode.codeValue': { $eq: inCodeSet.codeValue }
84
+ }, { _id: 1 })
85
+ .exec();
86
+ if (categoryDoc === null) {
87
+ throw new factory_1.factory.errors.NotFound('AccountTitleSet');
88
+ }
89
+ const newAccountTitle = {
90
+ typeOf: 'AccountTitle',
91
+ codeValue,
92
+ additionalProperty: (Array.isArray(additionalProperty)) ? additionalProperty : [],
93
+ ...(typeof name === 'string') && { name }
94
+ };
95
+ // プロジェクト内での細目コード重複確認(インデックスは保証できない)
96
+ const existingAccountTitle = await this.accountTitleModel.findOne({
97
+ 'project.id': { $eq: project.id },
98
+ // codeValue: { $eq: accountTitleCategory.codeValue },
99
+ // 'hasCategoryCode.codeValue': {
100
+ // $exists: true,
101
+ // $eq: accountTitleSet.codeValue
102
+ // },
103
+ 'hasCategoryCode.hasCategoryCode.codeValue': { $exists: true, $eq: codeValue }
104
+ }, { _id: 1 })
105
+ .exec();
106
+ if (existingAccountTitle !== null) {
107
+ throw new factory_1.factory.errors.AlreadyInUse(accountTitle_1.modelName, ['codeValue'], 'codeValue duplicated');
108
+ }
109
+ const doc = await this.accountTitleModel.findOneAndUpdate({
110
+ 'project.id': { $eq: project.id },
111
+ codeValue: { $eq: inCodeSet.inCodeSet.codeValue },
112
+ 'hasCategoryCode.codeValue': { $eq: inCodeSet.codeValue },
113
+ 'hasCategoryCode.hasCategoryCode.codeValue': { $ne: codeValue }
114
+ }, {
115
+ $push: {
116
+ 'hasCategoryCode.$[accountTitleSet].hasCategoryCode': newAccountTitle
117
+ }
118
+ }, {
119
+ new: true,
120
+ arrayFilters: [
121
+ { 'accountTitleSet.codeValue': codeValue }
122
+ ],
123
+ projection: { _id: 1 }
124
+ })
125
+ .exec();
126
+ // 存在しなければ細目コード重複
127
+ if (doc === null) {
128
+ throw new factory_1.factory.errors.AlreadyInUse(accountTitle_1.modelName, ['hasCategoryCode.hasCategoryCode.codeValue']);
129
+ }
130
+ return { id: doc.id };
131
+ }
132
+ async updateAccountTitle(params) {
133
+ const { codeValue, name, project, inCodeSet, additionalProperty } = params;
134
+ const doc = await this.accountTitleModel.findOneAndUpdate({
135
+ 'project.id': { $eq: project.id },
136
+ codeValue: { $eq: inCodeSet.inCodeSet.codeValue },
137
+ 'hasCategoryCode.codeValue': { $eq: inCodeSet.codeValue },
138
+ 'hasCategoryCode.hasCategoryCode.codeValue': codeValue
139
+ }, {
140
+ // 'hasCategoryCode.$[accountTitleSet].hasCategoryCode.$[accountTitle].codeValue': accountTitle.codeValue,
141
+ ...(typeof name === 'string')
142
+ && { 'hasCategoryCode.$[accountTitleSet].hasCategoryCode.$[accountTitle].name': name },
143
+ ...(Array.isArray(additionalProperty))
144
+ && { 'hasCategoryCode.$[accountTitleSet].hasCategoryCode.$[accountTitle].additionalProperty': additionalProperty }
145
+ }, {
146
+ new: true,
147
+ arrayFilters: [
148
+ { 'accountTitleSet.codeValue': inCodeSet.codeValue },
149
+ { 'accountTitle.codeValue': codeValue }
150
+ ],
151
+ projection: { _id: 1 }
152
+ })
153
+ .exec();
154
+ if (doc === null) {
155
+ throw new factory_1.factory.errors.NotFound(accountTitle_1.modelName);
156
+ }
157
+ return { id: doc.id };
158
+ }
159
+ async findAccountTitles(params) {
160
+ const aggregate = this.accountTitleModel.aggregate([
161
+ { $unwind: '$hasCategoryCode' },
162
+ { $unwind: '$hasCategoryCode.hasCategoryCode' },
163
+ ...createMatchStages(params),
164
+ {
165
+ $project: {
166
+ _id: 0,
167
+ codeValue: '$hasCategoryCode.hasCategoryCode.codeValue',
168
+ name: '$hasCategoryCode.hasCategoryCode.name',
169
+ inCodeSet: {
170
+ codeValue: '$hasCategoryCode.codeValue',
171
+ name: '$hasCategoryCode.name',
172
+ inCodeSet: {
173
+ codeValue: '$codeValue',
174
+ name: '$name'
175
+ },
176
+ },
177
+ additionalProperty: '$hasCategoryCode.hasCategoryCode.additionalProperty'
178
+ }
179
+ }
180
+ ]);
181
+ if (typeof params.limit === 'number' && typeof params.page === 'number') {
182
+ aggregate.skip(params.limit * (params.page - 1))
183
+ .limit(params.limit);
184
+ }
185
+ return aggregate.exec();
186
+ }
187
+ async deleteAccountTitleByCodeValue(params) {
188
+ const { projectId, codeValue, accountTitleCategoryCode, accountTitleSetCode } = params;
189
+ const doc = await this.accountTitleModel.findOneAndUpdate({
190
+ 'project.id': { $eq: projectId },
191
+ codeValue: { $eq: accountTitleCategoryCode },
192
+ 'hasCategoryCode.codeValue': { $exists: true, $eq: accountTitleSetCode },
193
+ 'hasCategoryCode.hasCategoryCode.codeValue': { $exists: true, $eq: codeValue }
194
+ }, {
195
+ $pull: {
196
+ 'hasCategoryCode.$[accountTitleSet].hasCategoryCode': { codeValue }
197
+ }
198
+ }, {
199
+ new: true,
200
+ arrayFilters: [
201
+ { 'accountTitleSet.codeValue': accountTitleSetCode }
202
+ ],
203
+ projection: { _id: 1 }
204
+ })
205
+ .exec();
206
+ if (doc === null) {
207
+ throw new factory_1.factory.errors.NotFound(accountTitle_1.modelName);
208
+ }
209
+ return { id: doc.id };
210
+ }
211
+ }
212
+ exports.AdminAccountTitleRepo = AdminAccountTitleRepo;
@@ -0,0 +1,37 @@
1
+ import type { Connection } from 'mongoose';
2
+ import { factory } from '../factory';
3
+ type IFindParams = Pick<factory.accountTitle.ISearchConditions, 'codeValue' | 'limit' | 'name' | 'page' | 'project' | 'sort'>;
4
+ /**
5
+ * 科目分類管理リポジトリ
6
+ */
7
+ export declare class AdminAccountTitleCategoryRepo {
8
+ private readonly accountTitleModel;
9
+ constructor(connection: Connection);
10
+ findAccountTitleCategorAsNotification(params: {
11
+ id: string;
12
+ projectId: string;
13
+ }): Promise<Pick<factory.accountTitle.IAccountTitle, 'codeValue' | 'hasCategoryCode' | 'name' | 'project' | 'typeOf'> & {
14
+ id: string;
15
+ }>;
16
+ deleteAccountTitleCategoriesByProject(params: {
17
+ project: {
18
+ id: string;
19
+ };
20
+ }): Promise<void>;
21
+ addAccountTitleCategory(params: Pick<factory.accountTitle.IAccountTitle, 'codeValue' | 'name' | 'project'>): Promise<{
22
+ id: string;
23
+ }>;
24
+ updateAccountTitleCategory(params: Pick<factory.accountTitle.IAccountTitle, 'codeValue' | 'name' | 'project'>): Promise<{
25
+ id: string;
26
+ }>;
27
+ findAccountTitleCategories(params: IFindParams): Promise<Pick<factory.accountTitle.IAccountTitle, 'codeValue' | 'name'>[]>;
28
+ deleteAccountTitleCategoryByCodeValue(params: {
29
+ projectId: string;
30
+ codeValue: string;
31
+ }): Promise<void>;
32
+ unsetUnnecessaryFields(params: {
33
+ filter: any;
34
+ $unset: any;
35
+ }): Promise<import("mongoose").UpdateWriteOpResult>;
36
+ }
37
+ export {};