@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
@@ -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({
@@ -158,143 +148,8 @@ class EventSeriesRepo {
158
148
  if (Array.isArray(videoFormatTypeOfIn)) {
159
149
  andConditions.push({ 'subEvent.videoFormat': { $exists: true, $in: videoFormatTypeOfIn } });
160
150
  }
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
151
  return andConditions;
180
152
  }
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
153
  /**
299
154
  * イベントを検索する(inclusion projection)
300
155
  */
@@ -337,72 +192,19 @@ class EventSeriesRepo {
337
192
  .lean() // lean(2024-08-01~)
338
193
  .exec();
339
194
  }
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
195
  async deleteManyByOrganizerId(params) {
349
196
  return this.eventSeriesModel.deleteMany({
350
197
  'project.id': { $eq: params.project.id },
351
- 'organizer.id': { $exists: true, $eq: params.organizer.id },
352
- typeOf: { $eq: factory_1.factory.eventType.ScreeningEventSeries }
198
+ 'organizer.id': { $exists: true, $eq: params.organizer.id }
353
199
  })
354
200
  .exec();
355
201
  }
356
202
  async deleteManyByLocationId(params) {
357
203
  return this.eventSeriesModel.deleteMany({
358
204
  'project.id': { $eq: params.project.id },
359
- 'location.id': { $exists: true, $eq: params.location.id },
360
- typeOf: { $eq: factory_1.factory.eventType.ScreeningEventSeries }
205
+ 'location.id': { $exists: true, $eq: params.location.id }
361
206
  })
362
207
  .exec();
363
208
  }
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
209
  }
408
210
  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
  */
@@ -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>;
@@ -1,8 +1,29 @@
1
1
  import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
2
  import { IVirtuals } from '../virtuals';
3
3
  import { factory } from '../../../factory';
4
+ export type IMinimizedReservationFor = Pick<factory.acceptedOffer.IEventAsReservationFor, 'endDate' | 'id' | 'startDate' | 'typeOf'> & {
5
+ location: Pick<factory.acceptedOffer.IEventAsReservationFor['location'], 'branchCode' | 'typeOf'>;
6
+ superEvent: Pick<factory.acceptedOffer.ISuperEvent, 'id' | 'typeOf'> & {
7
+ location: Pick<factory.acceptedOffer.ISuperEvent['location'], 'branchCode' | 'typeOf'>;
8
+ workPerformed: Pick<factory.acceptedOffer.ISuperEvent['workPerformed'], 'identifier' | 'typeOf'>;
9
+ };
10
+ };
11
+ export type IMinimizedItemOffered = Pick<factory.acceptedOffer.IEventReservation, 'id' | 'reservationNumber' | 'typeOf'> & {
12
+ /**
13
+ * 予約番号ごとに、ひとつめのオファーのみreservationForを含むように変更するのでoptionalに
14
+ * 2026-06-04~
15
+ */
16
+ reservationFor?: IMinimizedReservationFor;
17
+ reservedTicket?: never;
18
+ };
19
+ export type IMinimizedAcceptedOffer = Pick<factory.acceptedOffer.IOptimizedAcceptedOffer, 'id' | 'offeredThrough' | 'serialNumber' | 'typeOf'> & {
20
+ itemOffered: IMinimizedItemOffered;
21
+ priceSpecification?: never;
22
+ name?: never;
23
+ };
24
+ export type IAcceptedOfferInDoc = IMinimizedAcceptedOffer | factory.acceptedOffer.ICOAAcceptedOffer;
4
25
  type IDocType = Omit<factory.order.IOrder, 'id'> & {
5
- acceptedOffers?: factory.order.IAcceptedOffer[];
26
+ acceptedOffers?: IAcceptedOfferInDoc[];
6
27
  /**
7
28
  * 注文取引IDとして再定義(2026-06-22~)
8
29
  */
@@ -34,15 +34,6 @@ const schemaDefinition = {
34
34
  // ↓ルームの施設からの分離に伴い属性追加(2023-06-22~)
35
35
  openSeatingAllowed: mongoose_1.SchemaTypes.Mixed,
36
36
  amenityFeature: mongoose_1.SchemaTypes.Mixed
37
- // ↓migrated to civicStructures(2024-09-19~)
38
- // alternateName: SchemaTypes.Mixed,
39
- // hasEntranceGate: [SchemaTypes.Mixed],
40
- // hasPOS: [SchemaTypes.Mixed],
41
- // sameAs: String,
42
- // telephone: String,
43
- // url: String,
44
- // kanaName: String,
45
- // offers: SchemaTypes.Mixed,
46
37
  };
47
38
  const schemaOptions = {
48
39
  autoIndex: settings_1.MONGO_AUTO_INDEX,
@@ -1,7 +1,9 @@
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 = Omit<factory.seller.ISeller, 'id'>;
4
+ type IDocType = Pick<factory.seller.ISeller, 'additionalProperty' | 'branchCode' | 'hasMerchantReturnPolicy' | 'makesOffer' | 'name' | 'project' | 'telephone' | 'typeOf' | 'url'> & {
5
+ paymentAccepted?: factory.seller.IPaymentAccepted[];
6
+ };
5
7
  type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
6
8
  type ISchemaDefinition = SchemaDefinition<IDocType>;
7
9
  type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
@@ -9,12 +9,10 @@ const modelName = 'Seller';
9
9
  exports.modelName = modelName;
10
10
  const schemaDefinition = {
11
11
  additionalProperty: [mongoose_1.SchemaTypes.Mixed],
12
- // areaServed: [SchemaTypes.Mixed],
13
12
  branchCode: String,
14
13
  hasMerchantReturnPolicy: [mongoose_1.SchemaTypes.Mixed],
15
14
  makesOffer: [mongoose_1.SchemaTypes.Mixed],
16
15
  name: mongoose_1.SchemaTypes.Mixed,
17
- // parentOrganization: SchemaTypes.Mixed,
18
16
  paymentAccepted: [mongoose_1.SchemaTypes.Mixed],
19
17
  project: mongoose_1.SchemaTypes.Mixed,
20
18
  typeOf: {
@@ -1,9 +1,8 @@
1
1
  import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
2
  import { IVirtuals } from '../virtuals';
3
3
  import { factory } from '../../../factory';
4
- type IPlaceOrder = Omit<factory.transaction.placeOrder.ITransaction, 'id'>;
5
- type IReturnOrder = Omit<factory.transaction.returnOrder.ITransaction, 'id'>;
6
- type IDocType = IPlaceOrder | IReturnOrder;
4
+ type IPlaceOrder = Pick<factory.transaction.placeOrder.ITransaction, 'agent' | 'endDate' | 'expires' | 'instrument' | 'object' | 'project' | 'result' | 'seller' | 'startDate' | 'status' | 'tasksExportAction' | 'typeOf'>;
5
+ type IDocType = IPlaceOrder;
7
6
  type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
8
7
  type ISchemaDefinition = SchemaDefinition<IDocType>;
9
8
  type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
@@ -4,26 +4,25 @@ exports.modelName = exports.indexes = void 0;
4
4
  exports.createSchema = createSchema;
5
5
  const mongoose_1 = require("mongoose");
6
6
  const writeConcern_1 = require("../writeConcern");
7
- const factory_1 = require("../../../factory");
8
7
  const settings_1 = require("../../../settings");
9
8
  const modelName = 'Transaction';
10
9
  exports.modelName = modelName;
11
10
  const schemaDefinition = {
12
- project: mongoose_1.SchemaTypes.Mixed,
13
- status: String,
14
- typeOf: String,
15
- agent: mongoose_1.SchemaTypes.Mixed,
16
- recipient: mongoose_1.SchemaTypes.Mixed,
11
+ project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
12
+ status: { type: String, required: true },
13
+ typeOf: { type: String, required: true },
14
+ agent: { type: mongoose_1.SchemaTypes.Mixed, required: true },
15
+ expires: { type: Date, required: true },
16
+ startDate: { type: Date, required: true },
17
17
  seller: mongoose_1.SchemaTypes.Mixed,
18
- error: mongoose_1.SchemaTypes.Mixed,
19
18
  result: mongoose_1.SchemaTypes.Mixed,
20
19
  object: mongoose_1.SchemaTypes.Mixed,
21
- expires: Date,
22
- startDate: Date,
23
20
  endDate: Date,
24
21
  tasksExportAction: mongoose_1.SchemaTypes.Mixed,
25
- potentialActions: mongoose_1.SchemaTypes.Mixed,
26
- instrument: mongoose_1.SchemaTypes.Mixed
22
+ instrument: mongoose_1.SchemaTypes.Mixed,
23
+ // recipient: SchemaTypes.Mixed, // discontinue(2026-09-09~)
24
+ // error: SchemaTypes.Mixed, // discontinue(2026-09-14~)
25
+ // potentialActions: SchemaTypes.Mixed, // discontinue(2026-09-14~)
27
26
  };
28
27
  const schemaOptions = {
29
28
  autoIndex: settings_1.MONGO_AUTO_INDEX,
@@ -54,10 +53,6 @@ const indexes = [
54
53
  { 'project.id': 1, startDate: -1 },
55
54
  { name: 'searchByProjectId-v20220721' }
56
55
  ],
57
- [
58
- { typeOf: 1, startDate: -1 },
59
- { name: 'searchByTypeOfAndStartDate' }
60
- ],
61
56
  [
62
57
  { status: 1, startDate: -1 },
63
58
  { name: 'searchByStatusAndStartDate' }
@@ -66,19 +61,6 @@ const indexes = [
66
61
  { startDate: -1 },
67
62
  { name: 'searchByStartDateDescending' }
68
63
  ],
69
- [
70
- { endDate: 1, startDate: -1 },
71
- {
72
- name: 'searchByEndDateAndStartDate',
73
- partialFilterExpression: {
74
- endDate: { $exists: true }
75
- }
76
- }
77
- ],
78
- [
79
- { expires: 1, startDate: -1 },
80
- { name: 'searchByExpiresAndStartDate' }
81
- ],
82
64
  [
83
65
  { 'object.confirmationNumber': 1, startDate: -1 },
84
66
  {
@@ -99,37 +81,31 @@ const indexes = [
99
81
  ],
100
82
  [
101
83
  // 注文取引のobject.orderNumberも発行されている場合ユニークなはず(2026-02-21~)
84
+ // 返品取引廃止につきuniquePlacingOrderNumberをreIndex
85
+ { 'object.orderNumber': 1 },
102
86
  {
103
- typeOf: 1,
104
- 'object.orderNumber': 1
105
- },
106
- {
107
- name: 'uniquePlacingOrderNumber',
87
+ name: 'uniqueOrderNumber',
108
88
  unique: true,
109
89
  partialFilterExpression: {
110
- typeOf: factory_1.factory.transactionType.PlaceOrder,
111
90
  'object.orderNumber': { $exists: true }
112
91
  }
113
92
  }
114
93
  ],
115
- [
116
- { 'agent.typeOf': 1, startDate: -1 },
117
- {
118
- name: 'searchByAgentTypeOfAndStartDate',
119
- partialFilterExpression: {
120
- 'agent.typeOf': { $exists: true }
121
- }
122
- }
123
- ],
124
- [
125
- { 'agent.id': 1, startDate: -1 },
126
- {
127
- name: 'searchByAgentIdAndStartDate',
128
- partialFilterExpression: {
129
- 'agent.id': { $exists: true }
130
- }
131
- }
132
- ],
94
+ // [
95
+ // // 注文取引のobject.orderNumberも発行されている場合ユニークなはず(2026-02-21~)
96
+ // {
97
+ // typeOf: 1,
98
+ // 'object.orderNumber': 1
99
+ // },
100
+ // {
101
+ // name: 'uniquePlacingOrderNumber',
102
+ // unique: true,
103
+ // partialFilterExpression: {
104
+ // typeOf: factory.transactionType.PlaceOrder,
105
+ // 'object.orderNumber': { $exists: true }
106
+ // }
107
+ // }
108
+ // ],
133
109
  [
134
110
  { 'agent.identifier': 1, startDate: -1 },
135
111
  {
@@ -171,24 +147,6 @@ const indexes = [
171
147
  }
172
148
  }
173
149
  ],
174
- [
175
- { 'tasksExportAction.actionStatus': 1, startDate: -1 },
176
- {
177
- name: 'searchByTasksExportActionActionStatus',
178
- partialFilterExpression: {
179
- 'tasksExportAction.actionStatus': { $exists: true }
180
- }
181
- }
182
- ],
183
- [
184
- { 'tasksExportAction.startDate': 1, startDate: -1 },
185
- {
186
- name: 'searchByTasksExportActionActionStartDate',
187
- partialFilterExpression: {
188
- 'tasksExportAction.startDate': { $exists: true }
189
- }
190
- }
191
- ],
192
150
  // typeOf: ReturnOrder廃止につき以下廃止(2026-09-08~)
193
151
  // [
194
152
  // { 'object.order.orderNumber': 1, startDate: -1 },
@@ -212,6 +170,59 @@ const indexes = [
212
170
  // }
213
171
  // }
214
172
  // ],
173
+ // [
174
+ // { endDate: 1, startDate: -1 },
175
+ // {
176
+ // name: 'searchByEndDateAndStartDate',
177
+ // partialFilterExpression: {
178
+ // endDate: { $exists: true }
179
+ // }
180
+ // }
181
+ // ],
182
+ // [
183
+ // { expires: 1, startDate: -1 },
184
+ // { name: 'searchByExpiresAndStartDate' }
185
+ // ],
186
+ // [
187
+ // { 'tasksExportAction.startDate': 1, startDate: -1 },
188
+ // {
189
+ // name: 'searchByTasksExportActionActionStartDate',
190
+ // partialFilterExpression: {
191
+ // 'tasksExportAction.startDate': { $exists: true }
192
+ // }
193
+ // }
194
+ // ],
195
+ // [
196
+ // { 'tasksExportAction.actionStatus': 1, startDate: -1 },
197
+ // {
198
+ // name: 'searchByTasksExportActionActionStatus',
199
+ // partialFilterExpression: {
200
+ // 'tasksExportAction.actionStatus': { $exists: true }
201
+ // }
202
+ // }
203
+ // ],
204
+ // [
205
+ // { typeOf: 1, startDate: -1 },
206
+ // { name: 'searchByTypeOfAndStartDate' }
207
+ // ],
208
+ // [
209
+ // { 'agent.typeOf': 1, startDate: -1 },
210
+ // {
211
+ // name: 'searchByAgentTypeOfAndStartDate',
212
+ // partialFilterExpression: {
213
+ // 'agent.typeOf': { $exists: true }
214
+ // }
215
+ // }
216
+ // ],
217
+ // [
218
+ // { 'agent.id': 1, startDate: -1 },
219
+ // {
220
+ // name: 'searchByAgentIdAndStartDate',
221
+ // partialFilterExpression: {
222
+ // 'agent.id': { $exists: true }
223
+ // }
224
+ // }
225
+ // ],
215
226
  ];
216
227
  exports.indexes = indexes;
217
228
  /**
@@ -133,7 +133,7 @@ export declare class OrderRepo {
133
133
  id: string;
134
134
  })[]>;
135
135
  getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.order.IOrder, "id"> & {
136
- acceptedOffers?: factory.order.IAcceptedOffer[];
136
+ acceptedOffers?: import("./mongoose/schemas/order").IAcceptedOfferInDoc[];
137
137
  identifier?: string;
138
138
  paymentMethodId?: string;
139
139
  } & {
@@ -141,7 +141,7 @@ export declare class OrderRepo {
141
141
  } & {
142
142
  __v: number;
143
143
  }, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.order.IOrder, "id"> & {
144
- acceptedOffers?: factory.order.IAcceptedOffer[];
144
+ acceptedOffers?: import("./mongoose/schemas/order").IAcceptedOfferInDoc[];
145
145
  identifier?: string;
146
146
  paymentMethodId?: string;
147
147
  } & {
@@ -487,37 +487,6 @@ class OrderRepo {
487
487
  }
488
488
  return andConditions;
489
489
  }
490
- // OrderInTransactionリポジトリにて注文ドキュメントが生成されるように変更したのでもう不要
491
- // /**
492
- // * なければ作成する
493
- // */
494
- // public async createIfNotExist(order: IOrderWithoutAcceptedOffers & {
495
- // acceptedOffers: factory.order.IAcceptedOffer[];
496
- // }): Promise<void> {
497
- // try {
498
- // // 存在しなければ上書き
499
- // // updateOneに変更(2024-01-14~)
500
- // // await this.orderModel.findOneAndUpdate(
501
- // await this.orderModel.updateOne(
502
- // { orderNumber: order.orderNumber },
503
- // { $setOnInsert: order },
504
- // {
505
- // // new: true,
506
- // upsert: true
507
- // }
508
- // )
509
- // .exec();
510
- // } catch (error) {
511
- // let throwsError = true;
512
- // if (await isMongoDuplicateError(error)) {
513
- // // すでにorderNumberが存在する場合ok
514
- // throwsError = false;
515
- // }
516
- // if (throwsError) {
517
- // throw error;
518
- // }
519
- // }
520
- // }
521
490
  /**
522
491
  * 注文ステータスを変更する
523
492
  */