@chevre/domain 27.1.0-alpha.7 → 27.1.0-alpha.9

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.
@@ -96,10 +96,6 @@ const indexes = [
96
96
  { eventStatus: 1, startDate: 1 },
97
97
  { name: 'searchByEventStatus' }
98
98
  ],
99
- [
100
- { name: 1, startDate: 1 },
101
- { name: 'searchByName' }
102
- ],
103
99
  [
104
100
  { 'superEvent.id': 1, startDate: 1 },
105
101
  {
@@ -174,18 +170,6 @@ const indexes = [
174
170
  name: 'searchByOffersItemOfferedServiceOutputReservedTicketTicketedSeatTypeOf'
175
171
  }
176
172
  ],
177
- [
178
- {
179
- 'offers.itemOffered.serviceType.id': 1,
180
- startDate: 1
181
- },
182
- {
183
- partialFilterExpression: {
184
- 'offers.itemOffered.serviceType.id': { $exists: true }
185
- },
186
- name: 'searchByOffersItemOfferedServiceTypeId'
187
- }
188
- ],
189
173
  [
190
174
  {
191
175
  'offers.itemOffered.id': 1,
@@ -235,24 +219,6 @@ const indexes = [
235
219
  }
236
220
  }
237
221
  ],
238
- [
239
- { 'name.ja': 1, startDate: 1 },
240
- {
241
- name: 'searchByNameJa',
242
- partialFilterExpression: {
243
- 'name.ja': { $exists: true }
244
- }
245
- }
246
- ],
247
- [
248
- { 'name.en': 1, startDate: 1 },
249
- {
250
- name: 'searchByNameEn',
251
- partialFilterExpression: {
252
- 'name.en': { $exists: true }
253
- }
254
- }
255
- ],
256
222
  [
257
223
  { additionalProperty: 1, startDate: 1 },
258
224
  {
@@ -261,7 +227,42 @@ const indexes = [
261
227
  additionalProperty: { $exists: true }
262
228
  }
263
229
  }
264
- ]
230
+ ],
231
+ // 以下廃止(2026-09-07~)
232
+ // [
233
+ // {
234
+ // 'offers.itemOffered.serviceType.id': 1,
235
+ // startDate: 1
236
+ // },
237
+ // {
238
+ // partialFilterExpression: {
239
+ // 'offers.itemOffered.serviceType.id': { $exists: true }
240
+ // },
241
+ // name: 'searchByOffersItemOfferedServiceTypeId'
242
+ // }
243
+ // ],
244
+ // [
245
+ // { name: 1, startDate: 1 },
246
+ // { name: 'searchByName' }
247
+ // ],
248
+ // [
249
+ // { 'name.ja': 1, startDate: 1 },
250
+ // {
251
+ // name: 'searchByNameJa',
252
+ // partialFilterExpression: {
253
+ // 'name.ja': { $exists: true }
254
+ // }
255
+ // }
256
+ // ],
257
+ // [
258
+ // { 'name.en': 1, startDate: 1 },
259
+ // {
260
+ // name: 'searchByNameEn',
261
+ // partialFilterExpression: {
262
+ // 'name.en': { $exists: true }
263
+ // }
264
+ // }
265
+ // ],
265
266
  ];
266
267
  exports.indexes = indexes;
267
268
  /**
@@ -10,7 +10,7 @@ const factory_1 = require("../../factory");
10
10
  * 返品取引リポジトリ
11
11
  */
12
12
  class ReturnOrderInProgressRepo {
13
- static KEY_PREFIX = `txn:${factory_1.factory.transaction.returnOrder}`;
13
+ static KEY_PREFIX = `txn:${factory_1.factory.transactionType.ReturnOrder}`;
14
14
  redisClient;
15
15
  constructor(redisClient) {
16
16
  this.redisClient = redisClient;
@@ -3,7 +3,6 @@ import type { ReturnActionRepo } from '../../repo/action/returnAction';
3
3
  import type { OrderRepo } from '../../repo/order';
4
4
  import type { SettingRepo } from '../../repo/setting';
5
5
  import type { TaskRepo } from '../../repo/task';
6
- import type { ReturnOrderRepo } from '../../repo/transaction/returnOrder';
7
6
  import { factory } from '../../factory';
8
7
  declare function returnOrder(params: {
9
8
  agent: factory.action.transfer.returnAction.order.IAgent;
@@ -24,6 +23,5 @@ declare function returnOrder(params: {
24
23
  order: OrderRepo;
25
24
  setting: SettingRepo;
26
25
  task: TaskRepo;
27
- returnOrder: ReturnOrderRepo;
28
26
  }) => Promise<void>;
29
27
  export { returnOrder };
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.returnOrder = returnOrder;
7
7
  const debug_1 = __importDefault(require("debug"));
8
+ // import type { ReturnOrderRepo } from '../../repo/transaction/returnOrder';
8
9
  const onOrderStatusChanged_1 = require("./onOrderStatusChanged");
9
10
  const factory_1 = require("../../factory");
10
11
  const debug = (0, debug_1.default)('chevre-domain:service:order');
@@ -49,20 +50,22 @@ function returnOrder(params) {
49
50
  returnOrderTransaction = params.returnOrderTransaction;
50
51
  }
51
52
  else {
52
- // 互換性維持対応としての返品取引検索(2026-09-05~)
53
- const returnOrderTransactions = await repos.returnOrder.findReturnOrderTransactions({
54
- limit: 1,
55
- page: 1,
56
- project: { id: { $eq: order.project.id } },
57
- typeOf: factory_1.factory.transactionType.ReturnOrder,
58
- statuses: [factory_1.factory.transactionStatusType.Confirmed],
59
- object: { order: { orderNumbers: [orderNumber] } },
60
- inclusion: ['typeOf', 'potentialActions', 'object']
61
- });
62
- returnOrderTransaction = returnOrderTransactions.shift();
63
- if (returnOrderTransaction === undefined) {
64
- throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.ReturnOrder);
65
- }
53
+ throw new factory_1.factory.errors.ArgumentNull('returnOrderTransaction');
54
+ // // 互換性維持対応としての返品取引検索(2026-09-05~)
55
+ // const returnOrderTransactions =
56
+ // await repos.returnOrder.findReturnOrderTransactions({
57
+ // limit: 1,
58
+ // page: 1,
59
+ // project: { id: { $eq: order.project.id } },
60
+ // typeOf: factory.transactionType.ReturnOrder,
61
+ // statuses: [factory.transactionStatusType.Confirmed],
62
+ // object: { order: { orderNumbers: [orderNumber] } },
63
+ // inclusion: ['typeOf', 'potentialActions', 'object']
64
+ // });
65
+ // returnOrderTransaction = returnOrderTransactions.shift();
66
+ // if (returnOrderTransaction === undefined) {
67
+ // throw new factory.errors.NotFound(factory.transactionType.ReturnOrder);
68
+ // }
66
69
  }
67
70
  const simpleOrder = {
68
71
  typeOf: order.typeOf,
@@ -6,15 +6,15 @@ const returnAction_1 = require("../../repo/action/returnAction");
6
6
  const order_1 = require("../../repo/order");
7
7
  const setting_1 = require("../../repo/setting");
8
8
  const task_1 = require("../../repo/task");
9
- const returnOrder_1 = require("../../repo/transaction/returnOrder");
10
- const returnOrder_2 = require("../order/returnOrder");
9
+ // import { ReturnOrderRepo } from '../../repo/transaction/returnOrder';
10
+ const returnOrder_1 = require("../order/returnOrder");
11
11
  /**
12
12
  * タスク実行関数
13
13
  */
14
14
  function call(params) {
15
15
  return async ({ connection }) => {
16
16
  const { data } = params;
17
- await (0, returnOrder_2.returnOrder)({
17
+ await (0, returnOrder_1.returnOrder)({
18
18
  ...data,
19
19
  useOnOrderStatusChanged: true
20
20
  })({
@@ -23,7 +23,7 @@ function call(params) {
23
23
  order: new order_1.OrderRepo(connection),
24
24
  setting: new setting_1.SettingRepo(connection),
25
25
  task: new task_1.TaskRepo(connection),
26
- returnOrder: new returnOrder_1.ReturnOrderRepo(connection)
26
+ // returnOrder: new ReturnOrderRepo(connection)
27
27
  });
28
28
  };
29
29
  }
@@ -47,7 +47,7 @@ const paymentService_1 = require("../../repo/paymentService");
47
47
  const potentialAction_1 = require("../../repo/potentialAction");
48
48
  const product_1 = require("../../repo/product");
49
49
  const task_1 = require("../../repo/task");
50
- const returnOrder_1 = require("../../repo/transaction/returnOrder");
50
+ // import { ReturnOrderRepo } from '../../repo/transaction/returnOrder';
51
51
  const transactionNumber_1 = require("../../repo/transactionNumber");
52
52
  const RefundTransactionService = __importStar(require("../assetTransaction/refund"));
53
53
  /**
@@ -70,7 +70,7 @@ function call(params) {
70
70
  potentialAction: new potentialAction_1.PotentialActionRepo(connection),
71
71
  product: new product_1.ProductRepo(connection),
72
72
  task: new task_1.TaskRepo(connection),
73
- returnOrder: new returnOrder_1.ReturnOrderRepo(connection),
73
+ // returnOrder: new ReturnOrderRepo(connection),
74
74
  transactionNumber: new transactionNumber_1.TransactionNumberRepo({ connection })
75
75
  });
76
76
  };
@@ -119,16 +119,17 @@ function fixOrderAndTransaction(params, project) {
119
119
  returnOrderTransaction = params.returnOrderTransaction;
120
120
  }
121
121
  else {
122
- returnOrderTransaction = (await repos.returnOrder.findReturnOrderTransactions({
123
- limit: 1,
124
- page: 1,
125
- typeOf: factory_1.factory.transactionType.ReturnOrder,
126
- object: { order: { orderNumbers: [orderNumber] } },
127
- inclusion: ['object']
128
- })).shift();
129
- if (returnOrderTransaction === undefined) {
130
- throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.ReturnOrder);
131
- }
122
+ throw new factory_1.factory.errors.ArgumentNull('returnOrderTransaction');
123
+ // returnOrderTransaction = (await repos.returnOrder.findReturnOrderTransactions({
124
+ // limit: 1,
125
+ // page: 1,
126
+ // typeOf: factory.transactionType.ReturnOrder,
127
+ // object: { order: { orderNumbers: [orderNumber] } },
128
+ // inclusion: ['object']
129
+ // })).shift();
130
+ // if (returnOrderTransaction === undefined) {
131
+ // throw new factory.errors.NotFound(factory.transactionType.ReturnOrder);
132
+ // }
132
133
  }
133
134
  const order = await repos.order.projectFieldsByOrderNumber({
134
135
  orderNumber,
@@ -11,6 +11,7 @@ exports.exportTasksById = exportTasksById;
11
11
  * 返品取引サービス
12
12
  */
13
13
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
14
+ const util_1 = require("util");
14
15
  const factory_1 = require("../../factory");
15
16
  const factory_2 = require("./returnOrder/exportTasks/factory");
16
17
  const potentialActions_1 = require("./returnOrder/potentialActions");
@@ -143,9 +144,11 @@ function confirm(params, options) {
143
144
  order: { orderNumber: returningOrders[0].orderNumber }, seller: { id: returningOrders[0].seller.id }, emailMessages
144
145
  })(repos);
145
146
  if (useConfirmReturnOrderTask) {
146
- // タスク作成
147
+ // タスク作成(注文番号でユニークネス保証)
148
+ const taskIdentifier = (0, util_1.format)('%s:%s:%s', transaction.project.id, factory_1.factory.taskName.ConfirmReturnOrder, returningOrders[0].orderNumber);
147
149
  const endDate = new Date();
148
- const task = {
150
+ const confirmReturnOrderTask = {
151
+ identifier: taskIdentifier,
149
152
  project: transaction.project,
150
153
  name: factory_1.factory.taskName.ConfirmReturnOrder,
151
154
  status: factory_1.factory.taskStatus.Ready,
@@ -164,7 +167,7 @@ function confirm(params, options) {
164
167
  endDate
165
168
  }
166
169
  };
167
- await repos.task.saveMany([task]);
170
+ await repos.task.runTaskByIdentifier(confirmReturnOrderTask);
168
171
  }
169
172
  else {
170
173
  // ステータス変更
package/package.json CHANGED
@@ -88,5 +88,5 @@
88
88
  "postversion": "git push origin --tags",
89
89
  "prepublishOnly": "npm run clean && npm run build"
90
90
  },
91
- "version": "27.1.0-alpha.7"
91
+ "version": "27.1.0-alpha.9"
92
92
  }