@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
@@ -1,10 +1,7 @@
1
- import type { Connection, FilterQuery, mongo } from 'mongoose';
1
+ import type { Connection, FilterQuery } from 'mongoose';
2
2
  import { factory } from '../factory';
3
- type ISearchConditions = factory.eventSeries.ISearchConditions;
3
+ type ISearchConditions = Pick<factory.eventSeries.ISearchConditions, 'limit' | 'page' | 'sort' | 'additionalProperty' | 'endFrom' | 'endThrough' | 'id' | 'inSessionFrom' | 'inSessionThrough' | 'location' | 'name' | 'organizer' | 'project' | 'startFrom' | 'startThrough' | 'videoFormat' | 'workPerformed' | 'movieIdentifier' | 'movieVersion'>;
4
4
  type IKeyOfProjection = Exclude<keyof factory.eventSeries.IEvent, 'id' | 'videoFormat'>;
5
- type IUnset = {
6
- [key in keyof factory.eventSeries.IEvent]?: 1;
7
- };
8
5
  /**
9
6
  * 施設コンテンツリポジトリ
10
7
  */
@@ -12,41 +9,10 @@ export declare class EventSeriesRepo {
12
9
  private readonly eventSeriesModel;
13
10
  constructor(connection: Connection);
14
11
  static CREATE_MONGO_CONDITIONS(conditions: ISearchConditions): FilterQuery<factory.eventSeries.IEvent>[];
15
- /**
16
- * 施設+コンテンツ+バージョンをキーにして冪等置換
17
- */
18
- upsertByVersion(params: {
19
- $set: factory.eventSeries.IAttributes;
20
- $unset?: IUnset;
21
- }[], options: {
22
- /**
23
- * falseの場合setOnInsertのみ
24
- * trueの場合setOnInsert+setのみ
25
- */
26
- upsert: boolean;
27
- }): Promise<{
28
- bulkWriteResult?: mongo.BulkWriteResult;
29
- modifiedEvents: {
30
- id: string;
31
- }[];
32
- }>;
33
- /**
34
- * sskts施設コンテンツ保管
35
- */
36
- upsertManyEventSeriesById4sskts(params: {
37
- id: string;
38
- attributes: factory.eventSeries.IAttributes;
39
- }[]): Promise<void>;
40
12
  /**
41
13
  * イベントを検索する(inclusion projection)
42
14
  */
43
- projectEventSeriesFields(params: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<factory.eventSeries.IEvent[]>;
44
- deleteEventSeriesById(params: {
45
- project: {
46
- id: string;
47
- };
48
- id: string;
49
- }): Promise<void>;
15
+ findEventSeries(params: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<factory.eventSeries.IEvent[]>;
50
16
  deleteManyByOrganizerId(params: {
51
17
  project: {
52
18
  id: string;
@@ -54,7 +20,7 @@ export declare class EventSeriesRepo {
54
20
  organizer: {
55
21
  id: string;
56
22
  };
57
- }): Promise<mongo.DeleteResult>;
23
+ }): Promise<import("mongodb").DeleteResult>;
58
24
  deleteManyByLocationId(params: {
59
25
  project: {
60
26
  id: string;
@@ -62,51 +28,6 @@ export declare class EventSeriesRepo {
62
28
  location: {
63
29
  id: string;
64
30
  };
65
- }): Promise<mongo.DeleteResult>;
66
- /**
67
- * 既存施設コンテンツの最大バージョンを集計する
68
- */
69
- aggregateMaxVersion(params: {
70
- project: {
71
- id: {
72
- $eq: string;
73
- };
74
- };
75
- workPerformed: {
76
- identifier: {
77
- $eq: string;
78
- };
79
- };
80
- location: {
81
- branchCode: {
82
- $in: string[];
83
- };
84
- };
85
- }): Promise<{
86
- maxVersion: string;
87
- }>;
88
- getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, factory.eventSeries.IAttributes & {
89
- _id: string;
90
- }, import("./mongoose/virtuals").IVirtuals, {}> & factory.eventSeries.IAttributes & {
91
- _id: string;
92
- } & Required<{
93
- _id: string;
94
- }> & {
95
- __v: number;
96
- }, import("mongoose").QueryOptions<factory.eventSeries.IAttributes & {
97
- _id: string;
98
- }>, (import("mongoose").Document<unknown, Record<string, never>, factory.eventSeries.IAttributes & {
99
- _id: string;
100
- }, import("./mongoose/virtuals").IVirtuals, {}> & factory.eventSeries.IAttributes & {
101
- _id: string;
102
- } & Required<{
103
- _id: string;
104
- }> & {
105
- __v: number;
106
- }) | null>;
107
- unsetUnnecessaryFields(params: {
108
- filter: FilterQuery<factory.eventSeries.IEvent>;
109
- $unset: IUnset;
110
- }): Promise<import("mongoose").UpdateWriteOpResult>;
31
+ }): Promise<import("mongodb").DeleteResult>;
111
32
  }
112
33
  export {};
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EventSeriesRepo = void 0;
4
4
  const factory_1 = require("../factory");
5
5
  const eventSeries_1 = require("./mongoose/schemas/eventSeries");
6
- // import { isMongoError, MongoErrorCode } from '../errorHandler';
7
6
  const settings_1 = require("../settings");
8
7
  /**
9
8
  * 施設コンテンツリポジトリ
@@ -14,10 +13,7 @@ class EventSeriesRepo {
14
13
  this.eventSeriesModel = connection.model(eventSeries_1.modelName, (0, eventSeries_1.createSchema)());
15
14
  }
16
15
  static CREATE_MONGO_CONDITIONS(conditions) {
17
- const andConditions = [
18
- // typeOfは必ずScreeningEventSeriesなので不要(2026-02-14~)
19
- // { typeOf: { $eq: factory.eventType.ScreeningEventSeries } } // fix(2024-09-08~)
20
- ];
16
+ const andConditions = [];
21
17
  const projectIdEq = conditions.project?.id?.$eq;
22
18
  if (typeof projectIdEq === 'string') {
23
19
  andConditions.push({ 'project.id': { $eq: projectIdEq } });
@@ -34,12 +30,6 @@ class EventSeriesRepo {
34
30
  if (Array.isArray(idIn)) {
35
31
  andConditions.push({ _id: { $in: idIn } });
36
32
  }
37
- // /* istanbul ignore else */
38
- // if (Array.isArray(conditions.eventStatuses)) {
39
- // andConditions.push({
40
- // eventStatus: { $in: conditions.eventStatuses }
41
- // });
42
- // }
43
33
  /* istanbul ignore else */
44
34
  if (conditions.inSessionFrom !== undefined) {
45
35
  andConditions.push({
@@ -137,18 +127,25 @@ class EventSeriesRepo {
137
127
  });
138
128
  }
139
129
  }
140
- const workPerformedIdentifierIn = conditions.workPerformed?.identifiers;
141
- /* istanbul ignore else */
142
- if (Array.isArray(workPerformedIdentifierIn)) {
143
- andConditions.push({
144
- 'workPerformed.identifier': { $exists: true, $in: workPerformedIdentifierIn }
145
- });
130
+ // const workPerformedIdentifierIn = conditions.workPerformed?.identifiers;
131
+ // if (Array.isArray(workPerformedIdentifierIn)) {
132
+ // andConditions.push({
133
+ // 'workPerformed.identifier': { $exists: true, $in: workPerformedIdentifierIn }
134
+ // });
135
+ // }
136
+ // const workPerformedVersionEq = conditions.workPerformed?.version?.$eq;
137
+ // if (typeof workPerformedVersionEq === 'string') {
138
+ // andConditions.push({
139
+ // 'workPerformed.version': { $exists: true, $eq: workPerformedVersionEq }
140
+ // });
141
+ // }
142
+ const workPerformedIdentifierEq = conditions.movieIdentifier;
143
+ if (typeof workPerformedIdentifierEq === 'string') {
144
+ andConditions.push({ 'workPerformed.identifier': { $exists: true, $eq: workPerformedIdentifierEq } });
146
145
  }
147
- const workPerformedVersionEq = conditions.workPerformed?.version?.$eq;
146
+ const workPerformedVersionEq = conditions.movieVersion;
148
147
  if (typeof workPerformedVersionEq === 'string') {
149
- andConditions.push({
150
- 'workPerformed.version': { $exists: true, $eq: workPerformedVersionEq }
151
- });
148
+ andConditions.push({ 'workPerformed.version': { $exists: true, $eq: workPerformedVersionEq } });
152
149
  }
153
150
  const videoFormatTypeOfEq = conditions.videoFormat?.typeOf?.$eq;
154
151
  if (typeof videoFormatTypeOfEq === 'string') {
@@ -158,147 +155,12 @@ class EventSeriesRepo {
158
155
  if (Array.isArray(videoFormatTypeOfIn)) {
159
156
  andConditions.push({ 'subEvent.videoFormat': { $exists: true, $in: videoFormatTypeOfIn } });
160
157
  }
161
- // const soundFormatTypeOfEq = conditions.soundFormat?.typeOf?.$eq;
162
- // if (typeof soundFormatTypeOfEq === 'string') {
163
- // andConditions.push({
164
- // 'soundFormat.typeOf': {
165
- // $exists: true,
166
- // $eq: soundFormatTypeOfEq
167
- // }
168
- // });
169
- // }
170
- // const soundFormatTypeOfIn = conditions.soundFormat?.typeOf?.$in;
171
- // if (Array.isArray(soundFormatTypeOfIn)) {
172
- // andConditions.push({
173
- // 'soundFormat.typeOf': {
174
- // $exists: true,
175
- // $in: soundFormatTypeOfIn
176
- // }
177
- // });
178
- // }
179
158
  return andConditions;
180
159
  }
181
- /**
182
- * 施設+コンテンツ+バージョンをキーにして冪等置換
183
- */
184
- async upsertByVersion(params, options) {
185
- const { upsert } = options;
186
- const { default: uniqid } = await import('uniqid');
187
- const bulkWriteOps = [];
188
- const queryFilters = [];
189
- if (Array.isArray(params)) {
190
- params.forEach(({ $set, $unset }) => {
191
- const version = $set.workPerformed.version;
192
- if (typeof version !== 'string' || version.length === 0) {
193
- throw new factory_1.factory.errors.ArgumentNull('workPerformed.version');
194
- }
195
- // リソースのユニークネスを保証するfilter
196
- const filter = {
197
- typeOf: $set.typeOf,
198
- 'project.id': { $eq: $set.project.id },
199
- 'location.branchCode': { $exists: true, $eq: $set.location.branchCode },
200
- 'workPerformed.identifier': { $exists: true, $eq: $set.workPerformed.identifier },
201
- 'workPerformed.version': { $exists: true, $eq: version }
202
- };
203
- queryFilters.push({
204
- typeOf: $set.typeOf,
205
- 'project.id': { $eq: $set.project.id },
206
- 'location.branchCode': { $exists: true, $eq: $set.location.branchCode },
207
- 'workPerformed.identifier': { $exists: true, $eq: $set.workPerformed.identifier },
208
- 'workPerformed.version': { $exists: true, $eq: version }
209
- });
210
- const { identifier, project, typeOf, ...setFields } = $set; // eslint-disable-line @typescript-eslint/no-unused-vars
211
- const setOnInsert = {
212
- project,
213
- typeOf,
214
- _id: uniqid()
215
- };
216
- let updateOne;
217
- if (upsert === true) {
218
- updateOne = {
219
- filter,
220
- update: {
221
- $setOnInsert: setOnInsert,
222
- $set: setFields,
223
- ...($unset !== undefined) ? { $unset } : undefined
224
- },
225
- upsert: true
226
- };
227
- }
228
- else {
229
- updateOne = {
230
- filter,
231
- update: {
232
- $setOnInsert: {
233
- ...setOnInsert,
234
- ...setFields
235
- }
236
- },
237
- upsert: true
238
- };
239
- }
240
- bulkWriteOps.push({ updateOne });
241
- });
242
- }
243
- if (bulkWriteOps.length > 0) {
244
- const bulkWriteResult = await this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
245
- // upsert:falseの場合、upsertedIdsのみmodifiedEventsとして返せばよい(2026-01-27~)
246
- if (!upsert) {
247
- // BulkWriteResult -> upsertedIds: { '0': '7iri6p4m54k0r3g' }
248
- return {
249
- bulkWriteResult,
250
- modifiedEvents: Object.values(bulkWriteResult.upsertedIds)
251
- .map((id) => ({ id: String(id) }))
252
- };
253
- }
254
- else {
255
- // modifiedの場合upsertedIdsに含まれないので、idを検索する
256
- const modifiedEvents = await this.eventSeriesModel.find({ $or: queryFilters }, { _id: 1 })
257
- .exec();
258
- return { bulkWriteResult, modifiedEvents };
259
- }
260
- }
261
- return { modifiedEvents: [] };
262
- }
263
- /**
264
- * sskts施設コンテンツ保管
265
- */
266
- async upsertManyEventSeriesById4sskts(params) {
267
- const bulkWriteOps = [];
268
- if (Array.isArray(params)) {
269
- params.forEach((p) => {
270
- // 上書き禁止属性を除外(2022-08-24~)
271
- const { identifier, project, typeOf, ...updateFields } = p.attributes; // eslint-disable-line @typescript-eslint/no-unused-vars
272
- bulkWriteOps.push({
273
- updateOne: {
274
- filter: {
275
- _id: { $eq: p.id },
276
- typeOf: { $eq: factory_1.factory.eventType.ScreeningEventSeries }
277
- },
278
- update: {
279
- $setOnInsert: {
280
- typeOf: factory_1.factory.eventType.ScreeningEventSeries,
281
- project: p.attributes.project,
282
- ...(typeof p.attributes.identifier === 'string')
283
- ? { identifier: p.attributes.identifier } : undefined
284
- },
285
- $set: updateFields
286
- // $unsetに対応(2022-08-31~)
287
- // ...(p.$unset !== undefined) ? { $unset: p.$unset } : undefined
288
- },
289
- upsert: true
290
- }
291
- });
292
- });
293
- }
294
- if (bulkWriteOps.length > 0) {
295
- await this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
296
- }
297
- }
298
160
  /**
299
161
  * イベントを検索する(inclusion projection)
300
162
  */
301
- async projectEventSeriesFields(params, inclusion) {
163
+ async findEventSeries(params, inclusion) {
302
164
  const conditions = EventSeriesRepo.CREATE_MONGO_CONDITIONS(params);
303
165
  let projection;
304
166
  const positiveProjectionFields = (Array.isArray(inclusion))
@@ -337,72 +199,19 @@ class EventSeriesRepo {
337
199
  .lean() // lean(2024-08-01~)
338
200
  .exec();
339
201
  }
340
- async deleteEventSeriesById(params) {
341
- await this.eventSeriesModel.findOneAndDelete({
342
- _id: { $eq: params.id },
343
- 'project.id': { $eq: params.project.id },
344
- typeOf: { $eq: factory_1.factory.eventType.ScreeningEventSeries }
345
- }, { projection: { _id: 1 } })
346
- .exec();
347
- }
348
202
  async deleteManyByOrganizerId(params) {
349
203
  return this.eventSeriesModel.deleteMany({
350
204
  'project.id': { $eq: params.project.id },
351
- 'organizer.id': { $exists: true, $eq: params.organizer.id },
352
- typeOf: { $eq: factory_1.factory.eventType.ScreeningEventSeries }
205
+ 'organizer.id': { $exists: true, $eq: params.organizer.id }
353
206
  })
354
207
  .exec();
355
208
  }
356
209
  async deleteManyByLocationId(params) {
357
210
  return this.eventSeriesModel.deleteMany({
358
211
  'project.id': { $eq: params.project.id },
359
- 'location.id': { $exists: true, $eq: params.location.id },
360
- typeOf: { $eq: factory_1.factory.eventType.ScreeningEventSeries }
212
+ 'location.id': { $exists: true, $eq: params.location.id }
361
213
  })
362
214
  .exec();
363
215
  }
364
- /**
365
- * 既存施設コンテンツの最大バージョンを集計する
366
- */
367
- async aggregateMaxVersion(params) {
368
- const aggregations = await this.eventSeriesModel.aggregate([
369
- {
370
- $match: {
371
- typeOf: { $eq: factory_1.factory.eventType.ScreeningEventSeries },
372
- 'project.id': { $eq: params.project.id.$eq },
373
- 'workPerformed.identifier': { $exists: true, $eq: params.workPerformed.identifier.$eq },
374
- 'workPerformed.version': { $exists: true },
375
- 'location.branchCode': { $exists: true, $in: params.location.branchCode.$in }
376
- }
377
- },
378
- {
379
- $project: {
380
- workPerformed: '$workPerformed',
381
- // version: { $toInt: '$workPerformed.version' }
382
- version: { $toLong: '$workPerformed.version' } // support YYYYMMDDHHmmss
383
- }
384
- },
385
- {
386
- $group: {
387
- _id: '$typeOf',
388
- maxVersion: { $max: '$version' }
389
- }
390
- }
391
- ])
392
- .exec();
393
- const maxVersion = (aggregations.length > 0)
394
- ? String(aggregations.shift()?.maxVersion)
395
- : '0';
396
- return { maxVersion };
397
- }
398
- getCursor(conditions, projection) {
399
- return this.eventSeriesModel.find(conditions, projection)
400
- .sort({ startDate: factory_1.factory.sortType.Descending })
401
- .cursor();
402
- }
403
- async unsetUnnecessaryFields(params) {
404
- return this.eventSeriesModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
405
- .exec();
406
- }
407
216
  }
408
217
  exports.EventSeriesRepo = EventSeriesRepo;
@@ -1,5 +1,5 @@
1
1
  import { factory } from '../../../factory';
2
- type IAcceptedOfferByReserveTransaction = Pick<factory.order.IOptimizedAcceptedOffer, 'itemOffered' | 'priceSpecification' | 'name'>;
2
+ type IAcceptedOfferByReserveTransaction = Pick<factory.acceptedOffer.IOptimizedAcceptedOffer, 'itemOffered' | 'priceSpecification' | 'name'>;
3
3
  /**
4
4
  * 予約取引を注文のitemOfferedへ変換する
5
5
  */
@@ -36,17 +36,13 @@ export declare class IssuerRepo {
36
36
  };
37
37
  }): Promise<void>;
38
38
  getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.issuer.IIssuer, "id"> & {
39
- hasMemberProgram?: (factory.issuer.IMemberProgram & {
40
- hasTiers?: Pick<factory.issuer.IMemberProgramTier, "identifier" | "typeOf">[];
41
- })[];
39
+ hasMemberProgram?: factory.issuer.IMemberProgram[];
42
40
  } & {
43
41
  _id: import("mongoose").Types.ObjectId;
44
42
  } & {
45
43
  __v: number;
46
44
  }, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.issuer.IIssuer, "id"> & {
47
- hasMemberProgram?: (factory.issuer.IMemberProgram & {
48
- hasTiers?: Pick<factory.issuer.IMemberProgramTier, "identifier" | "typeOf">[];
49
- })[];
45
+ hasMemberProgram?: factory.issuer.IMemberProgram[];
50
46
  } & {
51
47
  _id: import("mongoose").Types.ObjectId;
52
48
  } & {
@@ -1,22 +1,11 @@
1
1
  import { Connection } from 'mongoose';
2
2
  import { factory } from '../factory';
3
- type IMemberProgramTier = Pick<factory.issuer.IMemberProgramTier, 'identifier' | 'typeOf'>;
4
- type IMemberProgram = factory.issuer.IMemberProgram & {
5
- hasTiers?: IMemberProgramTier[];
6
- };
3
+ type IMemberProgram = factory.issuer.IMemberProgram;
7
4
  type IMemberProgramAsSearchResult = IMemberProgram & {
8
5
  hostingOrganization: {
9
6
  identifier: string;
10
7
  };
11
8
  };
12
- type IMemberProgramTierAsSearchResult = IMemberProgramTier & {
13
- isTierOf: {
14
- identifier: string;
15
- hostingOrganization: {
16
- identifier: string;
17
- };
18
- };
19
- };
20
9
  /**
21
10
  * メンバープログラムリポジトリ
22
11
  */
@@ -44,31 +33,6 @@ export declare class MemberProgramRepo {
44
33
  $in?: string[];
45
34
  };
46
35
  }): Promise<IMemberProgramAsSearchResult[]>;
47
- /**
48
- * tierを検索する
49
- */
50
- projectMemberProgramTiers(params: {
51
- limit?: number;
52
- page?: number;
53
- project?: {
54
- id?: {
55
- $eq?: string;
56
- };
57
- };
58
- isTierOf?: {
59
- hostingOrganization?: {
60
- id?: {
61
- $eq?: string;
62
- };
63
- };
64
- identifier?: {
65
- $eq?: string;
66
- };
67
- };
68
- identifier?: {
69
- $eq?: string;
70
- };
71
- }): Promise<IMemberProgramTierAsSearchResult[]>;
72
36
  create(params: {
73
37
  project: {
74
38
  id: string;
@@ -83,7 +47,6 @@ export declare class MemberProgramRepo {
83
47
  id: string;
84
48
  };
85
49
  identifier: string;
86
- hasTiers?: Pick<factory.issuer.IMemberProgramTier, 'identifier'>[];
87
50
  hostingOrganization: {
88
51
  id: string;
89
52
  };
@@ -47,7 +47,6 @@ class MemberProgramRepo {
47
47
  _id: 0,
48
48
  typeOf: '$hasMemberProgram.typeOf',
49
49
  identifier: '$hasMemberProgram.identifier',
50
- hasTiers: '$hasMemberProgram.hasTiers',
51
50
  hostingOrganization: {
52
51
  identifier: '$identifier'
53
52
  }
@@ -62,62 +61,6 @@ class MemberProgramRepo {
62
61
  return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
63
62
  .exec();
64
63
  }
65
- /**
66
- * tierを検索する
67
- */
68
- async projectMemberProgramTiers(params) {
69
- const matchStages = [];
70
- const projectIdEq = params.project?.id?.$eq;
71
- if (typeof projectIdEq === 'string') {
72
- matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
73
- }
74
- const hostingOrganizationIdEq = params.isTierOf?.hostingOrganization?.id?.$eq;
75
- if (typeof hostingOrganizationIdEq === 'string') {
76
- matchStages.push({ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(hostingOrganizationIdEq) } } });
77
- }
78
- const memberProgramIdentifierEq = params.isTierOf?.identifier?.$eq;
79
- if (typeof memberProgramIdentifierEq === 'string') {
80
- matchStages.push({ $match: { 'hasMemberProgram.identifier': { $exists: true, $eq: memberProgramIdentifierEq } } });
81
- }
82
- const identifierEq = params.identifier?.$eq;
83
- if (typeof identifierEq === 'string') {
84
- matchStages.push({ $match: { 'hasMemberProgram.hasTiers.identifier': { $exists: true, $eq: identifierEq } } });
85
- }
86
- const aggregate = this.issuerModel.aggregate([
87
- {
88
- $unwind: {
89
- path: '$hasMemberProgram'
90
- }
91
- },
92
- {
93
- $unwind: {
94
- path: '$hasMemberProgram.hasTiers'
95
- }
96
- },
97
- ...matchStages,
98
- { $sort: { 'hasMemberProgram.hasTiers.identifier': factory_1.factory.sortType.Ascending } },
99
- {
100
- $project: {
101
- _id: 0,
102
- typeOf: '$hasMemberProgram.hasTiers.typeOf',
103
- identifier: '$hasMemberProgram.hasTiers.identifier',
104
- isTierOf: {
105
- identifier: '$hasMemberProgram.identifier',
106
- hostingOrganization: {
107
- identifier: '$identifier'
108
- }
109
- }
110
- }
111
- }
112
- ]);
113
- if (typeof params.limit === 'number' && params.limit > 0) {
114
- const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
115
- aggregate.skip(params.limit * (page - 1))
116
- .limit(params.limit);
117
- }
118
- return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
119
- .exec();
120
- }
121
64
  async create(params) {
122
65
  let doc = await this.issuerModel.findOne({
123
66
  _id: { $eq: params.hostingOrganization.id },
@@ -146,13 +89,9 @@ class MemberProgramRepo {
146
89
  }
147
90
  }
148
91
  async updateOne(params) {
149
- const hasTiers = (Array.isArray(params.hasTiers))
150
- ? params.hasTiers.map(({ identifier }) => ({ identifier, typeOf: 'MemberProgramTier' }))
151
- : [];
152
92
  const updatingMemberProgram = {
153
93
  typeOf: 'MemberProgram',
154
- identifier: params.identifier,
155
- hasTiers
94
+ identifier: params.identifier
156
95
  };
157
96
  const doc = await this.issuerModel.findOneAndUpdate({
158
97
  _id: { $eq: params.hostingOrganization.id },
@@ -1,7 +1,7 @@
1
1
  import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
2
  import { IVirtuals } from '../virtuals';
3
3
  import { factory } from '../../../factory';
4
- type IDocType = factory.accountTitle.IAccountTitle;
4
+ type IDocType = Pick<factory.accountTitle.IAccountTitle, 'additionalProperty' | 'codeValue' | 'hasCategoryCode' | 'name' | 'project' | 'typeOf'>;
5
5
  type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
6
6
  type ISchemaDefinition = SchemaDefinition<IDocType>;
7
7
  type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
@@ -8,18 +8,15 @@ const settings_1 = require("../../../settings");
8
8
  const modelName = 'AccountTitle';
9
9
  exports.modelName = modelName;
10
10
  const schemaDefinition = {
11
- project: mongoose_1.SchemaTypes.Mixed,
12
- typeOf: {
13
- type: String,
14
- required: true
15
- },
16
- codeValue: String,
11
+ project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
12
+ typeOf: { type: String, required: true },
13
+ codeValue: { type: String, required: true },
17
14
  name: String,
18
- inCodeSet: mongoose_1.SchemaTypes.Mixed,
19
15
  hasCategoryCode: mongoose_1.SchemaTypes.Mixed,
20
- inDefinedTermSet: mongoose_1.SchemaTypes.Mixed,
21
- hasDefinedTerm: mongoose_1.SchemaTypes.Mixed,
22
16
  additionalProperty: mongoose_1.SchemaTypes.Mixed
17
+ // inCodeSet: SchemaTypes.Mixed, // discontinue(2026-10-16~)
18
+ // inDefinedTermSet: SchemaTypes.Mixed, // discontinue(2026-10-16~)
19
+ // hasDefinedTerm: SchemaTypes.Mixed, // discontinue(2026-10-16~)
23
20
  };
24
21
  const schemaOptions = {
25
22
  autoIndex: settings_1.MONGO_AUTO_INDEX,
@@ -98,24 +95,23 @@ const indexes = [
98
95
  'hasCategoryCode.codeValue': { $exists: true }
99
96
  }
100
97
  }
101
- ]
98
+ ],
99
+ // 'hasCategoryCode.hasCategoryCode.codeValue': null のインデックスが作成されてうまくいかない
100
+ // [
101
+ // {
102
+ // 'project.id': 1,
103
+ // 'hasCategoryCode.hasCategoryCode.codeValue': 1
104
+ // },
105
+ // {
106
+ // name: 'uniqueAccountTitleCode',
107
+ // unique: true,
108
+ // partialFilterExpression: {
109
+ // 'hasCategoryCode.hasCategoryCode.codeValue': { $exists: true }
110
+ // }
111
+ // }
112
+ // ]
102
113
  ];
103
114
  exports.indexes = indexes;
104
- // 'hasCategoryCode.hasCategoryCode.codeValue': null のインデックスは作成されてうまくいかないので保留
105
- // schema.index(
106
- // {
107
- // 'project.id': 1,
108
- // 'hasCategoryCode.hasCategoryCode.codeValue': 1
109
- // },
110
- // {
111
- // name: 'uniqueHasCategoryCodeHasCategoryCodeCodeValue',
112
- // unique: true,
113
- // partialFilterExpression: {
114
- // 'project.id': { $exists: true },
115
- // 'hasCategoryCode.hasCategoryCode.codeValue': { $exists: true }
116
- // }
117
- // }
118
- // );
119
115
  /**
120
116
  * 勘定科目スキーマ
121
117
  */
@@ -3,6 +3,7 @@ import { IVirtuals } from '../virtuals';
3
3
  import { factory } from '../../../factory';
4
4
  export type IDocType = Omit<factory.place.movieTheater.IPlace, 'id'> & {
5
5
  hasPOS?: factory.place.movieTheater.IPOS[];
6
+ hasEntranceGate?: factory.place.movieTheater.IEntranceGate[];
6
7
  };
7
8
  type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
8
9
  type ISchemaDefinition = SchemaDefinition<IDocType>;