@chevre/domain 26.0.0-alpha.24 → 26.0.0-alpha.25

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.
@@ -27,13 +27,6 @@ export declare class AcceptedOfferRepo extends AcceptedOfferInReserveRepo {
27
27
  acceptedOffers: [IAcceptedOffer];
28
28
  _id?: never;
29
29
  })[]>;
30
- aggreateOwnershipInfosByOrder(filter: {
31
- orderNumber: {
32
- $eq: string;
33
- };
34
- }): Promise<{
35
- identifier: string;
36
- }[]>;
37
30
  /**
38
31
  * 注文オファーを展開して検索する
39
32
  * 注文番号指定で1注文ドキュメントから参照する想定
@@ -105,33 +105,33 @@ class AcceptedOfferRepo extends acceptedOfferInReserve_1.AcceptedOfferInReserveR
105
105
  return orders;
106
106
  }
107
107
  }
108
- async aggreateOwnershipInfosByOrder(filter) {
109
- const aggregate = this.orderModel.aggregate([
110
- { $match: { orderNumber: { $eq: filter.orderNumber.$eq } } },
111
- { $match: { typeOf: { $eq: factory_1.factory.order.OrderType.Order } } },
112
- {
113
- $unwind: {
114
- path: '$acceptedOffers',
115
- includeArrayIndex: 'acceptedOfferIndex'
116
- }
117
- },
118
- {
119
- $project: {
120
- _id: 0,
121
- // acceptedOfferIndex: '$acceptedOfferIndex',
122
- // itemOfferedTypeOf: '$acceptedOffers.itemOffered.typeOf',
123
- // customerId: '$customer.id',
124
- // orderNumber: '$orderNumber',
125
- identifier: {
126
- $concat: ['$customer.id', '-', '$acceptedOffers.itemOffered.typeOf', '-', '$orderNumber', '-', { $toString: '$acceptedOfferIndex' }]
127
- }
128
- }
129
- }
130
- ]);
131
- return aggregate
132
- .option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
133
- .exec();
134
- }
108
+ // public async aggreateOwnershipInfosByOrder(
109
+ // filter: {
110
+ // orderNumber: { $eq: string };
111
+ // }
112
+ // ): Promise<{ identifier: string }[]> {
113
+ // const aggregate = this.orderModel.aggregate<{ identifier: string }>([
114
+ // { $match: { orderNumber: { $eq: filter.orderNumber.$eq } } },
115
+ // { $match: { typeOf: { $eq: factory.order.OrderType.Order } } },
116
+ // {
117
+ // $unwind: {
118
+ // path: '$acceptedOffers',
119
+ // includeArrayIndex: 'acceptedOfferIndex'
120
+ // }
121
+ // },
122
+ // {
123
+ // $project: {
124
+ // _id: 0,
125
+ // identifier: {
126
+ // $concat: ['$customer.id', '-', '$acceptedOffers.itemOffered.typeOf', '-', '$orderNumber', '-', { $toString: '$acceptedOfferIndex' }]
127
+ // }
128
+ // }
129
+ // }
130
+ // ]);
131
+ // return aggregate
132
+ // .option({ maxTimeMS: MONGO_MAX_TIME_MS })
133
+ // .exec();
134
+ // }
135
135
  /**
136
136
  * 注文オファーを展開して検索する
137
137
  * 注文番号指定で1注文ドキュメントから参照する想定
@@ -12,43 +12,9 @@ export declare class OwnershipInfoRepo {
12
12
  private readonly ownershipInfoModel;
13
13
  constructor(connection: Connection);
14
14
  static CREATE_MONGO_CONDITIONS(params: Pick<IFindParams, 'ownedFromGte' | 'ownedFromLte' | 'project'>): FilterQuery<IDocType>[];
15
- /**
16
- * なければ作成する
17
- */
18
- createIfNotExistByIdentifier(ownershipInfo: Omit<IOwnershipInfoWithId, 'id'>): Promise<{
19
- id: string;
20
- }>;
21
15
  /**
22
16
  * 所有権を検索する
23
17
  */
24
- projectFields(params: IFindParams, inclusion?: (keyof IOwnershipInfoWithId)[]): Promise<IOwnershipInfoWithId[]>;
25
- /**
26
- * 識別子から所有期限を変更する
27
- * 存在しない場合undefinedを返す
28
- */
29
- findByIdentifierAndUpdateOwnedThrough(params: {
30
- project: {
31
- id: string;
32
- };
33
- identifier: string;
34
- ownedThrough: Date;
35
- }): Promise<Pick<IOwnershipInfoWithId, 'id' | 'identifier'> | undefined>;
36
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>, "id"> & {
37
- _id: string;
38
- } & Required<{
39
- _id: string;
40
- }> & {
41
- __v: number;
42
- }, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>, "id"> & {
43
- _id: string;
44
- } & Required<{
45
- _id: string;
46
- }> & {
47
- __v: number;
48
- }) | null>;
49
- unsetUnnecessaryFields(params: {
50
- filter: any;
51
- $unset: any;
52
- }): Promise<import("mongoose").UpdateWriteOpResult>;
18
+ findOwnershipInfos(params: IFindParams, inclusion?: (keyof IOwnershipInfoWithId)[]): Promise<IOwnershipInfoWithId[]>;
53
19
  }
54
20
  export {};
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OwnershipInfoRepo = void 0;
4
- const uuid_1 = require("uuid");
4
+ // import { v4 } from 'uuid';
5
5
  const ownershipInfo_1 = require("./mongoose/schemas/ownershipInfo");
6
- const errorHandler_1 = require("../errorHandler");
7
- const factory_1 = require("../factory");
8
6
  const settings_1 = require("../settings");
9
7
  /**
10
8
  * 所有権リポジトリ
@@ -34,57 +32,63 @@ class OwnershipInfoRepo {
34
32
  }
35
33
  return andConditions;
36
34
  }
37
- /**
38
- * なければ作成する
39
- */
40
- async createIfNotExistByIdentifier(ownershipInfo) {
41
- let doc;
42
- let duplicate = false;
43
- try {
44
- doc = await this.ownershipInfoModel.findOneAndUpdate({ identifier: { $eq: ownershipInfo.identifier } }, {
45
- // insert時以外は何もしなくてもよい
46
- $setOnInsert: {
47
- ...ownershipInfo,
48
- _id: (0, uuid_1.v4)() // 新規作成時は所有権ID発行
49
- }
50
- }, {
51
- new: true,
52
- upsert: true,
53
- projection: {
54
- _id: 0,
55
- id: { $toString: '$_id' }
56
- }
57
- })
58
- .lean()
59
- .exec();
60
- }
61
- catch (error) {
62
- if (await (0, errorHandler_1.isMongoDuplicateError)(error)) {
63
- // すでに所有権が存在する場合ok
64
- duplicate = true;
65
- }
66
- if (!duplicate) {
67
- throw error;
68
- }
69
- }
70
- if (duplicate) {
71
- // 重複の場合、再度取得
72
- doc = await this.ownershipInfoModel.findOne({ identifier: { $eq: ownershipInfo.identifier } }, {
73
- _id: 0,
74
- id: { $toString: '$_id' }
75
- })
76
- .lean()
77
- .exec();
78
- }
79
- if (doc === undefined || doc === null) {
80
- throw new factory_1.factory.errors.NotFound(this.ownershipInfoModel.modelName);
81
- }
82
- return { id: doc.id };
83
- }
35
+ // /**
36
+ // * なければ作成する
37
+ // */
38
+ // public async createIfNotExistByIdentifier(ownershipInfo: Omit<IOwnershipInfoWithId, 'id'>): Promise<{ id: string }> {
39
+ // let doc: { id: string } | undefined | null;
40
+ // let duplicate = false;
41
+ // try {
42
+ // doc = await this.ownershipInfoModel.findOneAndUpdate(
43
+ // { identifier: { $eq: ownershipInfo.identifier } },
44
+ // {
45
+ // // insert時以外は何もしなくてもよい
46
+ // $setOnInsert: {
47
+ // ...ownershipInfo,
48
+ // _id: v4() // 新規作成時は所有権ID発行
49
+ // }
50
+ // },
51
+ // {
52
+ // new: true,
53
+ // upsert: true,
54
+ // projection: {
55
+ // _id: 0,
56
+ // id: { $toString: '$_id' }
57
+ // }
58
+ // }
59
+ // )
60
+ // .lean<{ id: string }>()
61
+ // .exec();
62
+ // } catch (error) {
63
+ // if (await isMongoDuplicateError(error)) {
64
+ // // すでに所有権が存在する場合ok
65
+ // duplicate = true;
66
+ // }
67
+ // if (!duplicate) {
68
+ // throw error;
69
+ // }
70
+ // }
71
+ // if (duplicate) {
72
+ // // 重複の場合、再度取得
73
+ // doc = await this.ownershipInfoModel.findOne(
74
+ // { identifier: { $eq: ownershipInfo.identifier } },
75
+ // {
76
+ // _id: 0,
77
+ // id: { $toString: '$_id' }
78
+ // }
79
+ // )
80
+ // .lean<{ id: string }>()
81
+ // .exec();
82
+ // }
83
+ // if (doc === undefined || doc === null) {
84
+ // throw new factory.errors.NotFound(this.ownershipInfoModel.modelName);
85
+ // }
86
+ // return { id: doc.id };
87
+ // }
84
88
  /**
85
89
  * 所有権を検索する
86
90
  */
87
- async projectFields(params, inclusion) {
91
+ async findOwnershipInfos(params, inclusion) {
88
92
  const conditions = OwnershipInfoRepo.CREATE_MONGO_CONDITIONS(params);
89
93
  let projection = {
90
94
  _id: 0,
@@ -122,115 +126,5 @@ class OwnershipInfoRepo {
122
126
  .lean() // lean(2024-08-19~)
123
127
  .exec();
124
128
  }
125
- /**
126
- * 識別子から所有期限を変更する
127
- * 存在しない場合undefinedを返す
128
- */
129
- async findByIdentifierAndUpdateOwnedThrough(params) {
130
- return this.ownershipInfoModel.findOneAndUpdate({
131
- 'project.id': { $eq: params.project.id },
132
- identifier: { $eq: String(params.identifier) }
133
- }, { ownedThrough: params.ownedThrough }, {
134
- new: true,
135
- projection: {
136
- _id: 0,
137
- id: { $toString: '$_id' },
138
- identifier: 1
139
- }
140
- })
141
- .lean()
142
- .exec()
143
- .then((doc) => {
144
- // 存在しない場合も正常にハンドルする
145
- if (doc === null) {
146
- return;
147
- }
148
- else {
149
- return doc;
150
- }
151
- });
152
- }
153
- // /**
154
- // * 所有期限切れの所有権を削除する
155
- // */
156
- // public async deleteExpiredOwnershipInfos(params: {
157
- // ownedThroughLte: Date;
158
- // }) {
159
- // await this.ownershipInfoModel.deleteMany({
160
- // // 所有期限切れのもの(ownedThroughは必ず存在する)
161
- // ownedThrough: { $lte: params.ownedThroughLte }
162
- // })
163
- // .exec();
164
- // }
165
- // /**
166
- // * 所有者を追加する
167
- // */
168
- // public async addOwnerIfNotExist(params: {
169
- // /**
170
- // * 所有権ID
171
- // */
172
- // id: string;
173
- // ownedBy: factory.ownershipInfo.IOwner;
174
- // }): Promise<void> {
175
- // if (typeof params.ownedBy.id !== 'string' || params.ownedBy.id.length === 0) {
176
- // throw new factory.errors.ArgumentNull('ownedBy.id');
177
- // }
178
- // let newOwner: factory.ownershipInfo.IOwner | undefined;
179
- // if (params.ownedBy.typeOf === factory.personType.Person) {
180
- // newOwner = {
181
- // id: params.ownedBy.id,
182
- // typeOf: params.ownedBy.typeOf
183
- // };
184
- // }
185
- // if (newOwner !== undefined) {
186
- // const doc = await this.ownershipInfoModel.findOneAndUpdate(
187
- // { _id: { $eq: params.id } },
188
- // { $addToSet: { ownedBy: newOwner } },
189
- // {
190
- // new: true,
191
- // projection: { _id: 1 }
192
- // }
193
- // )
194
- // .exec();
195
- // if (doc === null) {
196
- // throw new factory.errors.NotFound(this.ownershipInfoModel.modelName);
197
- // }
198
- // }
199
- // }
200
- // /**
201
- // * 所有者を削除する
202
- // */
203
- // public async removeOwnerIfExist(params: {
204
- // /**
205
- // * 所有権ID
206
- // */
207
- // id: string;
208
- // ownedBy: { id: string };
209
- // }): Promise<void> {
210
- // if (typeof params.ownedBy.id !== 'string' || params.ownedBy.id.length === 0) {
211
- // throw new factory.errors.ArgumentNull('ownedBy.id');
212
- // }
213
- // const doc = await this.ownershipInfoModel.findOneAndUpdate(
214
- // { _id: { $eq: params.id } },
215
- // { $pull: { ownedBy: { id: params.ownedBy.id } } },
216
- // {
217
- // new: true,
218
- // projection: { _id: 1 }
219
- // }
220
- // )
221
- // .exec();
222
- // if (doc === null) {
223
- // throw new factory.errors.NotFound(this.ownershipInfoModel.modelName);
224
- // }
225
- // }
226
- getCursor(conditions, projection) {
227
- return this.ownershipInfoModel.find(conditions, projection)
228
- .sort({ ownedFrom: factory_1.factory.sortType.Ascending })
229
- .cursor();
230
- }
231
- async unsetUnnecessaryFields(params) {
232
- return this.ownershipInfoModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
233
- .exec();
234
- }
235
129
  }
236
130
  exports.OwnershipInfoRepo = OwnershipInfoRepo;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deleteOrder = deleteOrder;
4
- // import { createOwnershipInfosFromOrder } from '../delivery/factory';
5
4
  const factory_1 = require("../../factory");
6
5
  /**
7
6
  * 注文に関わるリソースを削除する
@@ -1,7 +1,6 @@
1
1
  import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
2
2
  import type { ActionRepo } from '../../repo/action';
3
3
  import type { OrderRepo } from '../../repo/order';
4
- import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
5
4
  import type { SettingRepo } from '../../repo/setting';
6
5
  import type { TaskRepo } from '../../repo/task';
7
6
  import type { ReturnOrderRepo } from '../../repo/transaction/returnOrder';
@@ -20,7 +19,6 @@ declare function returnOrder(params: {
20
19
  acceptedOffer: AcceptedOfferRepo;
21
20
  action: ActionRepo;
22
21
  order: OrderRepo;
23
- ownershipInfo: OwnershipInfoRepo;
24
22
  setting: SettingRepo;
25
23
  task: TaskRepo;
26
24
  returnOrder: ReturnOrderRepo;
@@ -5,7 +5,6 @@ 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 { createMaskedCustomer } from '../../factory/order';
9
8
  const onOrderStatusChanged_1 = require("./onOrderStatusChanged");
10
9
  const factory_1 = require("../../factory");
11
10
  const debug = (0, debug_1.default)('chevre-domain:service:order');
@@ -19,9 +18,7 @@ function createReturnPolicy(params) {
19
18
  };
20
19
  }
21
20
  function returnOrder(params) {
22
- return async (repos
23
- // settings: Settings
24
- ) => {
21
+ return async (repos) => {
25
22
  if (typeof params.useOnOrderStatusChanged !== 'boolean') {
26
23
  throw new factory_1.factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
27
24
  }
@@ -81,14 +78,15 @@ function returnOrder(params) {
81
78
  recipient,
82
79
  typeOf: factory_1.factory.actionType.ReturnAction
83
80
  };
84
- let returnedOwnershipInfos;
81
+ const returnedOwnershipInfos = [];
85
82
  let returnedOrder;
86
83
  const action = await repos.action.start(returnOrderActionAttributes);
87
84
  try {
88
- returnedOwnershipInfos = await processReturnOrder(order, dateReturned)({
89
- acceptedOffer: repos.acceptedOffer,
90
- ownershipInfo: repos.ownershipInfo
91
- });
85
+ // ひとまず所有権管理を廃止するため、所有権返却処理は不要(2026-08-10)
86
+ // returnedOwnershipInfos = await processReturnOrder(order, dateReturned)({
87
+ // acceptedOffer: repos.acceptedOffer,
88
+ // ownershipInfo: repos.ownershipInfo
89
+ // });
92
90
  // 注文ステータス変更
93
91
  returnedOrder = await repos.order.returnOrder({
94
92
  project: { id: order.project.id },
@@ -130,37 +128,7 @@ function returnOrder(params) {
130
128
  ...returnOrderActionAttributes,
131
129
  id: action.id
132
130
  }
133
- })(repos
134
- // settings
135
- );
136
- }
137
- };
138
- }
139
- function processReturnOrder(order, dateReturned) {
140
- return async (repos) => {
141
- const returnedOwnershipInfos = [];
142
- // 所有権の所有期間変更
143
- // 注文オファーリポジトリから所有権識別子を検索する(2023-12-07~)
144
- const ownershipInfos = await repos.acceptedOffer.aggreateOwnershipInfosByOrder({ orderNumber: { $eq: order.orderNumber } });
145
- if (Array.isArray(ownershipInfos)) {
146
- await Promise.all(ownershipInfos.map(async (ownershipInfo) => {
147
- const ownershipInfoReturned = await repos.ownershipInfo.findByIdentifierAndUpdateOwnedThrough({
148
- project: { id: order.project.id },
149
- identifier: String(ownershipInfo.identifier),
150
- ownedThrough: dateReturned
151
- })
152
- .then((ownershipInfoByDB) => {
153
- // 存在しない場合は識別子のみ保管(customer.typeOfによって存在しないこともありうる)
154
- if (ownershipInfoByDB === undefined) {
155
- return ownershipInfo;
156
- }
157
- else {
158
- return ownershipInfoByDB;
159
- }
160
- });
161
- returnedOwnershipInfos.push(ownershipInfoReturned);
162
- }));
131
+ })(repos);
163
132
  }
164
- return returnedOwnershipInfos;
165
133
  };
166
134
  }
@@ -1,7 +1,6 @@
1
1
  import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
2
2
  import type { ActionRepo } from '../../repo/action';
3
3
  import type { OrderRepo } from '../../repo/order';
4
- import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
5
4
  import type { SettingRepo } from '../../repo/setting';
6
5
  import type { TaskRepo } from '../../repo/task';
7
6
  import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
@@ -10,7 +9,6 @@ interface ISendOrderRepos {
10
9
  acceptedOffer: AcceptedOfferRepo;
11
10
  action: ActionRepo;
12
11
  order: OrderRepo;
13
- ownershipInfo: OwnershipInfoRepo;
14
12
  setting: SettingRepo;
15
13
  task: TaskRepo;
16
14
  placeOrder: PlaceOrderRepo;
@@ -5,33 +5,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.sendOrder = sendOrder;
7
7
  const debug_1 = __importDefault(require("debug"));
8
- // import { createMaskedCustomer } from '../../factory/order';
9
- const factory_1 = require("../delivery/factory");
10
- // import { findPlaceOrderTransaction } from './findPlaceOrderTransaction';
8
+ // import { createOwnershipInfosFromOrder } from '../delivery/factory';
11
9
  const onOrderStatusChanged_1 = require("./onOrderStatusChanged");
12
- const factory_2 = require("../../factory");
10
+ const factory_1 = require("../../factory");
13
11
  const debug = (0, debug_1.default)('chevre-domain:service:order');
14
12
  /**
15
13
  * 注文を配送する
16
14
  */
17
15
  function sendOrder(params) {
18
- return async (repos
19
- // settings: Settings
20
- ) => {
16
+ return async (repos) => {
21
17
  if (typeof params.useOnOrderStatusChanged !== 'boolean') {
22
- throw new factory_2.factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
18
+ throw new factory_1.factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
23
19
  }
24
20
  if (typeof params.object.acceptedOffers?.limit !== 'number') {
25
- throw new factory_2.factory.errors.Argument('object.acceptedOffers.limit', 'must be number');
21
+ throw new factory_1.factory.errors.Argument('object.acceptedOffers.limit', 'must be number');
26
22
  }
27
23
  if (typeof params.object.acceptedOffers?.page !== 'number') {
28
- throw new factory_2.factory.errors.Argument('object.acceptedOffers.page', 'must be number');
24
+ throw new factory_1.factory.errors.Argument('object.acceptedOffers.page', 'must be number');
29
25
  }
30
26
  if (params.object.acceptedOffers.limit <= 0) {
31
- throw new factory_2.factory.errors.Argument('object.acceptedOffers.limit', 'must be greater than 1');
27
+ throw new factory_1.factory.errors.Argument('object.acceptedOffers.limit', 'must be greater than 1');
32
28
  }
33
29
  if (params.object.acceptedOffers.page <= 0) {
34
- throw new factory_2.factory.errors.Argument('object.acceptedOffers.page', 'must be greater than 1');
30
+ throw new factory_1.factory.errors.Argument('object.acceptedOffers.page', 'must be greater than 1');
35
31
  }
36
32
  try {
37
33
  const orderNumber = params.object.orderNumber;
@@ -49,24 +45,16 @@ function sendOrder(params) {
49
45
  });
50
46
  // プロジェクト条件検証
51
47
  if (order.project.id !== params.project.id) {
52
- throw new factory_2.factory.errors.NotFound('Order');
48
+ throw new factory_1.factory.errors.NotFound('Order');
53
49
  }
54
50
  // 確認番号検証
55
51
  if (order.confirmationNumber !== confirmationNumber) {
56
- throw new factory_2.factory.errors.NotFound('Order');
52
+ throw new factory_1.factory.errors.NotFound('Order');
57
53
  }
58
54
  // const maskedCustomer = createMaskedCustomer(order, { noProfile: true });
59
55
  const simpleOrder = {
60
56
  typeOf: order.typeOf,
61
- // seller: {
62
- // id: order.seller.id,
63
- // typeOf: order.seller.typeOf,
64
- // name: order.seller.name
65
- // }, // 廃止(2024-03-06~)
66
- // customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id }, // 廃止(2024-03-06~)
67
57
  orderNumber: order.orderNumber,
68
- // price: order.price,
69
- // priceCurrency: order.priceCurrency,
70
58
  orderDate: order.orderDate
71
59
  };
72
60
  const { limit, page } = params.object.acceptedOffers;
@@ -77,24 +65,24 @@ function sendOrder(params) {
77
65
  const sendOrderActionAttributes = {
78
66
  agent: (typeof params.agent?.typeOf === 'string') ? params.agent : order.project,
79
67
  object: sendOrderObject,
80
- // potentialActions: {},
81
68
  project: order.project,
82
69
  recipient: { id: order.customer.id, typeOf: order.customer.typeOf },
83
- typeOf: factory_2.factory.actionType.SendAction
70
+ typeOf: factory_1.factory.actionType.SendAction
84
71
  };
85
72
  const action = await repos.action.start(sendOrderActionAttributes);
86
- let creatingOwnershipInfos = [];
87
- let createdOwnershipInfos = [];
73
+ // let creatingOwnershipInfos: IOwnershipInfo[] = [];
74
+ const createdOwnershipInfos = [];
88
75
  let allOffersDelivered = false;
89
76
  let acceptedOffers;
90
- // 所有権生成を最小化(2024-03-01~)
91
- let createOwnerships = false;
92
- switch (order.customer.typeOf) {
93
- case factory_2.factory.personType.Person:
94
- createOwnerships = true; // Personのみに限定(2026-03-15~)
95
- break;
96
- default:
97
- }
77
+ // 所有権管理はひとまず廃止(2026-08-10~)
78
+ // // 所有権生成を最小化(2024-03-01~)
79
+ // let createOwnerships = false;
80
+ // switch (order.customer.typeOf) {
81
+ // case factory.personType.Person:
82
+ // createOwnerships = true; // Personのみに限定(2026-03-15~)
83
+ // break;
84
+ // default:
85
+ // }
98
86
  try {
99
87
  const offerIndexBase = (limit * (page - 1));
100
88
  const searchSlicedAcceptedOffersResult = await repos.acceptedOffer.searchSlicedAcceptedOffersByOrderNumber({
@@ -104,29 +92,27 @@ function sendOrder(params) {
104
92
  });
105
93
  acceptedOffers = searchSlicedAcceptedOffersResult.acceptedOffers;
106
94
  debug('delivering...', order.orderNumber, params.object.acceptedOffers, 'offerIndexBase:', offerIndexBase);
107
- // 所有権作成
108
- if (createOwnerships) {
109
- creatingOwnershipInfos = (0, factory_1.createOwnershipInfosFromOrder)({
110
- order: { ...order, acceptedOffers },
111
- offerIndexBase
112
- });
113
- createdOwnershipInfos = await Promise.all(creatingOwnershipInfos.map(async (creatingOwnershipInfo) => {
114
- const { id } = await repos.ownershipInfo.createIfNotExistByIdentifier(creatingOwnershipInfo);
115
- return {
116
- id,
117
- ...(typeof creatingOwnershipInfo.identifier === 'string')
118
- ? { identifier: creatingOwnershipInfo.identifier }
119
- : undefined
120
- };
121
- }));
122
- }
123
- // const deliveredCount = limit * page;
124
- // debug(deliveredCount, 'delivered.', order.orderNumber, params.object.acceptedOffers);
95
+ // 所有権管理はひとまず廃止(2026-08-10~)
96
+ // if (createOwnerships) {
97
+ // creatingOwnershipInfos = createOwnershipInfosFromOrder({
98
+ // order: { ...order, acceptedOffers },
99
+ // offerIndexBase
100
+ // });
101
+ // createdOwnershipInfos = await Promise.all(creatingOwnershipInfos.map(async (creatingOwnershipInfo) => {
102
+ // const { id } = await repos.ownershipInfo.createIfNotExistByIdentifier(creatingOwnershipInfo);
103
+ // return {
104
+ // id,
105
+ // ...(typeof creatingOwnershipInfo.identifier === 'string')
106
+ // ? { identifier: creatingOwnershipInfo.identifier }
107
+ // : undefined
108
+ // };
109
+ // }));
110
+ // }
125
111
  if (acceptedOffers.length === 0) {
126
112
  order = await repos.order.changeStatus({
127
113
  project: { id: order.project.id },
128
114
  orderNumber,
129
- orderStatus: factory_2.factory.orderStatus.OrderDelivered,
115
+ orderStatus: factory_1.factory.orderStatus.OrderDelivered,
130
116
  previousOrderStatus: params.object.previousOrderStatus
131
117
  });
132
118
  allOffersDelivered = true;
@@ -154,7 +140,7 @@ function sendOrder(params) {
154
140
  orderNumber: order.orderNumber,
155
141
  project: order.project,
156
142
  typeOf: order.typeOf,
157
- orderStatus: factory_2.factory.orderStatus.OrderDelivered,
143
+ orderStatus: factory_1.factory.orderStatus.OrderDelivered,
158
144
  price: order.price,
159
145
  priceCurrency: order.priceCurrency
160
146
  }
@@ -180,7 +166,7 @@ function sendOrder(params) {
180
166
  project: { id: params.project.id },
181
167
  inclusion: ['orderStatus']
182
168
  });
183
- if (currentOrder?.orderStatus === factory_2.factory.orderStatus.OrderReturned) {
169
+ if (currentOrder?.orderStatus === factory_1.factory.orderStatus.OrderReturned) {
184
170
  throwsError = false;
185
171
  }
186
172
  if (throwsError) {
@@ -7,7 +7,7 @@ const action_1 = require("../../repo/action");
7
7
  const assetTransaction_1 = require("../../repo/assetTransaction");
8
8
  const authorization_1 = require("../../repo/authorization");
9
9
  const order_1 = require("../../repo/order");
10
- const ownershipInfo_1 = require("../../repo/ownershipInfo");
10
+ // import { OwnershipInfoRepo } from '../../repo/ownershipInfo';
11
11
  const reservation_1 = require("../../repo/reservation");
12
12
  const setting_1 = require("../../repo/setting");
13
13
  const task_1 = require("../../repo/task");
@@ -23,7 +23,7 @@ function call(params) {
23
23
  assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
24
24
  code: new authorization_1.AuthorizationRepo(connection),
25
25
  order: new order_1.OrderRepo(connection),
26
- ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
26
+ // ownershipInfo: new OwnershipInfoRepo(connection),
27
27
  reservation: new reservation_1.ReservationRepo(connection),
28
28
  setting: new setting_1.SettingRepo(connection),
29
29
  task: new task_1.TaskRepo(connection)
@@ -4,7 +4,6 @@ exports.call = call;
4
4
  const acceptedOffer_1 = require("../../repo/acceptedOffer");
5
5
  const action_1 = require("../../repo/action");
6
6
  const order_1 = require("../../repo/order");
7
- const ownershipInfo_1 = require("../../repo/ownershipInfo");
8
7
  const setting_1 = require("../../repo/setting");
9
8
  const task_1 = require("../../repo/task");
10
9
  const returnOrder_1 = require("../../repo/transaction/returnOrder");
@@ -22,12 +21,10 @@ function call(params) {
22
21
  acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
23
22
  action: new action_1.ActionRepo(connection),
24
23
  order: new order_1.OrderRepo(connection),
25
- ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
24
+ // ownershipInfo: new OwnershipInfoRepo(connection),
26
25
  setting: new setting_1.SettingRepo(connection),
27
26
  task: new task_1.TaskRepo(connection),
28
27
  returnOrder: new returnOrder_1.ReturnOrderRepo(connection)
29
- }
30
- // settings
31
- );
28
+ });
32
29
  };
33
30
  }
@@ -5,7 +5,7 @@ const factory_1 = require("../../factory");
5
5
  const acceptedOffer_1 = require("../../repo/acceptedOffer");
6
6
  const action_1 = require("../../repo/action");
7
7
  const order_1 = require("../../repo/order");
8
- const ownershipInfo_1 = require("../../repo/ownershipInfo");
8
+ // import { OwnershipInfoRepo } from '../../repo/ownershipInfo';
9
9
  const setting_1 = require("../../repo/setting");
10
10
  const task_1 = require("../../repo/task");
11
11
  const placeOrder_1 = require("../../repo/transaction/placeOrder");
@@ -32,7 +32,7 @@ function call(params) {
32
32
  acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
33
33
  action: new action_1.ActionRepo(connection),
34
34
  order: new order_1.OrderRepo(connection),
35
- ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
35
+ // ownershipInfo: new OwnershipInfoRepo(connection),
36
36
  setting: new setting_1.SettingRepo(connection),
37
37
  task: new task_1.TaskRepo(connection),
38
38
  placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
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": "26.0.0-alpha.24"
91
+ "version": "26.0.0-alpha.25"
92
92
  }