@chevre/domain 20.4.0-alpha.2 → 20.4.0-alpha.21
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/aggregateEventReservation.ts +1 -1
- package/example/src/chevre/createManyEventsIfNotExist.ts +10 -10
- package/example/src/chevre/deleteMovieTicketCategoryChargePriceSpecs.ts +21 -0
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +96 -0
- package/example/src/chevre/searchEventTicketOffers.ts +7 -4
- package/example/src/chevre/searchOffersByCatalog.ts +2 -1
- package/example/src/chevre/unsetUnnecessaryFields.ts +21 -0
- package/lib/chevre/repo/account.d.ts +4 -10
- package/lib/chevre/repo/account.js +72 -60
- package/lib/chevre/repo/assetTransaction.d.ts +1 -0
- package/lib/chevre/repo/assetTransaction.js +5 -0
- package/lib/chevre/repo/event.d.ts +5 -4
- package/lib/chevre/repo/event.js +12 -30
- package/lib/chevre/repo/mongoose/model/comments.d.ts +1 -1
- package/lib/chevre/repo/mongoose/model/comments.js +1 -1
- package/lib/chevre/repo/mongoose/model/offer.js +12 -0
- package/lib/chevre/repo/offer.d.ts +17 -2
- package/lib/chevre/repo/offer.js +77 -44
- package/lib/chevre/repo/priceSpecification.d.ts +10 -0
- package/lib/chevre/repo/priceSpecification.js +9 -0
- package/lib/chevre/repo/serviceOutput.d.ts +4 -0
- package/lib/chevre/repo/serviceOutput.js +6 -0
- package/lib/chevre/repository.d.ts +6 -0
- package/lib/chevre/repository.js +8 -1
- package/lib/chevre/service/account.d.ts +0 -8
- package/lib/chevre/service/account.js +16 -10
- package/lib/chevre/service/accountTransaction/deposit.js +2 -1
- package/lib/chevre/service/accountTransaction/factory.js +25 -20
- package/lib/chevre/service/accountTransaction/transfer.js +4 -2
- package/lib/chevre/service/accountTransaction/withdraw.js +2 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +46 -83
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +3 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +19 -11
- package/lib/chevre/service/assetTransaction/pay.js +19 -14
- package/lib/chevre/service/assetTransaction/registerService/factory.js +9 -4
- package/lib/chevre/service/assetTransaction/reserve.js +2 -0
- package/lib/chevre/service/delivery.js +12 -3
- package/lib/chevre/service/event.js +3 -23
- package/lib/chevre/service/moneyTransfer.d.ts +1 -1
- package/lib/chevre/service/moneyTransfer.js +7 -8
- package/lib/chevre/service/offer/event/authorize.js +2 -1
- package/lib/chevre/service/offer/event/factory.js +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +6 -6
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +106 -91
- package/lib/chevre/service/offer/factory.d.ts +4 -1
- package/lib/chevre/service/offer/factory.js +57 -26
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +0 -1
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +0 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +5 -1
- package/lib/chevre/service/payment/any/factory.js +29 -2
- package/lib/chevre/service/payment/any.js +11 -4
- package/lib/chevre/service/payment/movieTicket.d.ts +7 -2
- package/lib/chevre/service/payment/movieTicket.js +17 -8
- package/lib/chevre/service/payment/paymentCard.d.ts +6 -2
- package/lib/chevre/service/payment/paymentCard.js +16 -8
- package/lib/chevre/service/permit.d.ts +5 -1
- package/lib/chevre/service/permit.js +18 -11
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +25 -53
- package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
- package/lib/chevre/settings.d.ts +6 -0
- package/lib/chevre/settings.js +8 -2
- package/package.json +3 -3
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +0 -157
- package/example/src/chevre/migrateProjectSubscription.ts +0 -51
- package/example/src/chevre/migrateSection.ts +0 -105
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Connection } from 'mongoose';
|
|
2
2
|
import * as factory from '../factory';
|
|
3
|
+
interface IProjection {
|
|
4
|
+
[key: string]: 0 | 1;
|
|
5
|
+
}
|
|
3
6
|
/**
|
|
4
7
|
* オファーリポジトリ
|
|
5
8
|
*/
|
|
@@ -23,15 +26,22 @@ export declare class MongoRepository {
|
|
|
23
26
|
availableAtOrFrom?: {
|
|
24
27
|
id?: string;
|
|
25
28
|
};
|
|
29
|
+
unacceptedPaymentMethod?: string[];
|
|
30
|
+
excludeAppliesToMovieTicket: boolean;
|
|
31
|
+
onlyValid?: boolean;
|
|
26
32
|
limit?: number;
|
|
27
33
|
page?: number;
|
|
28
34
|
sort: boolean;
|
|
29
|
-
|
|
35
|
+
projection?: IProjection;
|
|
36
|
+
}): Promise<{
|
|
37
|
+
offers: factory.unitPriceOffer.IUnitPriceOffer[];
|
|
38
|
+
sortedOfferIds: string[];
|
|
39
|
+
}>;
|
|
30
40
|
findById(params: {
|
|
31
41
|
id: string;
|
|
32
42
|
}): Promise<factory.unitPriceOffer.IUnitPriceOffer>;
|
|
33
43
|
count(params: factory.unitPriceOffer.ISearchConditions): Promise<number>;
|
|
34
|
-
search(params: factory.unitPriceOffer.ISearchConditions): Promise<factory.unitPriceOffer.IUnitPriceOffer[]>;
|
|
44
|
+
search(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<factory.unitPriceOffer.IUnitPriceOffer[]>;
|
|
35
45
|
save(params: factory.unitPriceOffer.IUnitPriceOffer): Promise<factory.unitPriceOffer.IUnitPriceOffer>;
|
|
36
46
|
saveManyByIdentifier(params: {
|
|
37
47
|
attributes: factory.unitPriceOffer.IUnitPriceOffer;
|
|
@@ -46,4 +56,9 @@ export declare class MongoRepository {
|
|
|
46
56
|
};
|
|
47
57
|
}): Promise<void>;
|
|
48
58
|
getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
|
|
59
|
+
unsetUnnecessaryFields(params: {
|
|
60
|
+
filter: any;
|
|
61
|
+
$unset: any;
|
|
62
|
+
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
49
63
|
}
|
|
64
|
+
export {};
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -35,7 +35,7 @@ class MongoRepository {
|
|
|
35
35
|
}
|
|
36
36
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
37
37
|
static CREATE_OFFER_MONGO_CONDITIONS(params) {
|
|
38
|
-
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;
|
|
38
|
+
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;
|
|
39
39
|
// MongoDB検索条件
|
|
40
40
|
const andConditions = [];
|
|
41
41
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -166,7 +166,15 @@ class MongoRepository {
|
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
const
|
|
169
|
+
const appliesToMovieTicketServiceTypeExist = (_w = (_v = (_u = params.priceSpecification) === null || _u === void 0 ? void 0 : _u.appliesToMovieTicket) === null || _v === void 0 ? void 0 : _v.serviceType) === null || _w === void 0 ? void 0 : _w.$exists;
|
|
170
|
+
if (typeof appliesToMovieTicketServiceTypeExist === 'boolean') {
|
|
171
|
+
andConditions.push({
|
|
172
|
+
'priceSpecification.appliesToMovieTicket.serviceType': {
|
|
173
|
+
$exists: appliesToMovieTicketServiceTypeExist
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
const appliesToMovieTicketServiceTypeEq = (_z = (_y = (_x = params.priceSpecification) === null || _x === void 0 ? void 0 : _x.appliesToMovieTicket) === null || _y === void 0 ? void 0 : _y.serviceType) === null || _z === void 0 ? void 0 : _z.$eq;
|
|
170
178
|
if (typeof appliesToMovieTicketServiceTypeEq === 'string') {
|
|
171
179
|
andConditions.push({
|
|
172
180
|
'priceSpecification.appliesToMovieTicket.serviceType': {
|
|
@@ -175,7 +183,7 @@ class MongoRepository {
|
|
|
175
183
|
}
|
|
176
184
|
});
|
|
177
185
|
}
|
|
178
|
-
const appliesToMovieTicketServiceOutputTypeOfEq = (
|
|
186
|
+
const appliesToMovieTicketServiceOutputTypeOfEq = (_3 = (_2 = (_1 = (_0 = params.priceSpecification) === null || _0 === void 0 ? void 0 : _0.appliesToMovieTicket) === null || _1 === void 0 ? void 0 : _1.serviceOutput) === null || _2 === void 0 ? void 0 : _2.typeOf) === null || _3 === void 0 ? void 0 : _3.$eq;
|
|
179
187
|
if (typeof appliesToMovieTicketServiceOutputTypeOfEq === 'string') {
|
|
180
188
|
andConditions.push({
|
|
181
189
|
'priceSpecification.appliesToMovieTicket.serviceOutput.typeOf': {
|
|
@@ -184,8 +192,16 @@ class MongoRepository {
|
|
|
184
192
|
}
|
|
185
193
|
});
|
|
186
194
|
}
|
|
195
|
+
const appliesToMovieTicketServiceOutputTypeOfNin = (_7 = (_6 = (_5 = (_4 = params.priceSpecification) === null || _4 === void 0 ? void 0 : _4.appliesToMovieTicket) === null || _5 === void 0 ? void 0 : _5.serviceOutput) === null || _6 === void 0 ? void 0 : _6.typeOf) === null || _7 === void 0 ? void 0 : _7.$nin;
|
|
196
|
+
if (Array.isArray(appliesToMovieTicketServiceOutputTypeOfNin)) {
|
|
197
|
+
andConditions.push({
|
|
198
|
+
'priceSpecification.appliesToMovieTicket.serviceOutput.typeOf': {
|
|
199
|
+
$nin: appliesToMovieTicketServiceOutputTypeOfNin
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
187
203
|
if (params.priceSpecification !== undefined && params.priceSpecification !== null) {
|
|
188
|
-
const priceSpecificationPriceGte = (
|
|
204
|
+
const priceSpecificationPriceGte = (_8 = params.priceSpecification.price) === null || _8 === void 0 ? void 0 : _8.$gte;
|
|
189
205
|
if (typeof priceSpecificationPriceGte === 'number') {
|
|
190
206
|
andConditions.push({
|
|
191
207
|
'priceSpecification.price': {
|
|
@@ -194,7 +210,7 @@ class MongoRepository {
|
|
|
194
210
|
}
|
|
195
211
|
});
|
|
196
212
|
}
|
|
197
|
-
const priceSpecificationPriceLte = (
|
|
213
|
+
const priceSpecificationPriceLte = (_9 = params.priceSpecification.price) === null || _9 === void 0 ? void 0 : _9.$lte;
|
|
198
214
|
if (typeof priceSpecificationPriceLte === 'number') {
|
|
199
215
|
andConditions.push({
|
|
200
216
|
'priceSpecification.price': {
|
|
@@ -203,7 +219,7 @@ class MongoRepository {
|
|
|
203
219
|
}
|
|
204
220
|
});
|
|
205
221
|
}
|
|
206
|
-
const accountsReceivableGte = (
|
|
222
|
+
const accountsReceivableGte = (_11 = (_10 = params.priceSpecification.accounting) === null || _10 === void 0 ? void 0 : _10.accountsReceivable) === null || _11 === void 0 ? void 0 : _11.$gte;
|
|
207
223
|
if (typeof accountsReceivableGte === 'number') {
|
|
208
224
|
andConditions.push({
|
|
209
225
|
'priceSpecification.accounting.accountsReceivable': {
|
|
@@ -212,7 +228,7 @@ class MongoRepository {
|
|
|
212
228
|
}
|
|
213
229
|
});
|
|
214
230
|
}
|
|
215
|
-
const accountsReceivableLte = (
|
|
231
|
+
const accountsReceivableLte = (_13 = (_12 = params.priceSpecification.accounting) === null || _12 === void 0 ? void 0 : _12.accountsReceivable) === null || _13 === void 0 ? void 0 : _13.$lte;
|
|
216
232
|
if (typeof accountsReceivableLte === 'number') {
|
|
217
233
|
andConditions.push({
|
|
218
234
|
'priceSpecification.accounting.accountsReceivable': {
|
|
@@ -221,7 +237,7 @@ class MongoRepository {
|
|
|
221
237
|
}
|
|
222
238
|
});
|
|
223
239
|
}
|
|
224
|
-
const accountingCodeValueEq = (
|
|
240
|
+
const accountingCodeValueEq = (_16 = (_15 = (_14 = params.priceSpecification.accounting) === null || _14 === void 0 ? void 0 : _14.operatingRevenue) === null || _15 === void 0 ? void 0 : _15.codeValue) === null || _16 === void 0 ? void 0 : _16.$eq;
|
|
225
241
|
if (typeof accountingCodeValueEq === 'string') {
|
|
226
242
|
andConditions.push({
|
|
227
243
|
'priceSpecification.accounting.operatingRevenue.codeValue': {
|
|
@@ -230,7 +246,7 @@ class MongoRepository {
|
|
|
230
246
|
}
|
|
231
247
|
});
|
|
232
248
|
}
|
|
233
|
-
const accountingCodeValueIn = (
|
|
249
|
+
const accountingCodeValueIn = (_19 = (_18 = (_17 = params.priceSpecification.accounting) === null || _17 === void 0 ? void 0 : _17.operatingRevenue) === null || _18 === void 0 ? void 0 : _18.codeValue) === null || _19 === void 0 ? void 0 : _19.$in;
|
|
234
250
|
if (Array.isArray(accountingCodeValueIn)) {
|
|
235
251
|
andConditions.push({
|
|
236
252
|
'priceSpecification.accounting.operatingRevenue.codeValue': {
|
|
@@ -239,7 +255,7 @@ class MongoRepository {
|
|
|
239
255
|
}
|
|
240
256
|
});
|
|
241
257
|
}
|
|
242
|
-
const referenceQuantityValueEq = (
|
|
258
|
+
const referenceQuantityValueEq = (_21 = (_20 = params.priceSpecification.referenceQuantity) === null || _20 === void 0 ? void 0 : _20.value) === null || _21 === void 0 ? void 0 : _21.$eq;
|
|
243
259
|
if (typeof referenceQuantityValueEq === 'number') {
|
|
244
260
|
andConditions.push({
|
|
245
261
|
'priceSpecification.referenceQuantity.value': {
|
|
@@ -249,7 +265,7 @@ class MongoRepository {
|
|
|
249
265
|
});
|
|
250
266
|
}
|
|
251
267
|
}
|
|
252
|
-
const availableAtOrFromIdEq = (
|
|
268
|
+
const availableAtOrFromIdEq = (_23 = (_22 = params.availableAtOrFrom) === null || _22 === void 0 ? void 0 : _22.id) === null || _23 === void 0 ? void 0 : _23.$eq;
|
|
253
269
|
if (typeof availableAtOrFromIdEq === 'string') {
|
|
254
270
|
andConditions.push({
|
|
255
271
|
'availableAtOrFrom.id': {
|
|
@@ -258,7 +274,7 @@ class MongoRepository {
|
|
|
258
274
|
}
|
|
259
275
|
});
|
|
260
276
|
}
|
|
261
|
-
const availableAtOrFromIdIn = (
|
|
277
|
+
const availableAtOrFromIdIn = (_25 = (_24 = params.availableAtOrFrom) === null || _24 === void 0 ? void 0 : _24.id) === null || _25 === void 0 ? void 0 : _25.$in;
|
|
262
278
|
if (Array.isArray(availableAtOrFromIdIn)) {
|
|
263
279
|
andConditions.push({
|
|
264
280
|
'availableAtOrFrom.id': {
|
|
@@ -267,7 +283,7 @@ class MongoRepository {
|
|
|
267
283
|
}
|
|
268
284
|
});
|
|
269
285
|
}
|
|
270
|
-
const addOnItemOfferedIdEq = (
|
|
286
|
+
const addOnItemOfferedIdEq = (_28 = (_27 = (_26 = params.addOn) === null || _26 === void 0 ? void 0 : _26.itemOffered) === null || _27 === void 0 ? void 0 : _27.id) === null || _28 === void 0 ? void 0 : _28.$eq;
|
|
271
287
|
if (typeof addOnItemOfferedIdEq === 'string') {
|
|
272
288
|
andConditions.push({
|
|
273
289
|
'addOn.itemOffered.id': {
|
|
@@ -276,7 +292,7 @@ class MongoRepository {
|
|
|
276
292
|
}
|
|
277
293
|
});
|
|
278
294
|
}
|
|
279
|
-
const hasMerchantReturnPolicyIdEq = (
|
|
295
|
+
const hasMerchantReturnPolicyIdEq = (_30 = (_29 = params.hasMerchantReturnPolicy) === null || _29 === void 0 ? void 0 : _29.id) === null || _30 === void 0 ? void 0 : _30.$eq;
|
|
280
296
|
if (typeof hasMerchantReturnPolicyIdEq === 'string') {
|
|
281
297
|
andConditions.push({
|
|
282
298
|
'hasMerchantReturnPolicy.id': {
|
|
@@ -285,7 +301,7 @@ class MongoRepository {
|
|
|
285
301
|
}
|
|
286
302
|
});
|
|
287
303
|
}
|
|
288
|
-
const additionalPropertyElemMatch = (
|
|
304
|
+
const additionalPropertyElemMatch = (_31 = params.additionalProperty) === null || _31 === void 0 ? void 0 : _31.$elemMatch;
|
|
289
305
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
290
306
|
andConditions.push({
|
|
291
307
|
additionalProperty: {
|
|
@@ -294,6 +310,20 @@ class MongoRepository {
|
|
|
294
310
|
}
|
|
295
311
|
});
|
|
296
312
|
}
|
|
313
|
+
if (params.onlyValid === true) {
|
|
314
|
+
const now = new Date();
|
|
315
|
+
andConditions.push({
|
|
316
|
+
$or: [
|
|
317
|
+
{ validFrom: { $exists: false } },
|
|
318
|
+
{ validFrom: { $exists: true, $lte: now } }
|
|
319
|
+
]
|
|
320
|
+
}, {
|
|
321
|
+
$or: [
|
|
322
|
+
{ validThrough: { $exists: false } },
|
|
323
|
+
{ validThrough: { $exists: true, $gte: now } }
|
|
324
|
+
]
|
|
325
|
+
});
|
|
326
|
+
}
|
|
297
327
|
return andConditions;
|
|
298
328
|
}
|
|
299
329
|
/**
|
|
@@ -324,37 +354,32 @@ class MongoRepository {
|
|
|
324
354
|
const sortedOfferIds = (Array.isArray(itemListElements))
|
|
325
355
|
? itemListElements.map((element) => element.id)
|
|
326
356
|
: [];
|
|
327
|
-
// const offerCatalog = await this.offerCatalogModel.findById(
|
|
328
|
-
// params.offerCatalog.id,
|
|
329
|
-
// {
|
|
330
|
-
// itemListElement: 1
|
|
331
|
-
// }
|
|
332
|
-
// )
|
|
333
|
-
// .exec()
|
|
334
|
-
// .then((doc) => {
|
|
335
|
-
// if (doc === null) {
|
|
336
|
-
// throw new factory.errors.NotFound(this.offerCatalogModel.modelName);
|
|
337
|
-
// }
|
|
338
|
-
// return <Pick<factory.offerCatalog.IOfferCatalog, 'itemListElement'>>doc.toObject();
|
|
339
|
-
// });
|
|
340
|
-
// let sortedOfferIds: string[] = (Array.isArray(offerCatalog.itemListElement))
|
|
341
|
-
// ? offerCatalog.itemListElement.map((element) => element.id)
|
|
342
|
-
// : [];
|
|
343
|
-
// const filteredIds = params.ids;
|
|
344
|
-
// if (Array.isArray(filteredIds)) {
|
|
345
|
-
// sortedOfferIds = sortedOfferIds.filter((id) => filteredIds.includes(id));
|
|
346
|
-
// }
|
|
347
357
|
let offers = [];
|
|
348
358
|
if (sortedOfferIds.length > 0) {
|
|
349
|
-
|
|
359
|
+
const searchOffersConditions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id: { $in: sortedOfferIds } }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
350
360
|
? { availableAtOrFrom: { id: { $eq: params.availableAtOrFrom.id } } }
|
|
351
|
-
: undefined)
|
|
361
|
+
: undefined), { priceSpecification: {
|
|
362
|
+
appliesToMovieTicket: Object.assign(Object.assign({}, (Array.isArray(params.unacceptedPaymentMethod) && params.unacceptedPaymentMethod.length > 0)
|
|
363
|
+
? {
|
|
364
|
+
serviceOutput: {
|
|
365
|
+
typeOf: { $nin: params.unacceptedPaymentMethod }
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
: undefined), (params.excludeAppliesToMovieTicket)
|
|
369
|
+
? {
|
|
370
|
+
serviceType: { $exists: false }
|
|
371
|
+
}
|
|
372
|
+
: undefined)
|
|
373
|
+
}, onlyValid: params.onlyValid === true }), (typeof params.limit === 'number' && typeof params.page === 'number')
|
|
374
|
+
? { sort: { _id: factory.sortType.Ascending } }
|
|
375
|
+
: undefined), (typeof params.limit === 'number') ? { limit: params.limit } : undefined), (typeof params.page === 'number') ? { page: params.page } : undefined);
|
|
376
|
+
offers = yield this.search(searchOffersConditions, params.projection);
|
|
352
377
|
if (params.sort) {
|
|
353
378
|
// sorting
|
|
354
379
|
offers = offers.sort((a, b) => sortedOfferIds.indexOf(String(a.id)) - sortedOfferIds.indexOf(String(b.id)));
|
|
355
380
|
}
|
|
356
381
|
}
|
|
357
|
-
return offers;
|
|
382
|
+
return { offers, sortedOfferIds };
|
|
358
383
|
});
|
|
359
384
|
}
|
|
360
385
|
findById(params) {
|
|
@@ -379,14 +404,16 @@ class MongoRepository {
|
|
|
379
404
|
.exec();
|
|
380
405
|
});
|
|
381
406
|
}
|
|
382
|
-
search(params) {
|
|
407
|
+
search(params, projection) {
|
|
383
408
|
return __awaiter(this, void 0, void 0, function* () {
|
|
384
409
|
const conditions = MongoRepository.CREATE_OFFER_MONGO_CONDITIONS(params);
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
})
|
|
410
|
+
const positiveProjectionExists = (projection !== undefined && projection !== null)
|
|
411
|
+
? Object.values(projection)
|
|
412
|
+
.some((value) => value !== 0)
|
|
413
|
+
: false;
|
|
414
|
+
const query = this.offerModel.find((conditions.length > 0) ? { $and: conditions } : {}, (positiveProjectionExists)
|
|
415
|
+
? projection
|
|
416
|
+
: Object.assign(Object.assign({}, projection), { __v: 0, createdAt: 0, updatedAt: 0 }));
|
|
390
417
|
if (typeof params.limit === 'number') {
|
|
391
418
|
const page = (typeof params.page === 'number') ? params.page : 1;
|
|
392
419
|
query.limit(params.limit)
|
|
@@ -475,5 +502,11 @@ class MongoRepository {
|
|
|
475
502
|
.sort({ 'priceSpecification.price': factory.sortType.Descending })
|
|
476
503
|
.cursor();
|
|
477
504
|
}
|
|
505
|
+
unsetUnnecessaryFields(params) {
|
|
506
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
507
|
+
return this.offerModel.updateMany(params.filter, { $unset: params.$unset })
|
|
508
|
+
.exec();
|
|
509
|
+
});
|
|
510
|
+
}
|
|
478
511
|
}
|
|
479
512
|
exports.MongoRepository = MongoRepository;
|
|
@@ -30,5 +30,15 @@ export declare class MongoRepository {
|
|
|
30
30
|
id: string;
|
|
31
31
|
};
|
|
32
32
|
}): Promise<void>;
|
|
33
|
+
deleteUnnecessaryMovieTicketTypeChargePriceSpecs(params: {
|
|
34
|
+
project?: {
|
|
35
|
+
id?: string;
|
|
36
|
+
};
|
|
37
|
+
}): Promise<{
|
|
38
|
+
ok?: number | undefined;
|
|
39
|
+
n?: number | undefined;
|
|
40
|
+
} & {
|
|
41
|
+
deletedCount?: number | undefined;
|
|
42
|
+
}>;
|
|
33
43
|
getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
|
|
34
44
|
}
|
|
@@ -277,6 +277,15 @@ class MongoRepository {
|
|
|
277
277
|
.exec();
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
|
+
deleteUnnecessaryMovieTicketTypeChargePriceSpecs(params) {
|
|
281
|
+
var _a;
|
|
282
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
283
|
+
return this.priceSpecificationModel.deleteMany(Object.assign({ typeOf: { $eq: factory.priceSpecificationType.MovieTicketTypeChargeSpecification }, price: { $eq: 0 } }, (typeof ((_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
284
|
+
? { 'project.id': { $eq: params.project.id } }
|
|
285
|
+
: undefined))
|
|
286
|
+
.exec();
|
|
287
|
+
});
|
|
288
|
+
}
|
|
280
289
|
getCursor(conditions, projection) {
|
|
281
290
|
return this.priceSpecificationModel.find(conditions, projection)
|
|
282
291
|
.sort({ price: factory.sortType.Ascending })
|
|
@@ -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';
|
|
@@ -82,6 +83,11 @@ export declare class CategoryCode extends CategoryCodeRepo {
|
|
|
82
83
|
*/
|
|
83
84
|
export declare class Code extends CodeRepo {
|
|
84
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* コメントリポジトリ
|
|
88
|
+
*/
|
|
89
|
+
export declare class Comment extends CommentRepo {
|
|
90
|
+
}
|
|
85
91
|
/**
|
|
86
92
|
* 確認番号リポジトリ
|
|
87
93
|
*/
|
package/lib/chevre/repository.js
CHANGED
|
@@ -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");
|
|
@@ -98,6 +99,12 @@ exports.CategoryCode = CategoryCode;
|
|
|
98
99
|
class Code extends code_1.MongoRepository {
|
|
99
100
|
}
|
|
100
101
|
exports.Code = Code;
|
|
102
|
+
/**
|
|
103
|
+
* コメントリポジトリ
|
|
104
|
+
*/
|
|
105
|
+
class Comment extends comment_1.MongoRepository {
|
|
106
|
+
}
|
|
107
|
+
exports.Comment = Comment;
|
|
101
108
|
/**
|
|
102
109
|
* 確認番号リポジトリ
|
|
103
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.
|
|
12
|
+
exports.cancelMoneyTransfer = exports.transferMoney = exports.open = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* 口座サービス
|
|
15
15
|
* 開設、閉鎖等、口座アクション実行など
|
|
@@ -38,15 +38,21 @@ exports.open = open;
|
|
|
38
38
|
/**
|
|
39
39
|
* 口座を解約する
|
|
40
40
|
*/
|
|
41
|
-
function close(params
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
* 確定取引結果から、実際の転送アクションを実行します。
|
|
@@ -29,7 +29,8 @@ function start(params) {
|
|
|
29
29
|
amount: params.object.amount,
|
|
30
30
|
toLocation: {
|
|
31
31
|
typeOf: account.typeOf,
|
|
32
|
-
|
|
32
|
+
// 廃止(2023-02-16~)
|
|
33
|
+
// accountType: account.accountType,
|
|
33
34
|
accountNumber: account.accountNumber,
|
|
34
35
|
name: account.name
|
|
35
36
|
},
|
|
@@ -22,7 +22,8 @@ function createMoneyTransferActionAttributes(params) {
|
|
|
22
22
|
case factory.account.transactionType.Deposit:
|
|
23
23
|
toLocation = {
|
|
24
24
|
typeOf: transaction.object.toLocation.typeOf,
|
|
25
|
-
|
|
25
|
+
// 廃止(2023-02-16~)
|
|
26
|
+
// accountType: transaction.object.toLocation.accountType,
|
|
26
27
|
accountNumber: transaction.object.toLocation.accountNumber,
|
|
27
28
|
name: transaction.recipient.name
|
|
28
29
|
};
|
|
@@ -30,13 +31,15 @@ function createMoneyTransferActionAttributes(params) {
|
|
|
30
31
|
case factory.account.transactionType.Transfer:
|
|
31
32
|
fromLocation = {
|
|
32
33
|
typeOf: transaction.object.fromLocation.typeOf,
|
|
33
|
-
|
|
34
|
+
// 廃止(2023-02-16~)
|
|
35
|
+
// accountType: transaction.object.fromLocation.accountType,
|
|
34
36
|
accountNumber: transaction.object.fromLocation.accountNumber,
|
|
35
37
|
name: transaction.agent.name
|
|
36
38
|
};
|
|
37
39
|
toLocation = {
|
|
38
40
|
typeOf: transaction.object.toLocation.typeOf,
|
|
39
|
-
|
|
41
|
+
// 廃止(2023-02-16~)
|
|
42
|
+
// accountType: transaction.object.toLocation.accountType,
|
|
40
43
|
accountNumber: transaction.object.toLocation.accountNumber,
|
|
41
44
|
name: transaction.recipient.name
|
|
42
45
|
};
|
|
@@ -44,28 +47,29 @@ function createMoneyTransferActionAttributes(params) {
|
|
|
44
47
|
case factory.account.transactionType.Withdraw:
|
|
45
48
|
fromLocation = {
|
|
46
49
|
typeOf: transaction.object.fromLocation.typeOf,
|
|
47
|
-
|
|
50
|
+
// 廃止(2023-02-16~)
|
|
51
|
+
// accountType: transaction.object.fromLocation.accountType,
|
|
48
52
|
accountNumber: transaction.object.fromLocation.accountNumber,
|
|
49
53
|
name: transaction.agent.name
|
|
50
54
|
};
|
|
51
55
|
break;
|
|
52
56
|
default:
|
|
53
57
|
}
|
|
54
|
-
let accountType;
|
|
55
|
-
const transactionType = params.transaction.typeOf;
|
|
56
|
-
switch (transactionType) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
58
|
+
// let accountType: string;
|
|
59
|
+
// const transactionType = params.transaction.typeOf;
|
|
60
|
+
// switch (transactionType) {
|
|
61
|
+
// case factory.account.transactionType.Deposit:
|
|
62
|
+
// accountType = params.transaction.object.toLocation.accountType;
|
|
63
|
+
// break;
|
|
64
|
+
// case factory.account.transactionType.Transfer:
|
|
65
|
+
// accountType = params.transaction.object.fromLocation.accountType;
|
|
66
|
+
// break;
|
|
67
|
+
// case factory.account.transactionType.Withdraw:
|
|
68
|
+
// accountType = params.transaction.object.fromLocation.accountType;
|
|
69
|
+
// break;
|
|
70
|
+
// default:
|
|
71
|
+
// throw new factory.errors.NotImplemented(`transaction type ${transactionType} not implemented`);
|
|
72
|
+
// }
|
|
69
73
|
const purpose = {
|
|
70
74
|
typeOf: transaction.typeOf,
|
|
71
75
|
id: transaction.id,
|
|
@@ -84,7 +88,8 @@ function createMoneyTransferActionAttributes(params) {
|
|
|
84
88
|
recipient: transaction.recipient,
|
|
85
89
|
amount: {
|
|
86
90
|
typeOf: 'MonetaryAmount',
|
|
87
|
-
|
|
91
|
+
// 廃止(2023-02-16~)
|
|
92
|
+
// currency: accountType,
|
|
88
93
|
value: (typeof transaction.object.amount === 'number')
|
|
89
94
|
? transaction.object.amount
|
|
90
95
|
: transaction.object.amount.value
|
|
@@ -47,13 +47,15 @@ function start(params) {
|
|
|
47
47
|
amount: params.object.amount,
|
|
48
48
|
fromLocation: {
|
|
49
49
|
typeOf: fromAccount.typeOf,
|
|
50
|
-
|
|
50
|
+
// 廃止(2023-02-16~)
|
|
51
|
+
// accountType: fromAccount.accountType,
|
|
51
52
|
accountNumber: fromAccount.accountNumber,
|
|
52
53
|
name: fromAccount.name
|
|
53
54
|
},
|
|
54
55
|
toLocation: {
|
|
55
56
|
typeOf: toAccount.typeOf,
|
|
56
|
-
|
|
57
|
+
// 廃止(2023-02-16~)
|
|
58
|
+
// accountType: toAccount.accountType,
|
|
57
59
|
accountNumber: toAccount.accountNumber,
|
|
58
60
|
name: toAccount.name
|
|
59
61
|
},
|
|
@@ -36,7 +36,8 @@ function start(params) {
|
|
|
36
36
|
amount: params.object.amount,
|
|
37
37
|
fromLocation: {
|
|
38
38
|
typeOf: fromAccount.typeOf,
|
|
39
|
-
|
|
39
|
+
// 廃止(2023-02-16~)
|
|
40
|
+
// accountType: fromAccount.accountType,
|
|
40
41
|
accountNumber: fromAccount.accountNumber,
|
|
41
42
|
name: fromAccount.name
|
|
42
43
|
},
|