@chevre/domain 28.0.0-alpha.2 → 28.0.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/lib/chevre/eventEmitter/transaction.d.ts +2 -2
  2. package/lib/chevre/eventEmitter/transaction.js +1 -1
  3. package/lib/chevre/repo/acceptedOffer.d.ts +6 -5
  4. package/lib/chevre/repo/acceptedOffer.js +14 -9
  5. package/lib/chevre/repo/acceptedOfferInReserve.d.ts +6 -8
  6. package/lib/chevre/repo/acceptedOfferInReserve.js +13 -7
  7. package/lib/chevre/repo/adminAcceptedOffer.d.ts +8 -8
  8. package/lib/chevre/repo/adminAcceptedOffer.js +6 -4
  9. package/lib/chevre/repo/adminEvent.d.ts +0 -6
  10. package/lib/chevre/repo/adminEvent.js +3 -9
  11. package/lib/chevre/repo/adminEventSeries.d.ts +89 -0
  12. package/lib/chevre/repo/adminEventSeries.js +174 -0
  13. package/lib/chevre/repo/adminTask.d.ts +2 -2
  14. package/lib/chevre/repo/adminTransaction.d.ts +44 -48
  15. package/lib/chevre/repo/adminTransaction.js +0 -98
  16. package/lib/chevre/repo/aggregateEvent.js +0 -1
  17. package/lib/chevre/repo/aggregateTransaction.d.ts +0 -1
  18. package/lib/chevre/repo/aggregateTransaction.js +0 -1
  19. package/lib/chevre/repo/event.d.ts +2 -2
  20. package/lib/chevre/repo/event.js +71 -110
  21. package/lib/chevre/repo/eventSeries.d.ts +3 -82
  22. package/lib/chevre/repo/eventSeries.js +3 -201
  23. package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.d.ts +1 -1
  24. package/lib/chevre/repo/mongoose/schemas/civicStructure.d.ts +1 -0
  25. package/lib/chevre/repo/mongoose/schemas/order.d.ts +22 -1
  26. package/lib/chevre/repo/mongoose/schemas/place.js +0 -9
  27. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +3 -1
  28. package/lib/chevre/repo/mongoose/schemas/seller.js +0 -2
  29. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +2 -3
  30. package/lib/chevre/repo/mongoose/schemas/transaction.js +81 -70
  31. package/lib/chevre/repo/order.d.ts +2 -2
  32. package/lib/chevre/repo/order.js +0 -31
  33. package/lib/chevre/repo/orderInTransaction.d.ts +5 -25
  34. package/lib/chevre/repo/orderInTransaction.js +0 -6
  35. package/lib/chevre/repo/place/movieTheater.d.ts +3 -1
  36. package/lib/chevre/repo/place/movieTheater.js +3 -1
  37. package/lib/chevre/repo/place/{hasPOS.d.ts → pos.d.ts} +13 -20
  38. package/lib/chevre/repo/place/{hasPOS.js → pos.js} +66 -29
  39. package/lib/chevre/repo/place/screeningRoom.d.ts +24 -3
  40. package/lib/chevre/repo/place/screeningRoom.js +28 -17
  41. package/lib/chevre/repo/priceSpecification.d.ts +8 -8
  42. package/lib/chevre/repo/seller.d.ts +11 -4
  43. package/lib/chevre/repo/seller.js +31 -58
  44. package/lib/chevre/repo/sellerPaymentAccepted.d.ts +14 -21
  45. package/lib/chevre/repo/sellerPaymentAccepted.js +65 -38
  46. package/lib/chevre/repo/task.d.ts +3 -3
  47. package/lib/chevre/repo/transaction/placeOrder.d.ts +6 -12
  48. package/lib/chevre/repo/transaction/placeOrder.js +53 -146
  49. package/lib/chevre/repo/transaction/returnOrderInProgress.d.ts +1 -1
  50. package/lib/chevre/repo/transaction.d.ts +1 -1
  51. package/lib/chevre/repo/transaction.js +0 -1
  52. package/lib/chevre/repository.d.ts +10 -5
  53. package/lib/chevre/repository.js +19 -8
  54. package/lib/chevre/service/aggregation/event/aggregateOffers.js +1 -2
  55. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +0 -1
  56. package/lib/chevre/service/aggregation/system.js +1 -3
  57. package/lib/chevre/service/assetTransaction/pay/start/preStart/validateAcceptedPaymentMethodIfNeeded.js +1 -2
  58. package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.js +2 -2
  59. package/lib/chevre/service/delivery/reservation/factory.d.ts +1 -1
  60. package/lib/chevre/service/event/saveScreeningEventSeries.d.ts +2 -2
  61. package/lib/chevre/service/event/saveScreeningEventSeries.js +1 -1
  62. package/lib/chevre/service/event/saveScreeningEvents.d.ts +2 -0
  63. package/lib/chevre/service/event.d.ts +2 -0
  64. package/lib/chevre/service/event.js +0 -1
  65. package/lib/chevre/service/offer/any.d.ts +1 -1
  66. package/lib/chevre/service/offer/event/authorize/factory.d.ts +5 -5
  67. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
  68. package/lib/chevre/service/offer/event/authorize.js +1 -4
  69. package/lib/chevre/service/offer/event/issueEventOfferTicket.js +1 -1
  70. package/lib/chevre/service/offer/event/voidTransaction.js +2 -5
  71. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +1 -4
  72. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +2 -9
  73. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +2 -2
  74. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +1 -4
  75. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -4
  76. package/lib/chevre/service/offer/onEventChanged.js +2 -4
  77. package/lib/chevre/service/offer.js +1 -2
  78. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +1 -1
  79. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +4 -6
  80. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +23 -4
  81. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
  82. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.d.ts +1 -1
  83. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +1 -1
  84. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +1 -1
  85. package/lib/chevre/service/order/placeOrder/factory/orderedItem.d.ts +1 -1
  86. package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
  87. package/lib/chevre/service/order/sendOrder.js +2 -14
  88. package/lib/chevre/service/payment/any/authorize.js +1 -1
  89. package/lib/chevre/service/payment/any/factory.d.ts +2 -2
  90. package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +1 -4
  91. package/lib/chevre/service/payment/any/processVoidPayTransaction.js +2 -2
  92. package/lib/chevre/service/payment/any/publishPaymentUrl.js +1 -1
  93. package/lib/chevre/service/payment/creditCard/getGMOInfoFromSeller.js +1 -1
  94. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.d.ts +3 -3
  95. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +1 -1
  96. package/lib/chevre/service/payment/movieTicket/payMovieTicket/payActionParams2seatInfoSyncIn.js +1 -1
  97. package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
  98. package/lib/chevre/service/task/importEventsFromCOA.js +2 -0
  99. package/lib/chevre/service/task/onResourceDeleted.js +8 -8
  100. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +7 -3
  101. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +51 -50
  102. package/lib/chevre/service/task/onResourceUpdated.js +5 -25
  103. package/lib/chevre/service/task/syncResourcesFromCOA.js +3 -1
  104. package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
  105. package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +1 -1
  106. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +1 -1
  107. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.d.ts +1 -1
  108. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +2 -2
  109. package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -7
  110. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +2 -2
  111. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -4
  112. package/lib/chevre/service/transaction/placeOrder/start.js +1 -1
  113. package/lib/chevre/service/transaction/placeOrder/updateAgent.js +1 -4
  114. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -3
  115. package/lib/chevre/service/transaction/returnOrder/preStart/factory.d.ts +1 -1
  116. package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +13 -1
  117. package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -2
  118. package/lib/chevre/service/transaction/returnOrder.d.ts +14 -3
  119. package/lib/chevre/service/transaction/returnOrder.js +1 -6
  120. package/lib/chevre/service/transaction.d.ts +1 -1
  121. package/package.json +2 -2
  122. package/lib/chevre/service/delivery/factory.d.ts +0 -16
  123. package/lib/chevre/service/delivery/factory.js +0 -124
@@ -1,6 +1,8 @@
1
1
  import type { Connection } from 'mongoose';
2
2
  import { factory } from '../factory';
3
+ import { IMinimizedAcceptedOffer, IMinimizedReservationFor, IMinimizedItemOffered } from './mongoose/schemas/order';
3
4
  import { AcceptedOfferInReserveRepo } from './acceptedOfferInReserve';
5
+ export { IMinimizedAcceptedOffer, IMinimizedReservationFor, IMinimizedItemOffered };
4
6
  export type IOrderInTransaction = Pick<factory.order.IOrder, 'orderNumber' | 'project' | 'broker'> & {
5
7
  typeOf: factory.transactionType.PlaceOrder;
6
8
  orderDate: Date;
@@ -8,7 +10,7 @@ export type IOrderInTransaction = Pick<factory.order.IOrder, 'orderNumber' | 'pr
8
10
  * 注文取引IDとして再定義(2026-06-22~)
9
11
  */
10
12
  identifier: string;
11
- acceptedOffers: factory.order.IAcceptedOffer[];
13
+ acceptedOffers: IMinimizedAcceptedOffer[] | factory.acceptedOffer.ICOAAcceptedOffer[];
12
14
  customer?: factory.order.ICustomer;
13
15
  seller?: factory.order.ISeller;
14
16
  confirmationNumber?: string;
@@ -47,26 +49,6 @@ export type IPlacingOrder = Pick<factory.order.IOrder, 'orderDate' | 'orderStatu
47
49
  */
48
50
  seller?: never;
49
51
  };
50
- export type IMinimizedReservationFor = Pick<factory.order.IEventAsReservationFor, 'endDate' | 'id' | 'startDate' | 'typeOf'> & {
51
- location: Pick<factory.order.IEventAsReservationFor['location'], 'branchCode' | 'typeOf'>;
52
- superEvent: Pick<factory.order.ISuperEvent, 'id' | 'typeOf'> & {
53
- location: Pick<factory.order.ISuperEvent['location'], 'branchCode' | 'typeOf'>;
54
- workPerformed: Pick<factory.order.ISuperEvent['workPerformed'], 'identifier' | 'typeOf'>;
55
- };
56
- };
57
- export type IMinimizedItemOffered = Pick<factory.order.IEventReservation, 'id' | 'reservationNumber' | 'typeOf'> & {
58
- /**
59
- * 予約番号ごとに、ひとつめのオファーのみreservationForを含むように変更するのでoptionalに
60
- * 2026-06-04~
61
- */
62
- reservationFor?: IMinimizedReservationFor;
63
- reservedTicket?: never;
64
- };
65
- export type IMinimizedAcceptedOffer = Pick<factory.order.IOptimizedAcceptedOffer, 'id' | 'offeredThrough' | 'serialNumber' | 'typeOf'> & {
66
- itemOffered: IMinimizedItemOffered;
67
- priceSpecification?: never;
68
- name?: never;
69
- };
70
52
  export interface IPaymentMethodByPaymentUrl {
71
53
  /**
72
54
  * 決済採用時に発行済の決済方法ID
@@ -117,9 +99,7 @@ export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
117
99
  * 注文取引タイプのドキュメントのみを参照対象にするかどうか
118
100
  */
119
101
  onlyPlaceOrder: boolean;
120
- }): Promise<(Pick<factory.order.IAcceptedOffer, 'id' | 'itemOffered' | 'offeredThrough' | 'serialNumber' | 'typeOf'> & {
121
- priceSpecification?: factory.order.ITicketPriceSpecification;
122
- })[]>;
102
+ }): Promise<Pick<factory.acceptedOffer.IAcceptedOffer, 'id' | 'itemOffered' | 'offeredThrough' | 'serialNumber' | 'typeOf' | 'priceSpecification'>[]>;
123
103
  /**
124
104
  * 注文を受注する
125
105
  * typeOf: PlaceOrder -> typeOf: Order
@@ -132,7 +112,7 @@ export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
132
112
  * このメソッドでdocumentが初めて生成される(typeOf:PlaceOrderとして)
133
113
  */
134
114
  acceptOfferByIdentifier(params: Pick<IOrderInTransaction, 'project' | 'identifier'> & {
135
- acceptedOffers: IMinimizedAcceptedOffer[] | factory.order.ICOAAcceptedOffer[];
115
+ acceptedOffers: IMinimizedAcceptedOffer[] | factory.acceptedOffer.ICOAAcceptedOffer[];
136
116
  }): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
137
117
  /**
138
118
  * serialNumberからオファーを除外する
@@ -5,11 +5,6 @@ exports.OrderInTransactionRepo = void 0;
5
5
  const errorHandler_1 = require("../errorHandler");
6
6
  const factory_1 = require("../factory");
7
7
  const order_1 = require("./mongoose/schemas/order");
8
- // import {
9
- // createSchema as createTransactionSchema,
10
- // IModel as ITransactionModel, modelName as transactionModelName,
11
- // IDocType as ITransactionDocType
12
- // } from './mongoose/schemas/transaction';
13
8
  const acceptedOfferInReserve_1 = require("./acceptedOfferInReserve");
14
9
  // const debug = createDebug('chevre-domain:repo:orderInTransaction');
15
10
  /**
@@ -17,7 +12,6 @@ const acceptedOfferInReserve_1 = require("./acceptedOfferInReserve");
17
12
  */
18
13
  class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInReserveRepo {
19
14
  orderModel;
20
- // private readonly transactionModel: ITransactionModel;
21
15
  constructor(connection) {
22
16
  super(connection);
23
17
  this.orderModel = connection.model(order_1.modelName, (0, order_1.createSchema)());
@@ -32,7 +32,7 @@ export declare class MovieTheaterRepo {
32
32
  /**
33
33
  * 施設を保管する
34
34
  */
35
- saveMovieTheater(params: Pick<factory.place.movieTheater.IPlace, 'additionalProperty' | 'branchCode' | 'hasEntranceGate' | 'id' | 'kanaName' | 'name' | 'offers' | 'parentOrganization' | 'project' | 'typeOf' | 'url'> & {
35
+ saveMovieTheater(params: Pick<factory.place.movieTheater.IPlace, 'additionalProperty' | 'branchCode' | 'id' | 'kanaName' | 'name' | 'offers' | 'parentOrganization' | 'project' | 'typeOf' | 'url'> & {
36
36
  hasEntranceGate?: never;
37
37
  }): Promise<{
38
38
  id: string;
@@ -96,12 +96,14 @@ export declare class MovieTheaterRepo {
96
96
  }): Promise<void>;
97
97
  getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("../mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/place/movieTheater").IPlace, "id"> & {
98
98
  hasPOS?: factory.place.movieTheater.IPOS[];
99
+ hasEntranceGate?: factory.place.movieTheater.IEntranceGate[];
99
100
  } & {
100
101
  _id: import("mongoose").Types.ObjectId;
101
102
  } & {
102
103
  __v: number;
103
104
  }, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("../mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/place/movieTheater").IPlace, "id"> & {
104
105
  hasPOS?: factory.place.movieTheater.IPOS[];
106
+ hasEntranceGate?: factory.place.movieTheater.IEntranceGate[];
105
107
  } & {
106
108
  _id: import("mongoose").Types.ObjectId;
107
109
  } & {
@@ -5,7 +5,9 @@ const factory_1 = require("../../factory");
5
5
  const settings_1 = require("../../settings");
6
6
  const civicStructure_1 = require("../mongoose/schemas/civicStructure");
7
7
  const AVAILABLE_PROJECT_FIELDS = [
8
- 'additionalProperty', 'branchCode', 'hasEntranceGate', 'kanaName', 'name',
8
+ 'additionalProperty', 'branchCode',
9
+ // 'hasEntranceGate',
10
+ 'kanaName', 'name',
9
11
  'offers', 'parentOrganization', 'project', 'telephone', 'typeOf', 'url',
10
12
  'offers.typeOf',
11
13
  'offers.eligibleQuantity',
@@ -12,43 +12,36 @@ interface IOperator {
12
12
  /**
13
13
  * 施設のPOSリポジトリ
14
14
  */
15
- export declare class HasPOSRepo {
15
+ export declare class POSRepo {
16
16
  readonly operator: IOperator;
17
17
  private readonly civicStructureModel;
18
18
  constructor(connection: Connection, operater: IOperator);
19
- search(params: {
19
+ findPOS(params: {
20
+ projectId: string;
20
21
  limit?: number;
21
22
  page?: number;
22
23
  branchCode?: {
23
24
  $eq?: string;
24
25
  $regex?: string;
25
26
  };
26
- project?: {
27
- id?: {
28
- $eq?: string;
29
- };
30
- };
31
- }): Promise<Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name' | 'id'>[]>;
32
- createByBranchCode(params: Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name'> & {
27
+ }): Promise<Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name'>[]>;
28
+ private countPOS;
29
+ addPOSByBranchCode(params: Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name'> & {
33
30
  project: {
34
31
  id: string;
35
32
  };
36
- }): Promise<{
37
- id: string;
38
- }>;
39
- updateByBranchCode(params: Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name'> & {
33
+ }, options: {
34
+ maxNumPOS: number;
35
+ }): Promise<void>;
36
+ updatePOSByBranchCode(params: Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name'> & {
40
37
  project: {
41
38
  id: string;
42
39
  };
43
- }): Promise<{
44
- id: string;
45
- }>;
46
- deleteByBranchCode(params: Pick<factory.place.movieTheater.IPOS, 'branchCode'> & {
40
+ }): Promise<void>;
41
+ deletePOSByBranchCode(params: Pick<factory.place.movieTheater.IPOS, 'branchCode'> & {
47
42
  project: {
48
43
  id: string;
49
44
  };
50
- }): Promise<{
51
- id: string;
52
- }>;
45
+ }): Promise<void>;
53
46
  }
54
47
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HasPOSRepo = void 0;
3
+ exports.POSRepo = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const factory_1 = require("../../factory");
6
6
  const settings_1 = require("../../settings");
@@ -8,21 +8,15 @@ const civicStructure_1 = require("../mongoose/schemas/civicStructure");
8
8
  /**
9
9
  * 施設のPOSリポジトリ
10
10
  */
11
- class HasPOSRepo {
11
+ class POSRepo {
12
12
  operator;
13
13
  civicStructureModel;
14
14
  constructor(connection, operater) {
15
15
  this.civicStructureModel = connection.model(civicStructure_1.modelName, (0, civicStructure_1.createSchema)());
16
16
  this.operator = operater;
17
17
  }
18
- async search(params) {
19
- const matchStages = [
20
- { $match: { _id: { $eq: new mongoose_1.Types.ObjectId(this.operator.id) } } }
21
- ];
22
- const projectIdEq = params.project?.id?.$eq;
23
- if (typeof projectIdEq === 'string') {
24
- matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
25
- }
18
+ async findPOS(params) {
19
+ const matchStages = [];
26
20
  const branchCodeEq = params.branchCode?.$eq;
27
21
  if (typeof branchCodeEq === 'string') {
28
22
  matchStages.push({ $match: { 'hasPOS.branchCode': { $eq: branchCodeEq } } });
@@ -32,6 +26,13 @@ class HasPOSRepo {
32
26
  matchStages.push({ $match: { 'hasPOS.branchCode': { $regex: new RegExp(branchCodeRegex) } } });
33
27
  }
34
28
  const aggregate = this.civicStructureModel.aggregate([
29
+ // まず施設ドキュメントで絞る
30
+ {
31
+ $match: {
32
+ _id: { $eq: new mongoose_1.Types.ObjectId(this.operator.id) },
33
+ 'project.id': { $eq: params.projectId }
34
+ }
35
+ },
35
36
  {
36
37
  $unwind: {
37
38
  path: '$hasPOS'
@@ -42,54 +43,90 @@ class HasPOSRepo {
42
43
  {
43
44
  $project: {
44
45
  _id: 0,
45
- id: '$hasPOS.branchCode',
46
46
  branchCode: '$hasPOS.branchCode',
47
- name: '$hasPOS.name'
47
+ name: '$hasPOS.name',
48
+ // ...((!excludePOSId) && { id: '$hasPOS.branchCode' }) // discontinue(2026-09-22~)
48
49
  }
49
50
  }
50
51
  ]);
51
52
  if (typeof params.limit === 'number' && params.limit > 0) {
52
53
  const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
53
- aggregate.limit(params.limit * page)
54
- .skip(params.limit * (page - 1));
54
+ aggregate.skip(params.limit * (page - 1))
55
+ .limit(params.limit);
55
56
  }
56
57
  return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
57
58
  .exec();
58
59
  }
59
- async createByBranchCode(params) {
60
+ async countPOS() {
61
+ const posCount = (await this.civicStructureModel.aggregate([
62
+ {
63
+ $match: {
64
+ _id: { $eq: new mongoose_1.Types.ObjectId(this.operator.id) },
65
+ }
66
+ },
67
+ {
68
+ $project: {
69
+ posCount: {
70
+ $cond: {
71
+ if: { $isArray: '$hasPOS' },
72
+ then: { $size: '$hasPOS' },
73
+ else: 0
74
+ }
75
+ }
76
+ }
77
+ }
78
+ ]).option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
79
+ .exec()).at(0)?.posCount;
80
+ if (typeof posCount !== 'number') {
81
+ throw new factory_1.factory.errors.NotFound(factory_1.factory.placeType.MovieTheater);
82
+ }
83
+ return { posCount };
84
+ }
85
+ async addPOSByBranchCode(params, options) {
60
86
  // 施設存在確認
61
- let doc = await this.civicStructureModel.findOne({
87
+ const movieTheaterDoc = await this.civicStructureModel.findOne({
62
88
  'project.id': { $eq: params.project.id },
63
89
  _id: { $eq: this.operator.id }
64
- }, { _id: 1, typeOf: 1 })
90
+ }, { _id: 1 })
91
+ .lean()
65
92
  .exec();
66
- if (doc === null) {
93
+ if (movieTheaterDoc === null) {
67
94
  throw new factory_1.factory.errors.NotFound(factory_1.factory.placeType.MovieTheater);
68
95
  }
96
+ // 最大数検証(2026-09-20~)
97
+ const { maxNumPOS } = options;
69
98
  const creatingPOS = {
70
- // 互換性維持対応としてidを保管
71
- id: params.branchCode, // eslint-disable-line @typescript-eslint/no-explicit-any
99
+ // // 互換性維持対応としてidを保管
100
+ // id: params.branchCode as any, // discontinue(2026-09-22~)
72
101
  branchCode: params.branchCode,
73
102
  name: params.name
74
103
  };
75
- doc = await this.civicStructureModel.findOneAndUpdate({
104
+ const doc = await this.civicStructureModel.findOneAndUpdate({
76
105
  'project.id': { $eq: params.project.id },
77
106
  _id: { $eq: this.operator.id },
78
- 'hasPOS.branchCode': { $ne: params.branchCode }
107
+ 'hasPOS.branchCode': { $ne: params.branchCode },
108
+ // 配列の長さが上限未満であることをアトミックに確認
109
+ $expr: {
110
+ $lt: [{ $size: { $ifNull: ['$hasPOS', []] } }, maxNumPOS] // 最大数担保(2026-09-20~)
111
+ }
79
112
  }, {
80
113
  $push: { hasPOS: creatingPOS }
81
114
  }, {
82
- new: true,
83
115
  projection: { _id: 1 }
84
116
  })
117
+ .lean()
85
118
  .exec();
86
119
  // 存在しなければID重複
87
120
  if (doc === null) {
121
+ const { posCount } = await this.countPOS();
122
+ if (posCount >= maxNumPOS) {
123
+ throw new factory_1.factory.errors.Argument('operator.id', 'maxNumPOS exceeded');
124
+ }
125
+ // 上限以下で追加できない場合は「すでに登録済み」
88
126
  throw new factory_1.factory.errors.AlreadyInUse('hasPOS', ['id']);
89
127
  }
90
- return doc.toObject({ virtuals: true });
91
128
  }
92
- async updateByBranchCode(params) {
129
+ async updatePOSByBranchCode(params) {
93
130
  const doc = await this.civicStructureModel.findOneAndUpdate({
94
131
  'project.id': { $eq: params.project.id },
95
132
  _id: { $eq: this.operator.id },
@@ -107,13 +144,13 @@ class HasPOSRepo {
107
144
  ],
108
145
  projection: { _id: 1 }
109
146
  })
147
+ .lean()
110
148
  .exec();
111
149
  if (doc === null) {
112
150
  throw new factory_1.factory.errors.NotFound('hasPOS');
113
151
  }
114
- return doc.toObject({ virtuals: true });
115
152
  }
116
- async deleteByBranchCode(params) {
153
+ async deletePOSByBranchCode(params) {
117
154
  const doc = await this.civicStructureModel.findOneAndUpdate({
118
155
  'project.id': { $eq: params.project.id },
119
156
  _id: { $eq: this.operator.id },
@@ -123,11 +160,11 @@ class HasPOSRepo {
123
160
  }, {
124
161
  projection: { _id: 1 }
125
162
  })
163
+ .lean()
126
164
  .exec();
127
165
  if (doc === null) {
128
166
  throw new factory_1.factory.errors.NotFound('hasPOS');
129
167
  }
130
- return doc.toObject({ virtuals: true });
131
168
  }
132
169
  }
133
- exports.HasPOSRepo = HasPOSRepo;
170
+ exports.POSRepo = POSRepo;
@@ -84,7 +84,28 @@ export declare class ScreeningRoomRepo {
84
84
  id: string;
85
85
  };
86
86
  }): Promise<mongo.DeleteResult>;
87
- searchScreeningRooms(searchConditions: factory.place.screeningRoom.ISearchConditions): Promise<Omit<factory.place.screeningRoom.IPlace, 'containsPlace' | 'parentOrganization'>[]>;
87
+ /**
88
+ * ルーム検索
89
+ * sectionCount,seatCountのprojectが可能
90
+ * sortはbranchCode: factory.sortType.Ascendingで固定
91
+ */
92
+ projectRoomFields(params: Pick<factory.place.screeningRoom.ISearchConditions, '$projection' | 'branchCode' | 'containedInPlace' | 'parentOrganization'> & {
93
+ /**
94
+ * プロジェクト指定は必須
95
+ */
96
+ project: {
97
+ id: {
98
+ $eq: string;
99
+ };
100
+ };
101
+ limit: number;
102
+ page: number;
103
+ }, options: {
104
+ /**
105
+ * 将来的にcontainedInPlace最小化のためオプション採用(2026-09-17~)
106
+ */
107
+ minimizeContainedInPlace: boolean;
108
+ }): Promise<Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'containedInPlace' | 'maximumAttendeeCapacity' | 'name' | 'openSeatingAllowed' | 'typeOf' | 'seatCount' | 'sectionCount'>[]>;
88
109
  findRooms(params: Omit<factory.place.screeningRoom.ISearchConditions, '$projection'>): Promise<Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'name' | 'openSeatingAllowed' | 'maximumAttendeeCapacity'>[]>;
89
110
  /**
90
111
  * セクションと座席も含めたひとつのルームを取得する
@@ -128,7 +149,7 @@ export declare class ScreeningRoomRepo {
128
149
  description?: any;
129
150
  openingHoursSpecification?: any;
130
151
  smokingAllowed?: boolean;
131
- containsPlace: (Pick<import("@chevre/factory/lib/chevre/place/screeningRoomSection").IPlace, "name" | "typeOf" | "additionalProperty" | "branchCode"> & {
152
+ containsPlace: (Pick<import("@chevre/factory/lib/chevre/place/screeningRoomSection").IPlace, "name" | "typeOf" | "branchCode" | "additionalProperty"> & {
132
153
  containsPlace?: factory.place.seat.IPlace[];
133
154
  })[];
134
155
  } & {
@@ -139,7 +160,7 @@ export declare class ScreeningRoomRepo {
139
160
  description?: any;
140
161
  openingHoursSpecification?: any;
141
162
  smokingAllowed?: boolean;
142
- containsPlace: (Pick<import("@chevre/factory/lib/chevre/place/screeningRoomSection").IPlace, "name" | "typeOf" | "additionalProperty" | "branchCode"> & {
163
+ containsPlace: (Pick<import("@chevre/factory/lib/chevre/place/screeningRoomSection").IPlace, "name" | "typeOf" | "branchCode" | "additionalProperty"> & {
143
164
  containsPlace?: factory.place.seat.IPlace[];
144
165
  })[];
145
166
  } & {
@@ -379,10 +379,15 @@ class ScreeningRoomRepo {
379
379
  })
380
380
  .exec();
381
381
  }
382
- async searchScreeningRooms(searchConditions) {
382
+ /**
383
+ * ルーム検索
384
+ * sectionCount,seatCountのprojectが可能
385
+ * sortはbranchCode: factory.sortType.Ascendingで固定
386
+ */
387
+ async projectRoomFields(params, options) {
388
+ const { minimizeContainedInPlace } = options;
383
389
  const aggregate = this.placeModel.aggregate([
384
- { $sort: { branchCode: factory_1.factory.sortType.Ascending } },
385
- ...ScreeningRoomRepo.CREATE_ROOM_MONGO_CONDITIONS(searchConditions),
390
+ ...ScreeningRoomRepo.CREATE_ROOM_MONGO_CONDITIONS(params),
386
391
  {
387
392
  $project: {
388
393
  _id: 0,
@@ -390,16 +395,20 @@ class ScreeningRoomRepo {
390
395
  branchCode: '$branchCode',
391
396
  name: '$name',
392
397
  address: '$address',
393
- containedInPlace: {
394
- id: '$containedInPlace.id',
395
- typeOf: '$containedInPlace.typeOf',
396
- branchCode: '$containedInPlace.branchCode',
397
- name: '$containedInPlace.name'
398
- },
398
+ containedInPlace: (minimizeContainedInPlace)
399
+ ? {
400
+ branchCode: '$containedInPlace.branchCode',
401
+ }
402
+ : {
403
+ id: '$containedInPlace.id',
404
+ typeOf: '$containedInPlace.typeOf',
405
+ branchCode: '$containedInPlace.branchCode',
406
+ name: '$containedInPlace.name'
407
+ },
399
408
  openSeatingAllowed: '$openSeatingAllowed',
400
409
  additionalProperty: '$additionalProperty',
401
410
  maximumAttendeeCapacity: '$maximumAttendeeCapacity',
402
- ...(searchConditions.$projection?.sectionCount === 1)
411
+ ...(params.$projection?.sectionCount === 1)
403
412
  ? {
404
413
  sectionCount: {
405
414
  $cond: {
@@ -410,7 +419,7 @@ class ScreeningRoomRepo {
410
419
  }
411
420
  }
412
421
  : undefined,
413
- ...(searchConditions.$projection?.seatCount === 1)
422
+ ...(params.$projection?.seatCount === 1)
414
423
  ? {
415
424
  seatCount: {
416
425
  $sum: {
@@ -429,14 +438,16 @@ class ScreeningRoomRepo {
429
438
  }
430
439
  : undefined
431
440
  }
432
- }
441
+ },
442
+ { $sort: { branchCode: factory_1.factory.sortType.Ascending } }
433
443
  ]);
434
- /* istanbul ignore else */
435
- if (typeof searchConditions.limit === 'number' && searchConditions.limit > 0) {
436
- const page = (typeof searchConditions.page === 'number' && searchConditions.page > 0) ? searchConditions.page : 1;
437
- aggregate.limit(searchConditions.limit * page)
438
- .skip(searchConditions.limit * (page - 1));
444
+ const { limit, page } = params;
445
+ if (typeof limit !== 'number' || limit === 0) {
446
+ throw new factory_1.factory.errors.ArgumentNull('limit', 'must be number > 0');
439
447
  }
448
+ const pageMustBePositive = (typeof page === 'number' && page > 0) ? page : 1;
449
+ aggregate.skip(limit * (pageMustBePositive - 1))
450
+ .limit(limit);
440
451
  return aggregate
441
452
  .option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
442
453
  .exec();
@@ -37,11 +37,11 @@ export declare class PriceSpecificationRepo {
37
37
  };
38
38
  }): Promise<void>;
39
39
  getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & (({
40
- project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
41
40
  name?: (string | import("@chevre/factory/lib/chevre/multilingualString").IMultilingualString) | undefined;
41
+ typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification;
42
+ project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
42
43
  price: number;
43
44
  priceCurrency: factory.priceCurrency;
44
- typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification;
45
45
  valueAddedTaxIncluded: boolean;
46
46
  accounting?: never | undefined;
47
47
  appliesToCategoryCode: import("@chevre/factory/lib/chevre/priceSpecification/categoryCodeChargeSpecification").IAppliesToCategoryCode[];
@@ -53,11 +53,11 @@ export declare class PriceSpecificationRepo {
53
53
  } & {
54
54
  __v: number;
55
55
  }) | ({
56
- project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
57
56
  name?: (string | import("@chevre/factory/lib/chevre/multilingualString").IMultilingualString) | undefined;
57
+ typeOf: factory.priceSpecificationType.MovieTicketTypeChargeSpecification;
58
+ project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
58
59
  price: number;
59
60
  priceCurrency: factory.priceCurrency;
60
- typeOf: factory.priceSpecificationType.MovieTicketTypeChargeSpecification;
61
61
  valueAddedTaxIncluded: boolean;
62
62
  accounting?: never | undefined;
63
63
  appliesToMovieTicket: import("@chevre/factory/lib/chevre/priceSpecification/movieTicketTypeChargeSpecification").IAppliesToMovieTicket;
@@ -70,11 +70,11 @@ export declare class PriceSpecificationRepo {
70
70
  } & {
71
71
  __v: number;
72
72
  })), import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & (({
73
- project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
74
73
  name?: (string | import("@chevre/factory/lib/chevre/multilingualString").IMultilingualString) | undefined;
74
+ typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification;
75
+ project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
75
76
  price: number;
76
77
  priceCurrency: factory.priceCurrency;
77
- typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification;
78
78
  valueAddedTaxIncluded: boolean;
79
79
  accounting?: never | undefined;
80
80
  appliesToCategoryCode: import("@chevre/factory/lib/chevre/priceSpecification/categoryCodeChargeSpecification").IAppliesToCategoryCode[];
@@ -86,11 +86,11 @@ export declare class PriceSpecificationRepo {
86
86
  } & {
87
87
  __v: number;
88
88
  }) | ({
89
- project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
90
89
  name?: (string | import("@chevre/factory/lib/chevre/multilingualString").IMultilingualString) | undefined;
90
+ typeOf: factory.priceSpecificationType.MovieTicketTypeChargeSpecification;
91
+ project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
91
92
  price: number;
92
93
  priceCurrency: factory.priceCurrency;
93
- typeOf: factory.priceSpecificationType.MovieTicketTypeChargeSpecification;
94
94
  valueAddedTaxIncluded: boolean;
95
95
  accounting?: never | undefined;
96
96
  appliesToMovieTicket: import("@chevre/factory/lib/chevre/priceSpecification/movieTicketTypeChargeSpecification").IAppliesToMovieTicket;
@@ -33,7 +33,7 @@ export declare class SellerRepo {
33
33
  private readonly sellerModel;
34
34
  constructor(connection: Connection);
35
35
  static CREATE_MONGO_CONDITIONS(params: factory.seller.ISearchConditions & IMemberSearchConditions): FilterQuery<factory.seller.ISeller>[];
36
- static CREATE_AGGREGATE_SELLERS_PROJECTION(exclusion: (keyof ISellerByAggregate)[]): Record<string, AnyExpression>;
36
+ static CREATE_AGGREGATE_SELLERS_PROJECTION(inclusions: (Exclude<keyof ISellerByAggregate, 'id'>)[]): Record<string, AnyExpression>;
37
37
  /**
38
38
  * 販売者を保管する
39
39
  */
@@ -46,7 +46,10 @@ export declare class SellerRepo {
46
46
  /**
47
47
  * 集計検索(publicな属性検索が目的)
48
48
  */
49
- searchByAggregate(conditions: factory.seller.ISearchConditions & IMemberSearchConditions, exclusion: (keyof ISellerByAggregate)[]): Promise<ISellerByAggregate[]>;
49
+ findSellersPublicFields(conditions: factory.seller.ISearchConditions & IMemberSearchConditions & {
50
+ limit: number;
51
+ page: number;
52
+ }, inclusions: (Exclude<keyof ISellerByAggregate, 'id'>)[]): Promise<ISellerByAggregate[]>;
50
53
  /**
51
54
  * 販売者検索
52
55
  */
@@ -72,11 +75,15 @@ export declare class SellerRepo {
72
75
  id: string;
73
76
  makesOffer: factory.seller.IMakesOffer;
74
77
  }): Promise<void>;
75
- getCursor(conditions: FilterQuery<factory.seller.ISeller>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & IDocType & {
78
+ getCursor(conditions: FilterQuery<factory.seller.ISeller>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Pick<factory.seller.ISeller, "name" | "typeOf" | "branchCode" | "additionalProperty" | "project" | "url" | "telephone" | "makesOffer" | "hasMerchantReturnPolicy"> & {
79
+ paymentAccepted?: factory.seller.IPaymentAccepted[];
80
+ } & {
76
81
  _id: Types.ObjectId;
77
82
  } & {
78
83
  __v: number;
79
- }, QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & IDocType & {
84
+ }, QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Pick<factory.seller.ISeller, "name" | "typeOf" | "branchCode" | "additionalProperty" | "project" | "url" | "telephone" | "makesOffer" | "hasMerchantReturnPolicy"> & {
85
+ paymentAccepted?: factory.seller.IPaymentAccepted[];
86
+ } & {
80
87
  _id: Types.ObjectId;
81
88
  } & {
82
89
  __v: number;