@chevre/domain 24.0.0-alpha.80 → 24.0.0-alpha.81

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 (41) hide show
  1. package/lib/chevre/errorHandler.d.ts +5 -0
  2. package/lib/chevre/errorHandler.js +26 -4
  3. package/lib/chevre/repo/accountingReport.js +2 -25
  4. package/lib/chevre/repo/aggregateOffer.js +11 -36
  5. package/lib/chevre/repo/event.js +2 -37
  6. package/lib/chevre/repo/eventSeries.js +0 -144
  7. package/lib/chevre/repo/message.js +1 -3
  8. package/lib/chevre/repo/offer/unitPriceInCatalog.js +1 -1
  9. package/lib/chevre/repo/order.js +2 -4
  10. package/lib/chevre/repo/ownershipInfo.js +2 -4
  11. package/lib/chevre/repo/passport.js +1 -1
  12. package/lib/chevre/repo/pendingReservation.js +2 -35
  13. package/lib/chevre/repo/task.js +5 -7
  14. package/lib/chevre/repo/transactionNumberCounter.js +4 -6
  15. package/lib/chevre/repository.d.ts +0 -8
  16. package/lib/chevre/repository.js +0 -14
  17. package/lib/chevre/service/aggregation/event/importFromCOA.js +4 -8
  18. package/lib/chevre/service/assetTransaction/pay/start/preStart/validateAcceptedPaymentMethodIfNeeded.js +15 -23
  19. package/lib/chevre/service/event.js +4 -10
  20. package/lib/chevre/service/offer/event/importFromCOA/factory.js +0 -12
  21. package/lib/chevre/service/offer/event/importFromCOA.js +5 -16
  22. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +5 -15
  23. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +0 -1
  24. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +1 -12
  25. package/lib/chevre/service/offer/eventServiceByCOA/authorize/validateAcceptedOffers.js +0 -15
  26. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +2 -5
  27. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +2 -3
  28. package/lib/chevre/service/offer/factory.js +6 -2
  29. package/lib/chevre/service/payment/movieTicket/payMovieTicket/processSeatInfoSync.js +2 -2
  30. package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSync.js +2 -2
  31. package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSyncCancel.js +1 -2
  32. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +10 -3
  33. package/lib/chevre/service/reserveCOA/cancelReservation.js +12 -16
  34. package/lib/chevre/service/taskHandler.js +0 -1
  35. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +26 -32
  36. package/lib/chevre/service/transaction/placeOrder/confirm.js +2 -4
  37. package/lib/chevre/service/transaction/placeOrder/updateAgent.js +1 -1
  38. package/lib/chevre/service/transaction/returnOrder.js +2 -5
  39. package/package.json +2 -2
  40. package/lib/chevre/repo/place/busStop.d.ts +0 -27
  41. package/lib/chevre/repo/place/busStop.js +0 -169
@@ -1,169 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BusStopRepo = void 0;
4
- const factory_1 = require("../../factory");
5
- const settings_1 = require("../../settings");
6
- const civicStructure_1 = require("../mongoose/schemas/civicStructure");
7
- /**
8
- * ターミナルリポジトリ
9
- */
10
- class BusStopRepo {
11
- civicStructureModel;
12
- constructor(connection) {
13
- this.civicStructureModel = connection.model(civicStructure_1.modelName, (0, civicStructure_1.createSchema)());
14
- }
15
- static CREATE_BUS_STOP_MONGO_CONDITIONS(params) {
16
- const andConditions = [{ typeOf: { $eq: factory_1.factory.placeType.BusStop } }];
17
- const projectIdEq = params.project?.id?.$eq;
18
- if (typeof projectIdEq === 'string') {
19
- andConditions.push({ 'project.id': { $eq: projectIdEq } });
20
- }
21
- const branchCodeEq = params.branchCode?.$eq;
22
- if (typeof branchCodeEq === 'string') {
23
- andConditions.push({
24
- branchCode: {
25
- $exists: true,
26
- $eq: branchCodeEq
27
- }
28
- });
29
- }
30
- const branchCodeRegex = params.branchCode?.$regex;
31
- if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
32
- andConditions.push({
33
- branchCode: {
34
- $exists: true,
35
- $regex: new RegExp(branchCodeRegex)
36
- }
37
- });
38
- }
39
- const branchCodeIn = params.branchCode?.$in;
40
- if (Array.isArray(branchCodeIn)) {
41
- andConditions.push({
42
- branchCode: {
43
- $exists: true,
44
- $in: branchCodeIn
45
- }
46
- });
47
- }
48
- /* istanbul ignore else */
49
- const idEq = params.id?.$eq;
50
- if (typeof idEq === 'string') {
51
- andConditions.push({
52
- _id: {
53
- $eq: idEq
54
- }
55
- });
56
- }
57
- const idIn = params.id?.$in;
58
- if (Array.isArray(idIn)) {
59
- andConditions.push({
60
- _id: {
61
- $in: idIn
62
- }
63
- });
64
- }
65
- const nameRegex = params.name?.$regex;
66
- /* istanbul ignore else */
67
- if (typeof nameRegex === 'string' && nameRegex.length > 0) {
68
- andConditions.push({
69
- $or: [
70
- {
71
- 'name.ja': {
72
- $exists: true,
73
- $regex: new RegExp(nameRegex)
74
- }
75
- },
76
- {
77
- 'name.en': {
78
- $exists: true,
79
- $regex: new RegExp(nameRegex)
80
- }
81
- }
82
- ]
83
- });
84
- }
85
- return andConditions;
86
- }
87
- async saveBusStop(params) {
88
- let doc;
89
- if (typeof params.id !== 'string' || params.id.length === 0) {
90
- doc = await this.civicStructureModel.create(params);
91
- }
92
- else {
93
- // 上書き禁止属性を除外(2022-08-24~)
94
- const { id, branchCode, project, typeOf, ...updateFields } = params; // eslint-disable-line @typescript-eslint/no-unused-vars
95
- doc = await this.civicStructureModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
96
- .exec();
97
- }
98
- if (doc === null) {
99
- throw new factory_1.factory.errors.NotFound(this.civicStructureModel.modelName);
100
- }
101
- return doc.toObject();
102
- }
103
- async findBusStopByBranchCode(params) {
104
- return this.civicStructureModel.findOne({
105
- typeOf: { $eq: factory_1.factory.placeType.BusStop },
106
- 'project.id': { $eq: params.project.id },
107
- branchCode: { $eq: params.branchCode }
108
- })
109
- .exec()
110
- .then((doc) => {
111
- if (doc === null) {
112
- throw new factory_1.factory.errors.NotFound(`${factory_1.factory.placeType.BusStop} ${params.branchCode}`);
113
- }
114
- return doc.toObject();
115
- });
116
- }
117
- async searchBusStops(params) {
118
- const conditions = BusStopRepo.CREATE_BUS_STOP_MONGO_CONDITIONS(params);
119
- // containsPlaceを含めるとデータサイズが大きくなるので、検索結果には含めない
120
- const query = this.civicStructureModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
121
- __v: 0,
122
- createdAt: 0,
123
- updatedAt: 0,
124
- containsPlace: 0
125
- });
126
- if (typeof params.limit === 'number' && params.limit > 0) {
127
- const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
128
- query.limit(params.limit)
129
- .skip(params.limit * (page - 1));
130
- }
131
- /* istanbul ignore else */
132
- if (params.sort?.branchCode !== undefined) {
133
- query.sort({ branchCode: params.sort.branchCode });
134
- }
135
- return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
136
- .exec()
137
- .then((docs) => docs.map((doc) => doc.toObject()));
138
- }
139
- async findBusStopById(params, projection) {
140
- const doc = await this.civicStructureModel.findOne({
141
- typeOf: { $eq: factory_1.factory.placeType.BusStop },
142
- _id: { $eq: params.id }
143
- }, {
144
- __v: 0,
145
- createdAt: 0,
146
- updatedAt: 0,
147
- ...projection
148
- })
149
- .exec();
150
- if (doc === null) {
151
- throw new factory_1.factory.errors.NotFound(this.civicStructureModel.modelName);
152
- }
153
- return doc.toObject();
154
- }
155
- async deleteBusStopById(params) {
156
- await this.civicStructureModel.findOneAndDelete({
157
- typeOf: { $eq: factory_1.factory.placeType.BusStop },
158
- _id: { $eq: params.id },
159
- 'project.id': { $eq: params.project.id }
160
- })
161
- .exec()
162
- .then((doc) => {
163
- if (doc === null) {
164
- throw new factory_1.factory.errors.NotFound(this.civicStructureModel.modelName);
165
- }
166
- });
167
- }
168
- }
169
- exports.BusStopRepo = BusStopRepo;