@chevre/domain 22.8.0-alpha.8 → 22.8.0
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.
- package/example/src/chevre/adminSellerReturnPolicy.ts +102 -0
- package/example/src/chevre/{searchActions.ts → searchActionsByOrderNumber.ts} +3 -5
- package/example/src/chevre/searchMembers.ts +55 -0
- package/example/src/chevre/searchSellersByAggregate.ts +7 -20
- package/example/src/chevre/transaction/processPlaceOrder.ts +2 -0
- package/example/src/chevre/transaction/processReturnOrder.ts +1 -0
- package/lib/chevre/repo/action.d.ts +5 -1
- package/lib/chevre/repo/action.js +51 -45
- package/lib/chevre/repo/issuer.d.ts +32 -0
- package/lib/chevre/repo/issuer.js +150 -0
- package/lib/chevre/repo/member.d.ts +32 -7
- package/lib/chevre/repo/member.js +126 -31
- package/lib/chevre/repo/memberProgram.d.ts +59 -0
- package/lib/chevre/repo/memberProgram.js +140 -0
- package/lib/chevre/repo/mongoose/schemas/action.js +20 -10
- package/lib/chevre/repo/mongoose/schemas/issuer.d.ts +40 -0
- package/lib/chevre/repo/mongoose/schemas/issuer.js +56 -0
- package/lib/chevre/repo/mongoose/schemas/seller.js +3 -12
- package/lib/chevre/repo/mongoose/schemas/sellerReturnPolicy.d.ts +10 -0
- package/lib/chevre/repo/mongoose/schemas/sellerReturnPolicy.js +92 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +0 -66
- package/lib/chevre/repo/projectMakesOffer.d.ts +2 -1
- package/lib/chevre/repo/projectMakesOffer.js +4 -5
- package/lib/chevre/repo/seller.d.ts +1 -1
- package/lib/chevre/repo/seller.js +25 -21
- package/lib/chevre/repo/sellerReturnPolicy.d.ts +36 -0
- package/lib/chevre/repo/sellerReturnPolicy.js +164 -0
- package/lib/chevre/repository.d.ts +15 -0
- package/lib/chevre/repository.js +41 -2
- package/lib/chevre/service/notification.js +3 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +1 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +1 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +5 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +5 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +20 -10
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +3 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +1 -1
- package/lib/chevre/service/order/onOrderUpdated/factory.js +1 -0
- package/lib/chevre/service/order/returnOrder.js +16 -11
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +6 -6
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.d.ts +8 -0
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +42 -13
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +4 -0
- package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +2 -0
- package/lib/chevre/service/transaction/returnOrder/preStart.js +19 -7
- package/lib/chevre/service/transaction/returnOrder.d.ts +2 -0
- package/package.json +3 -3
- package/example/src/chevre/adminSellerPaymentAccepted.ts +0 -60
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +0 -129
|
@@ -48,7 +48,8 @@ const AVAILABLE_PROJECT_FIELDS = [
|
|
|
48
48
|
'replacer',
|
|
49
49
|
'targetCollection',
|
|
50
50
|
'sameAs',
|
|
51
|
-
'cancelAction'
|
|
51
|
+
'cancelAction',
|
|
52
|
+
'about'
|
|
52
53
|
];
|
|
53
54
|
/**
|
|
54
55
|
* アクションリポジトリ
|
|
@@ -60,7 +61,7 @@ class ActionRepo {
|
|
|
60
61
|
}
|
|
61
62
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
62
63
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
63
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68;
|
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72;
|
|
64
65
|
const andConditions = [];
|
|
65
66
|
const idIn = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$in;
|
|
66
67
|
if (Array.isArray(idIn)) {
|
|
@@ -104,7 +105,11 @@ class ActionRepo {
|
|
|
104
105
|
if (typeof instrumentTypeOfEq === 'string') {
|
|
105
106
|
andConditions.push({ 'instrument.typeOf': { $exists: true, $eq: instrumentTypeOfEq } });
|
|
106
107
|
}
|
|
107
|
-
const
|
|
108
|
+
const instrumentIdentifierEq = (_p = (_o = params.instrument) === null || _o === void 0 ? void 0 : _o.identifier) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
109
|
+
if (typeof instrumentIdentifierEq === 'string') {
|
|
110
|
+
andConditions.push({ 'instrument.identifier': { $exists: true, $eq: instrumentIdentifierEq } });
|
|
111
|
+
}
|
|
112
|
+
const locationIdEq = (_r = (_q = params.location) === null || _q === void 0 ? void 0 : _q.id) === null || _r === void 0 ? void 0 : _r.$eq;
|
|
108
113
|
if (typeof locationIdEq === 'string') {
|
|
109
114
|
andConditions.push({
|
|
110
115
|
'location.id': {
|
|
@@ -113,7 +118,7 @@ class ActionRepo {
|
|
|
113
118
|
}
|
|
114
119
|
});
|
|
115
120
|
}
|
|
116
|
-
const locationIdentifierEq = (
|
|
121
|
+
const locationIdentifierEq = (_t = (_s = params.location) === null || _s === void 0 ? void 0 : _s.identifier) === null || _t === void 0 ? void 0 : _t.$eq;
|
|
117
122
|
if (typeof locationIdentifierEq === 'string') {
|
|
118
123
|
andConditions.push({
|
|
119
124
|
'location.identifier': {
|
|
@@ -122,7 +127,7 @@ class ActionRepo {
|
|
|
122
127
|
}
|
|
123
128
|
});
|
|
124
129
|
}
|
|
125
|
-
const objectMovieTicketsIdentifierEq = (
|
|
130
|
+
const objectMovieTicketsIdentifierEq = (_w = (_v = (_u = params.object) === null || _u === void 0 ? void 0 : _u.movieTickets) === null || _v === void 0 ? void 0 : _v.identifier) === null || _w === void 0 ? void 0 : _w.$eq;
|
|
126
131
|
if (typeof objectMovieTicketsIdentifierEq === 'string') {
|
|
127
132
|
andConditions.push({
|
|
128
133
|
'object.movieTickets.identifier': {
|
|
@@ -131,7 +136,7 @@ class ActionRepo {
|
|
|
131
136
|
}
|
|
132
137
|
});
|
|
133
138
|
}
|
|
134
|
-
const objectMovieTicketsServiceOutputReservationForIdEq = (
|
|
139
|
+
const objectMovieTicketsServiceOutputReservationForIdEq = (_1 = (_0 = (_z = (_y = (_x = params.object) === null || _x === void 0 ? void 0 : _x.movieTickets) === null || _y === void 0 ? void 0 : _y.serviceOutput) === null || _z === void 0 ? void 0 : _z.reservationFor) === null || _0 === void 0 ? void 0 : _0.id) === null || _1 === void 0 ? void 0 : _1.$eq;
|
|
135
140
|
if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
|
|
136
141
|
andConditions.push({
|
|
137
142
|
'object.movieTickets.serviceOutput.reservationFor.id': {
|
|
@@ -140,7 +145,7 @@ class ActionRepo {
|
|
|
140
145
|
}
|
|
141
146
|
});
|
|
142
147
|
}
|
|
143
|
-
const objectPaymentMethodIdEq = (
|
|
148
|
+
const objectPaymentMethodIdEq = (_3 = (_2 = params.object) === null || _2 === void 0 ? void 0 : _2.paymentMethodId) === null || _3 === void 0 ? void 0 : _3.$eq;
|
|
144
149
|
if (typeof objectPaymentMethodIdEq === 'string') {
|
|
145
150
|
andConditions.push({
|
|
146
151
|
'object.paymentMethodId': {
|
|
@@ -149,7 +154,7 @@ class ActionRepo {
|
|
|
149
154
|
}
|
|
150
155
|
});
|
|
151
156
|
}
|
|
152
|
-
const objectObjectPaymentMethodIdEq = (
|
|
157
|
+
const objectObjectPaymentMethodIdEq = (_6 = (_5 = (_4 = params.object) === null || _4 === void 0 ? void 0 : _4.object) === null || _5 === void 0 ? void 0 : _5.paymentMethodId) === null || _6 === void 0 ? void 0 : _6.$eq;
|
|
153
158
|
if (typeof objectObjectPaymentMethodIdEq === 'string') {
|
|
154
159
|
andConditions.push({
|
|
155
160
|
'object.object.paymentMethodId': {
|
|
@@ -158,7 +163,7 @@ class ActionRepo {
|
|
|
158
163
|
}
|
|
159
164
|
});
|
|
160
165
|
}
|
|
161
|
-
const objectReservationForIdEq = (
|
|
166
|
+
const objectReservationForIdEq = (_9 = (_8 = (_7 = params.object) === null || _7 === void 0 ? void 0 : _7.reservationFor) === null || _8 === void 0 ? void 0 : _8.id) === null || _9 === void 0 ? void 0 : _9.$eq;
|
|
162
167
|
if (typeof objectReservationForIdEq === 'string') {
|
|
163
168
|
andConditions.push({
|
|
164
169
|
'object.reservationFor.id': {
|
|
@@ -167,7 +172,7 @@ class ActionRepo {
|
|
|
167
172
|
}
|
|
168
173
|
});
|
|
169
174
|
}
|
|
170
|
-
const objectReservationNumberEq = (
|
|
175
|
+
const objectReservationNumberEq = (_11 = (_10 = params.object) === null || _10 === void 0 ? void 0 : _10.reservationNumber) === null || _11 === void 0 ? void 0 : _11.$eq;
|
|
171
176
|
if (typeof objectReservationNumberEq === 'string') {
|
|
172
177
|
andConditions.push({
|
|
173
178
|
'object.reservationNumber': {
|
|
@@ -176,7 +181,7 @@ class ActionRepo {
|
|
|
176
181
|
}
|
|
177
182
|
});
|
|
178
183
|
}
|
|
179
|
-
const objectReservationNumberIn = (
|
|
184
|
+
const objectReservationNumberIn = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.reservationNumber) === null || _13 === void 0 ? void 0 : _13.$in;
|
|
180
185
|
if (Array.isArray(objectReservationNumberIn)) {
|
|
181
186
|
andConditions.push({
|
|
182
187
|
'object.reservationNumber': {
|
|
@@ -185,7 +190,7 @@ class ActionRepo {
|
|
|
185
190
|
}
|
|
186
191
|
});
|
|
187
192
|
}
|
|
188
|
-
const objectPaymentMethodAccountIdEq = (
|
|
193
|
+
const objectPaymentMethodAccountIdEq = (_16 = (_15 = (_14 = params.object) === null || _14 === void 0 ? void 0 : _14.paymentMethod) === null || _15 === void 0 ? void 0 : _15.accountId) === null || _16 === void 0 ? void 0 : _16.$eq;
|
|
189
194
|
if (typeof objectPaymentMethodAccountIdEq === 'string') {
|
|
190
195
|
andConditions.push({
|
|
191
196
|
'object.paymentMethod.accountId': {
|
|
@@ -194,7 +199,7 @@ class ActionRepo {
|
|
|
194
199
|
}
|
|
195
200
|
});
|
|
196
201
|
}
|
|
197
|
-
const objectPaymentMethodPaymentMethodIdEq = (
|
|
202
|
+
const objectPaymentMethodPaymentMethodIdEq = (_19 = (_18 = (_17 = params.object) === null || _17 === void 0 ? void 0 : _17.paymentMethod) === null || _18 === void 0 ? void 0 : _18.paymentMethodId) === null || _19 === void 0 ? void 0 : _19.$eq;
|
|
198
203
|
if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
|
|
199
204
|
andConditions.push({
|
|
200
205
|
'object.paymentMethod.paymentMethodId': {
|
|
@@ -203,7 +208,7 @@ class ActionRepo {
|
|
|
203
208
|
}
|
|
204
209
|
});
|
|
205
210
|
}
|
|
206
|
-
const objectPaymentMethodPaymentMethodIdIn = (
|
|
211
|
+
const objectPaymentMethodPaymentMethodIdIn = (_22 = (_21 = (_20 = params.object) === null || _20 === void 0 ? void 0 : _20.paymentMethod) === null || _21 === void 0 ? void 0 : _21.paymentMethodId) === null || _22 === void 0 ? void 0 : _22.$in;
|
|
207
212
|
if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
|
|
208
213
|
andConditions.push({
|
|
209
214
|
'object.paymentMethod.paymentMethodId': {
|
|
@@ -212,7 +217,7 @@ class ActionRepo {
|
|
|
212
217
|
}
|
|
213
218
|
});
|
|
214
219
|
}
|
|
215
|
-
const objectPaymentMethodTypeOfEq = (
|
|
220
|
+
const objectPaymentMethodTypeOfEq = (_25 = (_24 = (_23 = params.object) === null || _23 === void 0 ? void 0 : _23.paymentMethod) === null || _24 === void 0 ? void 0 : _24.typeOf) === null || _25 === void 0 ? void 0 : _25.$eq;
|
|
216
221
|
if (typeof objectPaymentMethodTypeOfEq === 'string') {
|
|
217
222
|
andConditions.push({
|
|
218
223
|
'object.paymentMethod.typeOf': {
|
|
@@ -221,7 +226,7 @@ class ActionRepo {
|
|
|
221
226
|
}
|
|
222
227
|
});
|
|
223
228
|
}
|
|
224
|
-
const objectTypeOfEq = (
|
|
229
|
+
const objectTypeOfEq = (_27 = (_26 = params.object) === null || _26 === void 0 ? void 0 : _26.typeOf) === null || _27 === void 0 ? void 0 : _27.$eq;
|
|
225
230
|
if (typeof objectTypeOfEq === 'string') {
|
|
226
231
|
andConditions.push({
|
|
227
232
|
'object.typeOf': {
|
|
@@ -230,7 +235,7 @@ class ActionRepo {
|
|
|
230
235
|
}
|
|
231
236
|
});
|
|
232
237
|
}
|
|
233
|
-
const objectTypeOfIn = (
|
|
238
|
+
const objectTypeOfIn = (_29 = (_28 = params.object) === null || _28 === void 0 ? void 0 : _28.typeOf) === null || _29 === void 0 ? void 0 : _29.$in;
|
|
234
239
|
if (Array.isArray(objectTypeOfIn)) {
|
|
235
240
|
andConditions.push({
|
|
236
241
|
'object.typeOf': {
|
|
@@ -239,7 +244,7 @@ class ActionRepo {
|
|
|
239
244
|
}
|
|
240
245
|
});
|
|
241
246
|
}
|
|
242
|
-
const objectIdEq = (
|
|
247
|
+
const objectIdEq = (_31 = (_30 = params.object) === null || _30 === void 0 ? void 0 : _30.id) === null || _31 === void 0 ? void 0 : _31.$eq;
|
|
243
248
|
if (typeof objectIdEq === 'string') {
|
|
244
249
|
andConditions.push({
|
|
245
250
|
'object.id': {
|
|
@@ -248,7 +253,7 @@ class ActionRepo {
|
|
|
248
253
|
}
|
|
249
254
|
});
|
|
250
255
|
}
|
|
251
|
-
const objectIdIn = (
|
|
256
|
+
const objectIdIn = (_33 = (_32 = params.object) === null || _32 === void 0 ? void 0 : _32.id) === null || _33 === void 0 ? void 0 : _33.$in;
|
|
252
257
|
if (Array.isArray(objectIdIn)) {
|
|
253
258
|
andConditions.push({
|
|
254
259
|
'object.id': {
|
|
@@ -257,7 +262,7 @@ class ActionRepo {
|
|
|
257
262
|
}
|
|
258
263
|
});
|
|
259
264
|
}
|
|
260
|
-
const objectOrderNumberIn = (
|
|
265
|
+
const objectOrderNumberIn = (_35 = (_34 = params.object) === null || _34 === void 0 ? void 0 : _34.orderNumber) === null || _35 === void 0 ? void 0 : _35.$in;
|
|
261
266
|
if (Array.isArray(objectOrderNumberIn)) {
|
|
262
267
|
andConditions.push({
|
|
263
268
|
'object.orderNumber': {
|
|
@@ -266,7 +271,7 @@ class ActionRepo {
|
|
|
266
271
|
}
|
|
267
272
|
});
|
|
268
273
|
}
|
|
269
|
-
const objectEventIdIn = (
|
|
274
|
+
const objectEventIdIn = (_38 = (_37 = (_36 = params.object) === null || _36 === void 0 ? void 0 : _36.event) === null || _37 === void 0 ? void 0 : _37.id) === null || _38 === void 0 ? void 0 : _38.$in;
|
|
270
275
|
if (Array.isArray(objectEventIdIn)) {
|
|
271
276
|
andConditions.push({
|
|
272
277
|
'object.event.id': {
|
|
@@ -286,7 +291,7 @@ class ActionRepo {
|
|
|
286
291
|
// }
|
|
287
292
|
// });
|
|
288
293
|
// }
|
|
289
|
-
const objectTransactionNumberEq = (
|
|
294
|
+
const objectTransactionNumberEq = (_40 = (_39 = params.object) === null || _39 === void 0 ? void 0 : _39.transactionNumber) === null || _40 === void 0 ? void 0 : _40.$eq;
|
|
290
295
|
if (typeof objectTransactionNumberEq === 'string') {
|
|
291
296
|
andConditions.push({ 'object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
|
|
292
297
|
}
|
|
@@ -296,14 +301,14 @@ class ActionRepo {
|
|
|
296
301
|
});
|
|
297
302
|
}
|
|
298
303
|
else {
|
|
299
|
-
const typeOfEq = (
|
|
304
|
+
const typeOfEq = (_41 = params.typeOf) === null || _41 === void 0 ? void 0 : _41.$eq;
|
|
300
305
|
if (typeof typeOfEq === 'string') {
|
|
301
306
|
andConditions.push({
|
|
302
307
|
typeOf: { $eq: typeOfEq }
|
|
303
308
|
});
|
|
304
309
|
}
|
|
305
310
|
}
|
|
306
|
-
const actionStatusIn = (
|
|
311
|
+
const actionStatusIn = (_42 = params.actionStatus) === null || _42 === void 0 ? void 0 : _42.$in;
|
|
307
312
|
if (Array.isArray(actionStatusIn)) {
|
|
308
313
|
andConditions.push({
|
|
309
314
|
actionStatus: { $in: actionStatusIn }
|
|
@@ -326,7 +331,7 @@ class ActionRepo {
|
|
|
326
331
|
startDate: { $lte: startDateLte }
|
|
327
332
|
});
|
|
328
333
|
}
|
|
329
|
-
const fromLocationTypeOfIn = (
|
|
334
|
+
const fromLocationTypeOfIn = (_44 = (_43 = params.fromLocation) === null || _43 === void 0 ? void 0 : _43.typeOf) === null || _44 === void 0 ? void 0 : _44.$in;
|
|
330
335
|
if (Array.isArray(fromLocationTypeOfIn)) {
|
|
331
336
|
andConditions.push({
|
|
332
337
|
'fromLocation.typeOf': {
|
|
@@ -335,7 +340,7 @@ class ActionRepo {
|
|
|
335
340
|
}
|
|
336
341
|
});
|
|
337
342
|
}
|
|
338
|
-
const fromLocationAccountNumberIn = (
|
|
343
|
+
const fromLocationAccountNumberIn = (_46 = (_45 = params.fromLocation) === null || _45 === void 0 ? void 0 : _45.accountNumber) === null || _46 === void 0 ? void 0 : _46.$in;
|
|
339
344
|
if (Array.isArray(fromLocationAccountNumberIn)) {
|
|
340
345
|
andConditions.push({
|
|
341
346
|
'fromLocation.accountNumber': {
|
|
@@ -344,7 +349,7 @@ class ActionRepo {
|
|
|
344
349
|
}
|
|
345
350
|
});
|
|
346
351
|
}
|
|
347
|
-
const fromLocationAccountTypeIn = (
|
|
352
|
+
const fromLocationAccountTypeIn = (_48 = (_47 = params.fromLocation) === null || _47 === void 0 ? void 0 : _47.accountType) === null || _48 === void 0 ? void 0 : _48.$in;
|
|
348
353
|
if (Array.isArray(fromLocationAccountTypeIn)) {
|
|
349
354
|
andConditions.push({
|
|
350
355
|
'fromLocation.accountType': {
|
|
@@ -353,7 +358,7 @@ class ActionRepo {
|
|
|
353
358
|
}
|
|
354
359
|
});
|
|
355
360
|
}
|
|
356
|
-
const toLocationTypeOfIn = (
|
|
361
|
+
const toLocationTypeOfIn = (_50 = (_49 = params.toLocation) === null || _49 === void 0 ? void 0 : _49.typeOf) === null || _50 === void 0 ? void 0 : _50.$in;
|
|
357
362
|
if (Array.isArray(toLocationTypeOfIn)) {
|
|
358
363
|
andConditions.push({
|
|
359
364
|
'toLocation.typeOf': {
|
|
@@ -362,7 +367,7 @@ class ActionRepo {
|
|
|
362
367
|
}
|
|
363
368
|
});
|
|
364
369
|
}
|
|
365
|
-
const toLocationAccountNumberIn = (
|
|
370
|
+
const toLocationAccountNumberIn = (_52 = (_51 = params.toLocation) === null || _51 === void 0 ? void 0 : _51.accountNumber) === null || _52 === void 0 ? void 0 : _52.$in;
|
|
366
371
|
if (Array.isArray(toLocationAccountNumberIn)) {
|
|
367
372
|
andConditions.push({
|
|
368
373
|
'toLocation.accountNumber': {
|
|
@@ -371,7 +376,7 @@ class ActionRepo {
|
|
|
371
376
|
}
|
|
372
377
|
});
|
|
373
378
|
}
|
|
374
|
-
const toLocationAccountTypeIn = (
|
|
379
|
+
const toLocationAccountTypeIn = (_54 = (_53 = params.toLocation) === null || _53 === void 0 ? void 0 : _53.accountType) === null || _54 === void 0 ? void 0 : _54.$in;
|
|
375
380
|
if (Array.isArray(toLocationAccountTypeIn)) {
|
|
376
381
|
andConditions.push({
|
|
377
382
|
'toLocation.accountType': {
|
|
@@ -380,7 +385,7 @@ class ActionRepo {
|
|
|
380
385
|
}
|
|
381
386
|
});
|
|
382
387
|
}
|
|
383
|
-
const purposeTypeOfIn = (
|
|
388
|
+
const purposeTypeOfIn = (_56 = (_55 = params.purpose) === null || _55 === void 0 ? void 0 : _55.typeOf) === null || _56 === void 0 ? void 0 : _56.$in;
|
|
384
389
|
if (Array.isArray(purposeTypeOfIn)) {
|
|
385
390
|
andConditions.push({
|
|
386
391
|
'purpose.typeOf': {
|
|
@@ -389,7 +394,7 @@ class ActionRepo {
|
|
|
389
394
|
}
|
|
390
395
|
});
|
|
391
396
|
}
|
|
392
|
-
const purposeIdIn = (
|
|
397
|
+
const purposeIdIn = (_58 = (_57 = params.purpose) === null || _57 === void 0 ? void 0 : _57.id) === null || _58 === void 0 ? void 0 : _58.$in;
|
|
393
398
|
if (Array.isArray(purposeIdIn)) {
|
|
394
399
|
andConditions.push({
|
|
395
400
|
'purpose.id': {
|
|
@@ -398,7 +403,7 @@ class ActionRepo {
|
|
|
398
403
|
}
|
|
399
404
|
});
|
|
400
405
|
}
|
|
401
|
-
const purposeOrderNumberIn = (
|
|
406
|
+
const purposeOrderNumberIn = (_60 = (_59 = params.purpose) === null || _59 === void 0 ? void 0 : _59.orderNumber) === null || _60 === void 0 ? void 0 : _60.$in;
|
|
402
407
|
if (Array.isArray(purposeOrderNumberIn)) {
|
|
403
408
|
andConditions.push({
|
|
404
409
|
'purpose.orderNumber': {
|
|
@@ -407,7 +412,7 @@ class ActionRepo {
|
|
|
407
412
|
}
|
|
408
413
|
});
|
|
409
414
|
}
|
|
410
|
-
const resultTypeOfIn = (
|
|
415
|
+
const resultTypeOfIn = (_62 = (_61 = params.result) === null || _61 === void 0 ? void 0 : _61.typeOf) === null || _62 === void 0 ? void 0 : _62.$in;
|
|
411
416
|
if (Array.isArray(resultTypeOfIn)) {
|
|
412
417
|
andConditions.push({
|
|
413
418
|
'result.typeOf': {
|
|
@@ -416,7 +421,7 @@ class ActionRepo {
|
|
|
416
421
|
}
|
|
417
422
|
});
|
|
418
423
|
}
|
|
419
|
-
const resultIdIn = (
|
|
424
|
+
const resultIdIn = (_64 = (_63 = params.result) === null || _63 === void 0 ? void 0 : _63.id) === null || _64 === void 0 ? void 0 : _64.$in;
|
|
420
425
|
if (Array.isArray(resultIdIn)) {
|
|
421
426
|
andConditions.push({
|
|
422
427
|
'result.id': {
|
|
@@ -425,7 +430,7 @@ class ActionRepo {
|
|
|
425
430
|
}
|
|
426
431
|
});
|
|
427
432
|
}
|
|
428
|
-
const resultOrderNumberIn = (
|
|
433
|
+
const resultOrderNumberIn = (_66 = (_65 = params.result) === null || _65 === void 0 ? void 0 : _65.orderNumber) === null || _66 === void 0 ? void 0 : _66.$in;
|
|
429
434
|
if (Array.isArray(resultOrderNumberIn)) {
|
|
430
435
|
andConditions.push({
|
|
431
436
|
'result.orderNumber': {
|
|
@@ -434,7 +439,7 @@ class ActionRepo {
|
|
|
434
439
|
}
|
|
435
440
|
});
|
|
436
441
|
}
|
|
437
|
-
const resultCodeIn = (
|
|
442
|
+
const resultCodeIn = (_68 = (_67 = params.result) === null || _67 === void 0 ? void 0 : _67.code) === null || _68 === void 0 ? void 0 : _68.$in;
|
|
438
443
|
if (Array.isArray(resultCodeIn)) {
|
|
439
444
|
andConditions.push({
|
|
440
445
|
'result.code': {
|
|
@@ -444,10 +449,14 @@ class ActionRepo {
|
|
|
444
449
|
});
|
|
445
450
|
}
|
|
446
451
|
// sameAs(2024-04-23~)
|
|
447
|
-
const sameAsIdEq = (
|
|
452
|
+
const sameAsIdEq = (_70 = (_69 = params.sameAs) === null || _69 === void 0 ? void 0 : _69.id) === null || _70 === void 0 ? void 0 : _70.$eq;
|
|
448
453
|
if (typeof sameAsIdEq === 'string') {
|
|
449
454
|
andConditions.push({ 'sameAs.id': { $exists: true, $eq: sameAsIdEq } });
|
|
450
455
|
}
|
|
456
|
+
const aboutOrderNumberEq = (_72 = (_71 = params.about) === null || _71 === void 0 ? void 0 : _71.orderNumber) === null || _72 === void 0 ? void 0 : _72.$eq;
|
|
457
|
+
if (typeof aboutOrderNumberEq === 'string') {
|
|
458
|
+
andConditions.push({ 'about.orderNumber': { $exists: true, $eq: aboutOrderNumberEq } });
|
|
459
|
+
}
|
|
451
460
|
return andConditions;
|
|
452
461
|
}
|
|
453
462
|
/**
|
|
@@ -461,11 +470,6 @@ class ActionRepo {
|
|
|
461
470
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
462
471
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
463
472
|
}
|
|
464
|
-
else {
|
|
465
|
-
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
466
|
-
// positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
467
|
-
// }
|
|
468
|
-
}
|
|
469
473
|
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
470
474
|
const query = this.actionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
471
475
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
@@ -765,8 +769,10 @@ class ActionRepo {
|
|
|
765
769
|
var _a;
|
|
766
770
|
const filter = {
|
|
767
771
|
$or: [
|
|
768
|
-
{ 'object.orderNumber': { $eq: params.orderNumber } },
|
|
769
|
-
{ 'purpose.orderNumber': { $eq: params.orderNumber } }
|
|
772
|
+
{ 'object.orderNumber': { $exists: true, $eq: params.orderNumber } },
|
|
773
|
+
{ 'purpose.orderNumber': { $exists: true, $eq: params.orderNumber } },
|
|
774
|
+
// consider inform returnAction(2025-01-22~)
|
|
775
|
+
{ 'about.orderNumber': { $exists: true, $eq: params.orderNumber } }
|
|
770
776
|
]
|
|
771
777
|
};
|
|
772
778
|
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(AVAILABLE_PROJECT_FIELDS.map((key) => ([key, 1]))));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Connection, FilterQuery } from 'mongoose';
|
|
2
|
+
import { IIssuer, ISearchConditions } from './mongoose/schemas/issuer';
|
|
3
|
+
/**
|
|
4
|
+
* 発行者リポジトリ
|
|
5
|
+
*/
|
|
6
|
+
export declare class IssuerRepo {
|
|
7
|
+
private readonly issuerModel;
|
|
8
|
+
constructor(connection: Connection);
|
|
9
|
+
static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery<IIssuer>[];
|
|
10
|
+
saveIssuer(params: IIssuer): Promise<{
|
|
11
|
+
id: string;
|
|
12
|
+
}>;
|
|
13
|
+
projectPublicFields(params: ISearchConditions): Promise<Pick<IIssuer, 'id' | 'identifier' | 'project'>[]>;
|
|
14
|
+
findById(params: {
|
|
15
|
+
id: string;
|
|
16
|
+
project: {
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
}): Promise<IIssuer>;
|
|
20
|
+
findByIdentifier(params: {
|
|
21
|
+
identifier: string;
|
|
22
|
+
project: {
|
|
23
|
+
id: string;
|
|
24
|
+
};
|
|
25
|
+
}): Promise<IIssuer>;
|
|
26
|
+
deleteById(params: {
|
|
27
|
+
id: string;
|
|
28
|
+
project: {
|
|
29
|
+
id: string;
|
|
30
|
+
};
|
|
31
|
+
}): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.IssuerRepo = void 0;
|
|
24
|
+
const factory = require("../factory");
|
|
25
|
+
const settings_1 = require("../settings");
|
|
26
|
+
const issuer_1 = require("./mongoose/schemas/issuer");
|
|
27
|
+
/**
|
|
28
|
+
* 発行者リポジトリ
|
|
29
|
+
*/
|
|
30
|
+
class IssuerRepo {
|
|
31
|
+
constructor(connection) {
|
|
32
|
+
this.issuerModel = connection.model(issuer_1.modelName, (0, issuer_1.createSchema)());
|
|
33
|
+
}
|
|
34
|
+
static CREATE_MONGO_CONDITIONS(params) {
|
|
35
|
+
var _a, _b, _c, _d;
|
|
36
|
+
const andConditions = [];
|
|
37
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
38
|
+
if (typeof projectIdEq === 'string') {
|
|
39
|
+
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
40
|
+
}
|
|
41
|
+
const identifiereEq = (_c = params.identifier) === null || _c === void 0 ? void 0 : _c.$eq;
|
|
42
|
+
if (typeof identifiereEq === 'string') {
|
|
43
|
+
andConditions.push({ identifier: { $eq: identifiereEq } });
|
|
44
|
+
}
|
|
45
|
+
const idEq = (_d = params.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
46
|
+
if (typeof idEq === 'string') {
|
|
47
|
+
andConditions.push({ _id: { $eq: idEq } });
|
|
48
|
+
}
|
|
49
|
+
return andConditions;
|
|
50
|
+
}
|
|
51
|
+
saveIssuer(params) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
let savedId;
|
|
54
|
+
let doc;
|
|
55
|
+
if (params.id === '') {
|
|
56
|
+
const { id } = params, creatingParams = __rest(params, ["id"]);
|
|
57
|
+
doc = yield this.issuerModel.create(creatingParams);
|
|
58
|
+
savedId = doc.id;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const { id, identifier, project } = params, updateFields = __rest(params, ["id", "identifier", "project"]);
|
|
62
|
+
doc = yield this.issuerModel.findOneAndUpdate({ _id: { $eq: params.id } }, { $set: updateFields }, { upsert: false, new: true, projection: { _id: 1 } })
|
|
63
|
+
.exec();
|
|
64
|
+
savedId = params.id;
|
|
65
|
+
}
|
|
66
|
+
if (doc === null) {
|
|
67
|
+
throw new factory.errors.NotFound(this.issuerModel.modelName);
|
|
68
|
+
}
|
|
69
|
+
return { id: savedId };
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
projectPublicFields(params) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
var _a;
|
|
75
|
+
const conditions = IssuerRepo.CREATE_MONGO_CONDITIONS(params);
|
|
76
|
+
const projection = {
|
|
77
|
+
_id: 0,
|
|
78
|
+
id: { $toString: '$_id' },
|
|
79
|
+
identifier: 1,
|
|
80
|
+
project: 1
|
|
81
|
+
};
|
|
82
|
+
const query = this.issuerModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
83
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
84
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
85
|
+
query.limit(params.limit)
|
|
86
|
+
.skip(params.limit * (page - 1));
|
|
87
|
+
}
|
|
88
|
+
if (typeof ((_a = params.sort) === null || _a === void 0 ? void 0 : _a.identifier) === 'number') {
|
|
89
|
+
query.sort({ identifier: params.sort.identifier });
|
|
90
|
+
}
|
|
91
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
92
|
+
.lean()
|
|
93
|
+
.exec();
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
findById(params) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
const projection = {
|
|
99
|
+
_id: 0,
|
|
100
|
+
id: { $toString: '$_id' },
|
|
101
|
+
identifier: 1,
|
|
102
|
+
project: 1,
|
|
103
|
+
tokenSecret: 1
|
|
104
|
+
};
|
|
105
|
+
const query = this.issuerModel.findOne({
|
|
106
|
+
_id: { $eq: params.id },
|
|
107
|
+
'project.id': { $eq: params.project.id }
|
|
108
|
+
}, projection);
|
|
109
|
+
const issuer = yield query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
110
|
+
.lean()
|
|
111
|
+
.exec();
|
|
112
|
+
if (issuer === null) {
|
|
113
|
+
throw new factory.errors.NotFound('Issuer');
|
|
114
|
+
}
|
|
115
|
+
return issuer;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
findByIdentifier(params) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
const projection = {
|
|
121
|
+
_id: 0,
|
|
122
|
+
id: { $toString: '$_id' },
|
|
123
|
+
identifier: 1,
|
|
124
|
+
project: 1,
|
|
125
|
+
tokenSecret: 1
|
|
126
|
+
};
|
|
127
|
+
const query = this.issuerModel.findOne({
|
|
128
|
+
identifier: { $eq: params.identifier },
|
|
129
|
+
'project.id': { $eq: params.project.id }
|
|
130
|
+
}, projection);
|
|
131
|
+
const issuer = yield query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
132
|
+
.lean()
|
|
133
|
+
.exec();
|
|
134
|
+
if (issuer === null) {
|
|
135
|
+
throw new factory.errors.NotFound('Issuer');
|
|
136
|
+
}
|
|
137
|
+
return issuer;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
deleteById(params) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
yield this.issuerModel.findOneAndDelete({
|
|
143
|
+
_id: { $eq: params.id },
|
|
144
|
+
'project.id': { $eq: params.project.id }
|
|
145
|
+
}, { projection: { _id: 1 } })
|
|
146
|
+
.exec();
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.IssuerRepo = IssuerRepo;
|
|
@@ -1,14 +1,42 @@
|
|
|
1
|
-
import type { Connection } from 'mongoose';
|
|
1
|
+
import type { Connection, FilterQuery } from 'mongoose';
|
|
2
2
|
import * as factory from '../factory';
|
|
3
3
|
type IKeyOfProjection = keyof factory.iam.IMember;
|
|
4
|
+
export type ICustomerMember = Pick<factory.iam.IMemberOfRole, 'hasRole' | 'id' | 'name' | 'memberOf'>;
|
|
4
5
|
/**
|
|
5
6
|
* IAMメンバーリポジトリ
|
|
6
7
|
*/
|
|
7
8
|
export declare class MemberRepo {
|
|
8
9
|
private readonly memberModel;
|
|
9
10
|
constructor(connection: Connection);
|
|
10
|
-
static CREATE_MONGO_CONDITIONS(params: factory.iam.ISearchConditions):
|
|
11
|
-
|
|
11
|
+
static CREATE_MONGO_CONDITIONS(params: factory.iam.ISearchConditions): FilterQuery<factory.iam.IMember>[];
|
|
12
|
+
/**
|
|
13
|
+
* プロジェクト指定で検索する
|
|
14
|
+
*/
|
|
15
|
+
projectFieldsByProjectId(project: {
|
|
16
|
+
id: string;
|
|
17
|
+
}, conditions: Omit<factory.iam.ISearchConditions, 'project'>, inclusion: IKeyOfProjection[]): Promise<factory.iam.IMember[]>;
|
|
18
|
+
/**
|
|
19
|
+
* 注文取引クライアントメンバーを検索する
|
|
20
|
+
* 全プロジェクトで利用可能なクライアントも考慮される
|
|
21
|
+
*/
|
|
22
|
+
searchCustomerMembers(params: Pick<factory.iam.ISearchConditions, 'sort'> & {
|
|
23
|
+
limit: number;
|
|
24
|
+
page: number;
|
|
25
|
+
project: {
|
|
26
|
+
id: string;
|
|
27
|
+
};
|
|
28
|
+
member?: {
|
|
29
|
+
id?: {
|
|
30
|
+
$eq?: string;
|
|
31
|
+
$in?: string[];
|
|
32
|
+
};
|
|
33
|
+
name?: {
|
|
34
|
+
$regex?: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}): Promise<{
|
|
38
|
+
member: ICustomerMember;
|
|
39
|
+
}[]>;
|
|
12
40
|
aggregateRoleNames(params: {
|
|
13
41
|
project: {
|
|
14
42
|
id: {
|
|
@@ -56,10 +84,6 @@ export declare class MemberRepo {
|
|
|
56
84
|
hasRole?: factory.iam.IMemberRole[];
|
|
57
85
|
image?: string;
|
|
58
86
|
name?: string;
|
|
59
|
-
/**
|
|
60
|
-
* 所属会員
|
|
61
|
-
*/
|
|
62
|
-
member?: factory.iam.IMemberOfWebApplication[];
|
|
63
87
|
};
|
|
64
88
|
$unset: {
|
|
65
89
|
'member.member'?: 1;
|
|
@@ -139,5 +163,6 @@ export declare class MemberRepo {
|
|
|
139
163
|
filter: any;
|
|
140
164
|
$unset: any;
|
|
141
165
|
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
166
|
+
private projectFields;
|
|
142
167
|
}
|
|
143
168
|
export {};
|