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

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 (43) hide show
  1. package/lib/chevre/repo/adminAssetTransaction.d.ts +132 -0
  2. package/lib/chevre/repo/adminAssetTransaction.js +504 -0
  3. package/lib/chevre/repo/adminTransaction.d.ts +131 -0
  4. package/lib/chevre/repo/adminTransaction.js +237 -0
  5. package/lib/chevre/repo/aggregateAssetTransaction.d.ts +43 -0
  6. package/lib/chevre/repo/aggregateAssetTransaction.js +166 -0
  7. package/lib/chevre/repo/aggregateTransaction.d.ts +39 -0
  8. package/lib/chevre/repo/aggregateTransaction.js +166 -0
  9. package/lib/chevre/repo/assetTransaction.d.ts +10 -235
  10. package/lib/chevre/repo/assetTransaction.js +48 -636
  11. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +8 -9
  12. package/lib/chevre/repo/mongoose/schemas/event.js +7 -0
  13. package/lib/chevre/repo/mongoose/schemas/eventOffer.js +7 -0
  14. package/lib/chevre/repo/mongoose/schemas/pendingReservation.js +11 -4
  15. package/lib/chevre/repo/transaction.d.ts +1 -187
  16. package/lib/chevre/repo/transaction.js +2 -383
  17. package/lib/chevre/repository.d.ts +20 -5
  18. package/lib/chevre/repository.js +46 -13
  19. package/lib/chevre/service/aggregation/system.d.ts +7 -7
  20. package/lib/chevre/service/aggregation/system.js +4 -4
  21. package/lib/chevre/service/assetTransaction/cancelReservation/start.js +10 -17
  22. package/lib/chevre/service/assetTransaction/refund.js +2 -2
  23. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -3
  24. package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +1 -49
  25. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
  26. package/lib/chevre/service/payment/any/processVoidPayTransaction.js +1 -1
  27. package/lib/chevre/service/reserve/cancelReservation.js +3 -3
  28. package/lib/chevre/service/reserve/checkInReservation.js +2 -2
  29. package/lib/chevre/service/reserve/confirmReservation.js +1 -1
  30. package/lib/chevre/service/reserve/useReservation.js +1 -1
  31. package/lib/chevre/service/task/deleteTransaction.js +2 -4
  32. package/lib/chevre/service/task/returnPayTransaction.js +2 -2
  33. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +2 -2
  34. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +2 -2
  35. package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -2
  36. package/lib/chevre/service/transaction/deleteTransaction.js +2 -2
  37. package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
  38. package/lib/chevre/service/validation/validateOrder.js +2 -2
  39. package/package.json +2 -2
  40. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +0 -13
  41. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +0 -82
  42. package/lib/chevre/repo/ownershipInfo.d.ts +0 -20
  43. package/lib/chevre/repo/ownershipInfo.js +0 -130
@@ -1,130 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OwnershipInfoRepo = void 0;
4
- // import { v4 } from 'uuid';
5
- const ownershipInfo_1 = require("./mongoose/schemas/ownershipInfo");
6
- const settings_1 = require("../settings");
7
- /**
8
- * 所有権リポジトリ
9
- */
10
- class OwnershipInfoRepo {
11
- ownershipInfoModel;
12
- constructor(connection) {
13
- this.ownershipInfoModel = connection.model(ownershipInfo_1.modelName, (0, ownershipInfo_1.createSchema)());
14
- }
15
- static CREATE_MONGO_CONDITIONS(params) {
16
- const andConditions = [];
17
- const projectIdEq = params.project?.id?.$eq;
18
- if (typeof projectIdEq === 'string') {
19
- andConditions.push({ 'project.id': { $eq: projectIdEq } });
20
- }
21
- const ownedFromGte = params.ownedFromGte;
22
- if (ownedFromGte instanceof Date) {
23
- andConditions.push({
24
- ownedFrom: { $gte: ownedFromGte }
25
- });
26
- }
27
- const ownedFromLte = params.ownedFromLte;
28
- if (ownedFromLte instanceof Date) {
29
- andConditions.push({
30
- ownedFrom: { $lte: ownedFromLte }
31
- });
32
- }
33
- return andConditions;
34
- }
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
- // }
88
- /**
89
- * 所有権を検索する
90
- */
91
- async findOwnershipInfos(params, inclusion) {
92
- const conditions = OwnershipInfoRepo.CREATE_MONGO_CONDITIONS(params);
93
- let projection = {
94
- _id: 0,
95
- id: { $toString: '$_id' },
96
- project: 1,
97
- typeOf: 1,
98
- identifier: 1,
99
- ownedBy: 1,
100
- acquiredFrom: 1,
101
- ownedFrom: 1,
102
- ownedThrough: 1,
103
- typeOfGood: 1
104
- };
105
- const positiveProjectionFields = (Array.isArray(inclusion))
106
- ? inclusion.filter((key) => key !== 'id' && String(key) !== '_id')
107
- : undefined;
108
- if (Array.isArray(positiveProjectionFields)) {
109
- projection = {
110
- _id: 0,
111
- id: { $toString: '$_id' },
112
- ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
113
- };
114
- }
115
- const query = this.ownershipInfoModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
116
- if (typeof params.limit === 'number' && params.limit > 0) {
117
- const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
118
- query.limit(params.limit)
119
- .skip(params.limit * (page - 1));
120
- }
121
- /* istanbul ignore else */
122
- if (params.sort?.ownedFrom !== undefined) {
123
- query.sort({ ownedFrom: params.sort.ownedFrom });
124
- }
125
- return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
126
- .lean() // lean(2024-08-19~)
127
- .exec();
128
- }
129
- }
130
- exports.OwnershipInfoRepo = OwnershipInfoRepo;