@chevre/domain 20.4.0-alpha.1 → 20.4.0-alpha.10

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 (47) hide show
  1. package/example/src/chevre/createManyEventsIfNotExist.ts +10 -10
  2. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +96 -0
  3. package/example/src/chevre/unsetUnnecessaryFields.ts +26 -0
  4. package/lib/chevre/repo/account.d.ts +4 -10
  5. package/lib/chevre/repo/account.js +72 -60
  6. package/lib/chevre/repo/accountTransaction.d.ts +0 -1
  7. package/lib/chevre/repo/accountTransaction.js +1 -1
  8. package/lib/chevre/repo/assetTransaction.d.ts +1 -0
  9. package/lib/chevre/repo/assetTransaction.js +5 -0
  10. package/lib/chevre/repo/event.js +7 -1
  11. package/lib/chevre/repo/mongoose/model/comments.d.ts +1 -1
  12. package/lib/chevre/repo/mongoose/model/comments.js +1 -1
  13. package/lib/chevre/repo/serviceOutput.d.ts +4 -0
  14. package/lib/chevre/repo/serviceOutput.js +6 -0
  15. package/lib/chevre/repository.d.ts +6 -3
  16. package/lib/chevre/repository.js +8 -5
  17. package/lib/chevre/service/account.d.ts +0 -8
  18. package/lib/chevre/service/account.js +16 -37
  19. package/lib/chevre/service/accountTransaction/deposit.js +2 -5
  20. package/lib/chevre/service/accountTransaction/factory.js +36 -40
  21. package/lib/chevre/service/accountTransaction/transfer.js +4 -6
  22. package/lib/chevre/service/accountTransaction/withdraw.js +2 -5
  23. package/lib/chevre/service/accountTransaction.js +1 -1
  24. package/lib/chevre/service/assetTransaction/moneyTransfer.js +19 -11
  25. package/lib/chevre/service/assetTransaction/pay.js +17 -11
  26. package/lib/chevre/service/assetTransaction/registerService/factory.js +9 -4
  27. package/lib/chevre/service/delivery.js +12 -3
  28. package/lib/chevre/service/event.js +3 -23
  29. package/lib/chevre/service/moneyTransfer.d.ts +1 -1
  30. package/lib/chevre/service/moneyTransfer.js +8 -9
  31. package/lib/chevre/service/offer/moneyTransfer/authorize.js +0 -1
  32. package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +0 -1
  33. package/lib/chevre/service/payment/paymentCard.d.ts +6 -2
  34. package/lib/chevre/service/payment/paymentCard.js +16 -8
  35. package/lib/chevre/service/permit.d.ts +5 -1
  36. package/lib/chevre/service/permit.js +18 -11
  37. package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
  38. package/lib/chevre/settings.d.ts +1 -0
  39. package/lib/chevre/settings.js +2 -2
  40. package/package.json +3 -3
  41. package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +0 -157
  42. package/example/src/chevre/migrateProjectSubscription.ts +0 -51
  43. package/example/src/chevre/migrateSection.ts +0 -105
  44. package/lib/chevre/repo/accountAction.d.ts +0 -42
  45. package/lib/chevre/repo/accountAction.js +0 -474
  46. package/lib/chevre/repo/mongoose/model/accountAction.d.ts +0 -7
  47. package/lib/chevre/repo/mongoose/model/accountAction.js +0 -177
@@ -31,16 +31,16 @@ async function main() {
31
31
  .toDate(),
32
32
  endDate: moment('2023-02-01T06:00:00.000Z')
33
33
  .toDate(),
34
- workPerformed: {
35
- typeOf: chevre.factory.creativeWorkType.Movie,
36
- identifier: '1622100',
37
- id: '5bfb841d5a78d7948369980a',
38
- name: {
39
- en: 'Pet',
40
- ja: 'ペット'
41
- },
42
- duration: 'PT2H3M'
43
- },
34
+ // workPerformed: {
35
+ // typeOf: chevre.factory.creativeWorkType.Movie,
36
+ // identifier: '1622100',
37
+ // id: '5bfb841d5a78d7948369980a',
38
+ // name: {
39
+ // en: 'Pet',
40
+ // ja: 'ペット'
41
+ // },
42
+ // duration: 'PT2H3M'
43
+ // },
44
44
  location: {
45
45
  typeOf: chevre.factory.placeType.ScreeningRoom,
46
46
  branchCode: '10',
@@ -0,0 +1,96 @@
1
+ // tslint:disable:no-console
2
+ import * as moment from 'moment';
3
+ import * as mongoose from 'mongoose';
4
+
5
+ import { chevre } from '../../../lib/index';
6
+
7
+ const project = { id: String(process.env.PROJECT_ID) };
8
+
9
+ // tslint:disable-next-line:max-func-body-length
10
+ async function main() {
11
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
+
13
+ const accountTransactionRepo = new chevre.repository.AccountTransaction(mongoose.connection);
14
+ const assetTransactionRepo = new chevre.repository.AssetTransaction(mongoose.connection);
15
+
16
+ const cursor = assetTransactionRepo.getCursor(
17
+ {
18
+ 'project.id': { $eq: project.id },
19
+ typeOf: { $eq: chevre.factory.assetTransactionType.MoneyTransfer },
20
+ startDate: {
21
+ $gte: moment('2023-02-17T15:00:00Z')
22
+ .toDate()
23
+ }
24
+ // _id: { $eq: 'al6aff83w' }
25
+ },
26
+ {
27
+ // _id: 1,
28
+ }
29
+ );
30
+ console.log('assetTransactions found');
31
+
32
+ let i = 0;
33
+ let updateCount = 0;
34
+ // tslint:disable-next-line:max-func-body-length
35
+ await cursor.eachAsync(async (doc) => {
36
+ i += 1;
37
+ const moneyTransferTransaction: chevre.factory.assetTransaction.moneyTransfer.ITransaction = doc.toObject();
38
+
39
+ const description = moneyTransferTransaction.object.description;
40
+ if (description !== '鑑賞' && description !== '受け取り') {
41
+ console.log(
42
+ 'no operation needed',
43
+ description,
44
+ moneyTransferTransaction.project.id,
45
+ moneyTransferTransaction.transactionNumber,
46
+ moneyTransferTransaction.startDate
47
+ );
48
+ } else {
49
+ const pendingTransactionIdentifier = moneyTransferTransaction.object.pendingTransaction?.identifier;
50
+ if (typeof pendingTransactionIdentifier === 'string' && pendingTransactionIdentifier.length > 0) {
51
+ console.log(
52
+ 'pendingTransactionIdentifier found',
53
+ description,
54
+ moneyTransferTransaction.project.id,
55
+ moneyTransferTransaction.transactionNumber,
56
+ moneyTransferTransaction.startDate
57
+ );
58
+ } else {
59
+ // 口座取引からidentifierを取得
60
+ const accountTransaction =
61
+ await accountTransactionRepo.findByTransactionNumber({ transactionNumber: moneyTransferTransaction.transactionNumber });
62
+ console.log(
63
+ 'updating identifier...',
64
+ accountTransaction.identifier,
65
+ description,
66
+ moneyTransferTransaction.project.id,
67
+ moneyTransferTransaction.transactionNumber,
68
+ moneyTransferTransaction.startDate
69
+ );
70
+ if (typeof accountTransaction.identifier === 'string') {
71
+ await assetTransactionRepo.findByIdAndUpdate({
72
+ id: moneyTransferTransaction.id,
73
+ update: {
74
+ 'object.pendingTransaction.identifier': accountTransaction.identifier
75
+ }
76
+ });
77
+ }
78
+ console.log(
79
+ 'ientifier updated',
80
+ accountTransaction.identifier,
81
+ description,
82
+ moneyTransferTransaction.project.id,
83
+ moneyTransferTransaction.transactionNumber,
84
+ moneyTransferTransaction.startDate
85
+ );
86
+ updateCount += 1;
87
+ }
88
+ }
89
+ });
90
+ console.log(i, 'assetTransactions checked');
91
+ console.log(updateCount, 'assetTransactions updated');
92
+ }
93
+
94
+ main()
95
+ .then()
96
+ .catch(console.error);
@@ -0,0 +1,26 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ async function main() {
7
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
8
+
9
+ const accountRepo = new chevre.repository.Account(mongoose.connection);
10
+ const permitRepo = new chevre.repository.ServiceOutput(mongoose.connection);
11
+
12
+ let updateResult = await accountRepo.unsetUnnecessaryFields({
13
+ filter: { status: { $exists: true } },
14
+ $unset: { status: 1 }
15
+ });
16
+ console.log('accounts unset.', updateResult);
17
+ updateResult = await permitRepo.unsetUnnecessaryFields({
18
+ filter: { 'paymentAccount.accountType': { $exists: true } },
19
+ $unset: { 'paymentAccount.accountType': 1 }
20
+ });
21
+ console.log('permits unset', updateResult);
22
+ }
23
+
24
+ main()
25
+ .then()
26
+ .catch(console.error);
@@ -45,16 +45,6 @@ export declare class MongoRepository {
45
45
  /**
46
46
  * 口座を解約する
47
47
  */
48
- close(params: {
49
- /**
50
- * 口座番号
51
- */
52
- accountNumber: string;
53
- /**
54
- * 解約日時
55
- */
56
- closeDate: Date;
57
- }): Promise<void>;
58
48
  /**
59
49
  * 口座番号で検索する
60
50
  */
@@ -134,4 +124,8 @@ export declare class MongoRepository {
134
124
  * 口座を検索する
135
125
  */
136
126
  search(params: factory.account.ISearchConditions): Promise<factory.account.IAccount[]>;
127
+ unsetUnnecessaryFields(params: {
128
+ filter: any;
129
+ $unset: any;
130
+ }): Promise<import("mongoose").UpdateWriteOpResult>;
137
131
  }
@@ -10,11 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = exports.modelName = void 0;
13
- const createDebug = require("debug");
14
13
  const account_1 = require("./mongoose/model/account");
15
14
  Object.defineProperty(exports, "modelName", { enumerable: true, get: function () { return account_1.modelName; } });
16
15
  const factory = require("../factory");
17
- const debug = createDebug('chevre-domain:repository');
18
16
  /**
19
17
  * 口座リポジトリ
20
18
  */
@@ -93,11 +91,11 @@ class MongoRepository {
93
91
  }
94
92
  // tslint:disable-next-line:no-single-line-block-comment
95
93
  /* istanbul ignore else */
96
- if (Array.isArray(params.statuses) && params.statuses.length > 0) {
97
- andConditions.push({
98
- status: { $in: params.statuses }
99
- });
100
- }
94
+ // if (Array.isArray(params.statuses) && params.statuses.length > 0) {
95
+ // andConditions.push({
96
+ // status: { $in: params.statuses }
97
+ // });
98
+ // }
101
99
  const nameRegex = (_d = params.name) === null || _d === void 0 ? void 0 : _d.$regex;
102
100
  // tslint:disable-next-line:no-single-line-block-comment
103
101
  /* istanbul ignore else */
@@ -159,8 +157,8 @@ class MongoRepository {
159
157
  balance: p.initialBalance,
160
158
  availableBalance: p.initialBalance,
161
159
  pendingTransactions: [],
162
- openDate: p.openDate,
163
- status: factory.account.AccountStatusType.Opened
160
+ openDate: p.openDate
161
+ // status: factory.account.AccountStatusType.Opened
164
162
  };
165
163
  });
166
164
  // const doc = await this.accountModel.create(account);
@@ -179,39 +177,47 @@ class MongoRepository {
179
177
  /**
180
178
  * 口座を解約する
181
179
  */
182
- close(params) {
183
- return __awaiter(this, void 0, void 0, function* () {
184
- debug('closing account...');
185
- const doc = yield this.accountModel.findOneAndUpdate({
186
- accountNumber: params.accountNumber,
187
- pendingTransactions: { $size: 0 },
188
- status: factory.account.AccountStatusType.Opened
189
- }, {
190
- closeDate: params.closeDate,
191
- status: factory.account.AccountStatusType.Closed
192
- }, {
193
- new: true
194
- })
195
- .exec();
196
- // NotFoundであれば口座状態確認
197
- if (doc === null) {
198
- const account = yield this.findByAccountNumber({
199
- accountNumber: params.accountNumber
200
- });
201
- if (account.status === factory.account.AccountStatusType.Closed) {
202
- // すでに口座解約済の場合
203
- return;
204
- }
205
- else if (Array.isArray(account.pendingTransactions) && account.pendingTransactions.length > 0) {
206
- // 進行中取引が存在する場合の場合
207
- throw new factory.errors.Argument('accountNumber', 'Pending transactions exist');
208
- }
209
- else {
210
- throw new factory.errors.NotFound(this.accountModel.modelName);
211
- }
212
- }
213
- });
214
- }
180
+ // public async close(params: {
181
+ // /**
182
+ // * 口座番号
183
+ // */
184
+ // accountNumber: string;
185
+ // /**
186
+ // * 解約日時
187
+ // */
188
+ // closeDate: Date;
189
+ // }) {
190
+ // const doc = await this.accountModel.findOneAndUpdate(
191
+ // {
192
+ // accountNumber: params.accountNumber,
193
+ // pendingTransactions: { $size: 0 },
194
+ // status: factory.account.AccountStatusType.Opened
195
+ // },
196
+ // {
197
+ // closeDate: params.closeDate,
198
+ // status: factory.account.AccountStatusType.Closed
199
+ // },
200
+ // {
201
+ // new: true
202
+ // }
203
+ // )
204
+ // .exec();
205
+ // // NotFoundであれば口座状態確認
206
+ // if (doc === null) {
207
+ // const account = await this.findByAccountNumber({
208
+ // accountNumber: params.accountNumber
209
+ // });
210
+ // if (account.status === factory.account.AccountStatusType.Closed) {
211
+ // // すでに口座解約済の場合
212
+ // return;
213
+ // } else if (Array.isArray(account.pendingTransactions) && account.pendingTransactions.length > 0) {
214
+ // // 進行中取引が存在する場合の場合
215
+ // throw new factory.errors.Argument('accountNumber', 'Pending transactions exist');
216
+ // } else {
217
+ // throw new factory.errors.NotFound(this.accountModel.modelName);
218
+ // }
219
+ // }
220
+ // }
215
221
  /**
216
222
  * 口座番号で検索する
217
223
  */
@@ -233,7 +239,7 @@ class MongoRepository {
233
239
  */
234
240
  authorizeAmount(params) {
235
241
  return __awaiter(this, void 0, void 0, function* () {
236
- const doc = yield this.accountModel.findOneAndUpdate(Object.assign({ accountNumber: params.accountNumber, status: factory.account.AccountStatusType.Opened }, (params.force === true) ? undefined : { availableBalance: { $gte: params.amount } } // 利用可能金額確認
242
+ const doc = yield this.accountModel.findOneAndUpdate(Object.assign({ accountNumber: params.accountNumber }, (params.force === true) ? undefined : { availableBalance: { $gte: params.amount } } // 利用可能金額確認
237
243
  ), {
238
244
  $inc: { availableBalance: -params.amount },
239
245
  $push: { pendingTransactions: params.transaction } // 進行中取引追加
@@ -244,11 +250,11 @@ class MongoRepository {
244
250
  const account = yield this.findByAccountNumber({
245
251
  accountNumber: params.accountNumber
246
252
  });
247
- if (account.status === factory.account.AccountStatusType.Closed) {
248
- // 口座解約済の場合
249
- throw new factory.errors.Argument('accountNumber', 'Account already closed');
250
- }
251
- else if (typeof account.availableBalance === 'number' && account.availableBalance < params.amount) {
253
+ // if (account.status === factory.account.AccountStatusType.Closed) {
254
+ // // 口座解約済の場合
255
+ // throw new factory.errors.Argument('accountNumber', 'Account already closed');
256
+ // } else
257
+ if (typeof account.availableBalance === 'number' && account.availableBalance < params.amount) {
252
258
  // 残高不足の場合
253
259
  throw new factory.errors.Argument('accountNumber', 'Insufficient balance');
254
260
  }
@@ -264,22 +270,22 @@ class MongoRepository {
264
270
  startTransaction(params) {
265
271
  return __awaiter(this, void 0, void 0, function* () {
266
272
  const doc = yield this.accountModel.findOneAndUpdate({
267
- accountNumber: params.accountNumber,
268
- status: factory.account.AccountStatusType.Opened // 開いている口座
273
+ accountNumber: params.accountNumber
274
+ // status: factory.account.AccountStatusType.Opened // 開いている口座
269
275
  }, { $push: { pendingTransactions: params.transaction } })
270
276
  .exec();
271
277
  // NotFoundであれば口座状態確認
272
278
  if (doc === null) {
273
- const account = yield this.findByAccountNumber({
274
- accountNumber: params.accountNumber
275
- });
276
- if (account.status === factory.account.AccountStatusType.Closed) {
277
- // 口座解約済の場合
278
- throw new factory.errors.Argument('accountNumber', 'Account already closed');
279
- }
280
- else {
281
- throw new factory.errors.NotFound(this.accountModel.modelName);
282
- }
279
+ // const account = await this.findByAccountNumber({
280
+ // accountNumber: params.accountNumber
281
+ // });
282
+ // if (account.status === factory.account.AccountStatusType.Closed) {
283
+ // // 口座解約済の場合
284
+ // throw new factory.errors.Argument('accountNumber', 'Account already closed');
285
+ // } else {
286
+ // throw new factory.errors.NotFound(this.accountModel.modelName);
287
+ // }
288
+ throw new factory.errors.NotFound(this.accountModel.modelName);
283
289
  }
284
290
  });
285
291
  }
@@ -419,5 +425,11 @@ class MongoRepository {
419
425
  .then((docs) => docs.map((doc) => doc.toObject()));
420
426
  });
421
427
  }
428
+ unsetUnnecessaryFields(params) {
429
+ return __awaiter(this, void 0, void 0, function* () {
430
+ return this.accountModel.updateMany(params.filter, { $unset: params.$unset })
431
+ .exec();
432
+ });
433
+ }
422
434
  }
423
435
  exports.MongoRepository = MongoRepository;
@@ -34,7 +34,6 @@ export declare class MongoRepository {
34
34
  confirm<T extends factory.account.transactionType>(params: {
35
35
  typeOf?: T;
36
36
  id: string;
37
- result: factory.account.transaction.IResult;
38
37
  potentialActions: factory.account.transaction.IPotentialActions;
39
38
  }): Promise<factory.account.transaction.ITransaction<T>>;
40
39
  /**
@@ -154,7 +154,7 @@ class MongoRepository {
154
154
  const doc = yield this.transactionModel.findOneAndUpdate(Object.assign({ _id: params.id, status: factory.transactionStatusType.InProgress }, (typeof params.typeOf === 'string') ? { typeOf: params.typeOf } : undefined), {
155
155
  status: factory.transactionStatusType.Confirmed,
156
156
  endDate: new Date(),
157
- result: params.result,
157
+ // result: params.result, // resultを更新
158
158
  potentialActions: params.potentialActions
159
159
  }, { new: true })
160
160
  .exec();
@@ -144,6 +144,7 @@ export declare class MongoRepository {
144
144
  findByIdAndDelete(params: {
145
145
  id: string;
146
146
  }): Promise<void>;
147
+ getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
147
148
  aggregateAssetTransaction(params: {
148
149
  project?: {
149
150
  id?: {
@@ -536,6 +536,11 @@ class MongoRepository {
536
536
  .exec();
537
537
  });
538
538
  }
539
+ getCursor(conditions, projection) {
540
+ return this.transactionModel.find(conditions, projection)
541
+ .sort({ startDate: factory.sortType.Ascending })
542
+ .cursor();
543
+ }
539
544
  aggregateAssetTransaction(params) {
540
545
  return __awaiter(this, void 0, void 0, function* () {
541
546
  const statuses = yield Promise.all([
@@ -466,10 +466,14 @@ class MongoRepository {
466
466
  if (Array.isArray(params)) {
467
467
  params.forEach((creatingEventParams) => {
468
468
  var _a, _b;
469
+ if (creatingEventParams.attributes.typeOf !== factory.eventType.ScreeningEvent) {
470
+ throw new factory.errors.NotImplemented(`${factory.eventType.ScreeningEventSeries} not implemented`);
471
+ }
469
472
  const additionalPropertyValue = (_b = (_a = creatingEventParams.attributes.additionalProperty) === null || _a === void 0 ? void 0 : _a.find((property) => property.name === creatingEventParams.filter.name)) === null || _b === void 0 ? void 0 : _b.value;
470
473
  if (typeof additionalPropertyValue !== 'string') {
471
474
  throw new factory.errors.NotFound('additionalProperty.value');
472
475
  }
476
+ const _c = creatingEventParams.attributes, { eventStatus } = _c, setOnInsertFields = __rest(_c, ["eventStatus"]);
473
477
  bulkWriteOps.push({
474
478
  updateOne: {
475
479
  filter: {
@@ -481,7 +485,9 @@ class MongoRepository {
481
485
  }
482
486
  },
483
487
  update: {
484
- $setOnInsert: Object.assign({ _id: uniqid() }, creatingEventParams.attributes)
488
+ $setOnInsert: Object.assign(Object.assign({}, setOnInsertFields), { _id: uniqid() }),
489
+ // 変更可能な属性のみ上書き
490
+ $set: { eventStatus }
485
491
  },
486
492
  upsert: true
487
493
  }
@@ -1,5 +1,5 @@
1
1
  import * as mongoose from 'mongoose';
2
- declare const modelName = "CreativeWork";
2
+ declare const modelName = "Comment";
3
3
  /**
4
4
  * コメントスキーマ
5
5
  */
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose = require("mongoose");
5
- const modelName = 'CreativeWork';
5
+ const modelName = 'Comment';
6
6
  exports.modelName = modelName;
7
7
  const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
8
8
  /**
@@ -29,4 +29,8 @@ export declare class MongoRepository {
29
29
  id: string;
30
30
  };
31
31
  }): Promise<void>;
32
+ unsetUnnecessaryFields(params: {
33
+ filter: any;
34
+ $unset: any;
35
+ }): Promise<import("mongoose").UpdateWriteOpResult>;
32
36
  }
@@ -169,5 +169,11 @@ class MongoRepository {
169
169
  .exec();
170
170
  });
171
171
  }
172
+ unsetUnnecessaryFields(params) {
173
+ return __awaiter(this, void 0, void 0, function* () {
174
+ return this.serviceOutputModel.updateMany(params.filter, { $unset: params.$unset })
175
+ .exec();
176
+ });
177
+ }
172
178
  }
173
179
  exports.MongoRepository = MongoRepository;
@@ -11,6 +11,7 @@ import { MongoRepository as AggregationRepo } from './repo/aggregation';
11
11
  import { MongoRepository as AssetTransactionRepo } from './repo/assetTransaction';
12
12
  import { MongoRepository as CategoryCodeRepo } from './repo/categoryCode';
13
13
  import { MongoRepository as CodeRepo } from './repo/code';
14
+ import { MongoRepository as CommentRepo } from './repo/comment';
14
15
  import { MongoRepository as CreativeWorkRepo } from './repo/creativeWork';
15
16
  import { MongoRepository as CustomerRepo } from './repo/customer';
16
17
  import { MongoRepository as EmailMessageRepo } from './repo/emailMessage';
@@ -48,9 +49,6 @@ import { CognitoRepository as PersonRepo } from './repo/person';
48
49
  */
49
50
  export declare class Account extends AccountRepo {
50
51
  }
51
- /**
52
- * 口座アクションリポジトリ
53
- */
54
52
  /**
55
53
  * 経理レポートリポジトリ
56
54
  */
@@ -85,6 +83,11 @@ export declare class CategoryCode extends CategoryCodeRepo {
85
83
  */
86
84
  export declare class Code extends CodeRepo {
87
85
  }
86
+ /**
87
+ * コメントリポジトリ
88
+ */
89
+ export declare class Comment extends CommentRepo {
90
+ }
88
91
  /**
89
92
  * 確認番号リポジトリ
90
93
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rateLimit = exports.itemAvailability = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Aggregation = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
3
+ exports.rateLimit = exports.itemAvailability = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Aggregation = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
4
4
  // tslint:disable:max-classes-per-file completed-docs
5
5
  /**
6
6
  * リポジトリ
@@ -15,6 +15,7 @@ const aggregation_1 = require("./repo/aggregation");
15
15
  const assetTransaction_1 = require("./repo/assetTransaction");
16
16
  const categoryCode_1 = require("./repo/categoryCode");
17
17
  const code_1 = require("./repo/code");
18
+ const comment_1 = require("./repo/comment");
18
19
  const creativeWork_1 = require("./repo/creativeWork");
19
20
  const customer_1 = require("./repo/customer");
20
21
  const emailMessage_1 = require("./repo/emailMessage");
@@ -53,10 +54,6 @@ const person_1 = require("./repo/person");
53
54
  class Account extends account_1.MongoRepository {
54
55
  }
55
56
  exports.Account = Account;
56
- /**
57
- * 口座アクションリポジトリ
58
- */
59
- // export class AccountAction extends AccountActionRepo { }
60
57
  /**
61
58
  * 経理レポートリポジトリ
62
59
  */
@@ -102,6 +99,12 @@ exports.CategoryCode = CategoryCode;
102
99
  class Code extends code_1.MongoRepository {
103
100
  }
104
101
  exports.Code = Code;
102
+ /**
103
+ * コメントリポジトリ
104
+ */
105
+ class Comment extends comment_1.MongoRepository {
106
+ }
107
+ exports.Comment = Comment;
105
108
  /**
106
109
  * 確認番号リポジトリ
107
110
  */
@@ -37,14 +37,6 @@ export declare function open(params: {
37
37
  /**
38
38
  * 口座を解約する
39
39
  */
40
- export declare function close(params: {
41
- /**
42
- * 口座番号
43
- */
44
- accountNumber: string;
45
- }): (repos: {
46
- account: AccountRepo;
47
- }) => Promise<void>;
48
40
  /**
49
41
  * 転送する
50
42
  * 確定取引結果から、実際の転送アクションを実行します。
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.cancelMoneyTransfer = exports.transferMoney = exports.close = exports.open = void 0;
12
+ exports.cancelMoneyTransfer = exports.transferMoney = exports.open = void 0;
13
13
  /**
14
14
  * 口座サービス
15
15
  * 開設、閉鎖等、口座アクション実行など
@@ -38,27 +38,27 @@ exports.open = open;
38
38
  /**
39
39
  * 口座を解約する
40
40
  */
41
- function close(params) {
42
- return (repos) => __awaiter(this, void 0, void 0, function* () {
43
- yield repos.account.close({
44
- accountNumber: params.accountNumber,
45
- closeDate: new Date()
46
- });
47
- });
48
- }
49
- exports.close = close;
41
+ // export function close(params: {
42
+ // /**
43
+ // * 口座番号
44
+ // */
45
+ // accountNumber: string;
46
+ // }) {
47
+ // return async (repos: {
48
+ // account: AccountRepo;
49
+ // }) => {
50
+ // await repos.account.close({
51
+ // accountNumber: params.accountNumber,
52
+ // closeDate: new Date()
53
+ // });
54
+ // };
55
+ // }
50
56
  /**
51
57
  * 転送する
52
58
  * 確定取引結果から、実際の転送アクションを実行します。
53
59
  */
54
60
  function transferMoney(actionAttributes) {
55
61
  return (repos) => __awaiter(this, void 0, void 0, function* () {
56
- // 口座取引におけるAccountAction管理を廃止(2022-11-28~)
57
- // let action = await repos.accountAction.startByIdentifier<factory.actionType.MoneyTransfer>(actionAttributes);
58
- // すでに完了していれば何もしない
59
- // if (action.actionStatus === factory.actionStatusType.CompletedActionStatus) {
60
- // return;
61
- // }
62
62
  const action = actionAttributes;
63
63
  let fromAccountNumber;
64
64
  let toAccountNumber;
@@ -81,18 +81,8 @@ function transferMoney(actionAttributes) {
81
81
  });
82
82
  }
83
83
  catch (error) {
84
- // actionにエラー結果を追加
85
- // try {
86
- // const actionError = { ...error, message: error.message, name: error.name };
87
- // await repos.accountAction.giveUp(action.typeOf, action.id, actionError);
88
- // } catch (__) {
89
- // // 失敗したら仕方ない
90
- // }
91
84
  throw error;
92
85
  }
93
- // アクション完了
94
- // const actionResult: factory.account.action.moneyTransfer.IResult = {};
95
- // action = await repos.accountAction.complete(action.typeOf, action.id, actionResult);
96
86
  });
97
87
  }
98
88
  exports.transferMoney = transferMoney;
@@ -133,17 +123,6 @@ function cancelMoneyTransfer(params) {
133
123
  : transaction.object.amount.value,
134
124
  transactionId: transaction.id
135
125
  });
136
- // 口座取引におけるAccountAction管理を廃止(2022-11-28~)
137
- // アクション取得
138
- // const actions = await repos.accountAction.searchTransferActions({
139
- // purpose: {
140
- // typeOf: { $eq: transaction.typeOf },
141
- // id: { $eq: transaction.id }
142
- // }
143
- // });
144
- // await Promise.all(actions.map(async (action) => {
145
- // await repos.accountAction.cancel(action.typeOf, action.id);
146
- // }));
147
126
  });
148
127
  }
149
128
  exports.cancelMoneyTransfer = cancelMoneyTransfer;