@chevre/domain 20.2.0-alpha.15 → 20.2.0-alpha.17

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.
@@ -0,0 +1,113 @@
1
+ // tslint:disable:no-console
2
+ import * as moment from 'moment-timezone';
3
+ import * as mongoose from 'mongoose';
4
+
5
+ import { chevre } from '../../../../lib/index';
6
+
7
+ // const project = { id: <string>process.env.PROJECT_ID };
8
+ interface IAggregation {
9
+ typeOf: 'AggregateOrder';
10
+ project: { id: string; typeOf: chevre.factory.organizationType.Project };
11
+ aggregateDate: Date;
12
+ aggregateDuration: string;
13
+ aggregateStart: Date;
14
+ orderCount: number;
15
+ acceptedOfferCount: number;
16
+ avgAcceptedOfferCount: number;
17
+ totalPrice: number;
18
+ maxPrice: number;
19
+ minPrice: number;
20
+ avgPrice: number;
21
+ }
22
+
23
+ async function main() {
24
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
25
+
26
+ const now: Date = new Date();
27
+
28
+ const aggregationRepo = new chevre.repository.Aggregation(mongoose.connection);
29
+ const orderRepo = new chevre.repository.Order(mongoose.connection);
30
+
31
+ let i = 0;
32
+ // tslint:disable-next-line:no-magic-numbers
33
+ while (i < 365) {
34
+ i += 1;
35
+
36
+ const orderDateFrom: Date = moment()
37
+ // .tz('Asia/Tokyo')
38
+ .add(-i, 'days')
39
+ .startOf('day')
40
+ .toDate();
41
+ const orderDateThrough: Date = moment()
42
+ // .tz('Asia/Tokyo')
43
+ .add(-i, 'days')
44
+ .endOf('day')
45
+ .toDate();
46
+ // console.log(bookingFrom, bookingThrough);
47
+
48
+ const aggregateResult = await orderRepo.aggregateOrder({
49
+ orderDate: {
50
+ $gte: orderDateFrom,
51
+ $lte: orderDateThrough
52
+ }
53
+ });
54
+ console.log('aggregateResult', aggregateResult);
55
+
56
+ const aggregation: IAggregation = {
57
+ typeOf: 'AggregateOrder',
58
+ project: { id: '*', typeOf: chevre.factory.organizationType.Project },
59
+ aggregateDuration: moment.duration(1, 'days')
60
+ .toISOString(),
61
+ aggregateStart: orderDateFrom,
62
+ aggregateDate: now,
63
+ orderCount: (aggregateResult.length > 0) ? aggregateResult[0].orderCount : 0,
64
+ acceptedOfferCount: (aggregateResult.length > 0) ? aggregateResult[0].acceptedOfferCount : 0,
65
+ avgAcceptedOfferCount: (aggregateResult.length > 0) ? aggregateResult[0].avgAcceptedOfferCount : 0,
66
+ totalPrice: (aggregateResult.length > 0) ? aggregateResult[0].totalPrice : 0,
67
+ maxPrice: (aggregateResult.length > 0) ? aggregateResult[0].maxPrice : 0,
68
+ minPrice: (aggregateResult.length > 0) ? aggregateResult[0].minPrice : 0,
69
+ avgPrice: (aggregateResult.length > 0) ? aggregateResult[0].avgPrice : 0
70
+ };
71
+ const {
72
+ avgAcceptedOfferCount,
73
+ totalPrice,
74
+ maxPrice,
75
+ minPrice,
76
+ avgPrice,
77
+ acceptedOfferCount,
78
+ orderCount,
79
+ aggregateDate,
80
+ ...setOnInsert
81
+ } = aggregation;
82
+ const doc = await aggregationRepo.aggregationModel.findOneAndUpdate(
83
+ {
84
+ typeOf: { $eq: aggregation.typeOf },
85
+ 'project.id': { $eq: aggregation.project.id },
86
+ aggregateStart: { $eq: aggregation.aggregateStart },
87
+ aggregateDuration: { $eq: aggregation.aggregateDuration }
88
+ },
89
+ {
90
+ $setOnInsert: setOnInsert,
91
+ $set: {
92
+ avgAcceptedOfferCount,
93
+ totalPrice,
94
+ maxPrice,
95
+ minPrice,
96
+ avgPrice,
97
+ acceptedOfferCount,
98
+ orderCount,
99
+ aggregateDate
100
+ }
101
+ },
102
+ { upsert: true }
103
+ )
104
+ .exec();
105
+ console.log(doc);
106
+ }
107
+ }
108
+
109
+ main()
110
+ .then(() => {
111
+ console.log('success!');
112
+ })
113
+ .catch(console.error);
@@ -0,0 +1,84 @@
1
+ // tslint:disable:no-console
2
+ import * as moment from 'moment-timezone';
3
+ import * as mongoose from 'mongoose';
4
+
5
+ import { chevre } from '../../../../lib/index';
6
+
7
+ // const project = { id: <string>process.env.PROJECT_ID };
8
+ interface IAggregation {
9
+ typeOf: 'AggregateReservation';
10
+ project: { id: string; typeOf: chevre.factory.organizationType.Project };
11
+ aggregateDate: Date;
12
+ aggregateDuration: string;
13
+ aggregateStart: Date;
14
+ // bookingTime: Date;
15
+ reservationCount: number;
16
+ }
17
+
18
+ async function main() {
19
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
20
+
21
+ const now: Date = new Date();
22
+
23
+ const aggregationRepo = new chevre.repository.Aggregation(mongoose.connection);
24
+ const reservationRepo = new chevre.repository.Reservation(mongoose.connection);
25
+
26
+ let i = 0;
27
+ // tslint:disable-next-line:no-magic-numbers
28
+ while (i < 365) {
29
+ i += 1;
30
+
31
+ const bookingFrom: Date = moment()
32
+ // .tz('Asia/Tokyo')
33
+ .add(-i, 'days')
34
+ .startOf('day')
35
+ .toDate();
36
+ const bookingThrough: Date = moment()
37
+ // .tz('Asia/Tokyo')
38
+ .add(-i, 'days')
39
+ .endOf('day')
40
+ .toDate();
41
+ // console.log(bookingFrom, bookingThrough);
42
+
43
+ // i日前の予約検索
44
+ const searchReservationCountResult = await reservationRepo.count({
45
+ typeOf: chevre.factory.reservationType.EventReservation,
46
+ reservationStatus: { $eq: chevre.factory.reservationStatusType.ReservationConfirmed },
47
+ bookingFrom,
48
+ bookingThrough
49
+ });
50
+
51
+ const aggregation: IAggregation = {
52
+ typeOf: 'AggregateReservation',
53
+ project: { id: '*', typeOf: chevre.factory.organizationType.Project },
54
+ aggregateDuration: moment.duration(1, 'days')
55
+ .toISOString(),
56
+ aggregateStart: bookingFrom,
57
+ aggregateDate: now,
58
+ reservationCount: searchReservationCountResult
59
+ };
60
+ console.log(aggregation);
61
+ const { reservationCount, aggregateDate, ...setOnInsert } = aggregation;
62
+ const doc = await aggregationRepo.aggregationModel.findOneAndUpdate(
63
+ {
64
+ typeOf: { $eq: aggregation.typeOf },
65
+ 'project.id': { $eq: aggregation.project.id },
66
+ aggregateStart: { $eq: aggregation.aggregateStart },
67
+ aggregateDuration: { $eq: aggregation.aggregateDuration }
68
+ },
69
+ {
70
+ $setOnInsert: setOnInsert,
71
+ $set: { aggregateDate, reservationCount }
72
+ },
73
+ { upsert: true }
74
+ )
75
+ .exec();
76
+ console.log(doc);
77
+ }
78
+ }
79
+
80
+ main()
81
+ .then(() => {
82
+ console.log('success!');
83
+ })
84
+ .catch(console.error);
@@ -0,0 +1,104 @@
1
+ // tslint:disable:no-console
2
+ import * as moment from 'moment-timezone';
3
+ import * as mongoose from 'mongoose';
4
+
5
+ import { chevre } from '../../../../lib/index';
6
+
7
+ // const project = { id: <string>process.env.PROJECT_ID };
8
+ const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
9
+
10
+ interface IAggregation {
11
+ typeOf: 'AggregatePlaceOrder';
12
+ project: { id: string; typeOf: chevre.factory.organizationType.Project };
13
+ aggregateDate: Date;
14
+ aggregateDuration: string;
15
+ aggregateStart: Date;
16
+ // transactionCount: number;
17
+ // avgDuration: number;
18
+ // maxDuration: number;
19
+ // minDuration: number;
20
+ }
21
+
22
+ async function main() {
23
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
24
+
25
+ const now: Date = new Date();
26
+
27
+ const aggregationRepo = new chevre.repository.Aggregation(mongoose.connection);
28
+ const transactionRepo = new chevre.repository.Transaction(mongoose.connection);
29
+
30
+ let i = 0;
31
+ // tslint:disable-next-line:no-magic-numbers
32
+ while (i < 365) {
33
+ i += 1;
34
+
35
+ const startFrom: Date = moment()
36
+ // .tz('Asia/Tokyo')
37
+ .add(-i, 'days')
38
+ .startOf('day')
39
+ .toDate();
40
+ const startThrough: Date = moment()
41
+ // .tz('Asia/Tokyo')
42
+ .add(-i, 'days')
43
+ .endOf('day')
44
+ .toDate();
45
+ // console.log(bookingFrom, bookingThrough);
46
+
47
+ const aggregateResult = await transactionRepo.aggregatePlaceOrder({
48
+ project: { id: <any>{ $ne: EXCLUDED_PROJECT_ID } },
49
+ startFrom,
50
+ startThrough,
51
+ typeOf: chevre.factory.transactionType.PlaceOrder
52
+ });
53
+ console.log('aggregateResult', aggregateResult, aggregateResult.statuses[0]?.aggregation.percentilesDuration, startFrom);
54
+
55
+ const aggregation: IAggregation = {
56
+ typeOf: 'AggregatePlaceOrder',
57
+ project: { id: '*', typeOf: chevre.factory.organizationType.Project },
58
+ aggregateDuration: moment.duration(1, 'days')
59
+ .toISOString(),
60
+ aggregateStart: startFrom,
61
+ aggregateDate: now,
62
+ ...aggregateResult
63
+ };
64
+ const { typeOf, project, aggregateDuration, aggregateStart, ...setFields } = aggregation;
65
+ const doc = await aggregationRepo.aggregationModel.findOneAndUpdate(
66
+ {
67
+ typeOf: { $eq: aggregation.typeOf },
68
+ 'project.id': { $eq: aggregation.project.id },
69
+ aggregateStart: { $eq: aggregation.aggregateStart },
70
+ aggregateDuration: { $eq: aggregation.aggregateDuration }
71
+ },
72
+ {
73
+ $setOnInsert: {
74
+ typeOf: aggregation.typeOf,
75
+ project: aggregation.project,
76
+ aggregateDuration: aggregation.aggregateDuration,
77
+ aggregateStart: aggregation.aggregateStart
78
+ },
79
+ $set: setFields,
80
+ $unset: {
81
+ avgLargeDuration: 1,
82
+ avgMediumDuration: 1,
83
+ avgSmallDuration: 1,
84
+ stdDevDuration: 1,
85
+ transactionCountByStatus: 1,
86
+ transactionCount: 12,
87
+ avgDuration: 1,
88
+ maxDuration: 1,
89
+ minDuration: 1,
90
+ percentilesDuration: 1
91
+ }
92
+ },
93
+ { upsert: true, new: true }
94
+ )
95
+ .exec();
96
+ console.log(doc);
97
+ }
98
+ }
99
+
100
+ main()
101
+ .then(() => {
102
+ console.log('success!');
103
+ })
104
+ .catch(console.error);
@@ -70,7 +70,6 @@ export declare class MongoRepository {
70
70
  save4ttts(params: {
71
71
  oldEventId: string;
72
72
  attributes: factory.event.IAttributes<factory.eventType.ScreeningEvent>;
73
- useOldEventId: boolean;
74
73
  }): Promise<factory.event.IEvent<factory.eventType.ScreeningEvent>>;
75
74
  count<T extends factory.eventType>(params: ISearchConditions<T>): Promise<number>;
76
75
  /**
@@ -24,7 +24,6 @@ exports.MongoRepository = void 0;
24
24
  const uniqid = require("uniqid");
25
25
  const factory = require("../factory");
26
26
  const event_1 = require("./mongoose/model/event");
27
- const USE_DEPRECATED_EVENT_SEARCH_CONDITIONS = process.env.USE_DEPRECATED_EVENT_SEARCH_CONDITIONS === '1';
28
27
  /**
29
28
  * イベントリポジトリ
30
29
  */
@@ -34,7 +33,7 @@ class MongoRepository {
34
33
  }
35
34
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
36
35
  static CREATE_MONGO_CONDITIONS(conditions) {
37
- 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;
36
+ 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;
38
37
  const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
39
38
  const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
40
39
  if (typeof projectIdEq === 'string') {
@@ -135,12 +134,12 @@ class MongoRepository {
135
134
  // tslint:disable-next-line:no-single-line-block-comment
136
135
  /* istanbul ignore else */
137
136
  if (params.offers !== undefined) {
138
- const itemOfferedIdIn = (_k = (_j = params.offers.itemOffered) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$in;
139
- if (Array.isArray(itemOfferedIdIn)) {
137
+ const itemOfferedIdIn4event = (_k = (_j = params.offers.itemOffered) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$in;
138
+ if (Array.isArray(itemOfferedIdIn4event)) {
140
139
  andConditions.push({
141
140
  'offers.itemOffered.id': {
142
141
  $exists: true,
143
- $in: itemOfferedIdIn
142
+ $in: itemOfferedIdIn4event
144
143
  }
145
144
  });
146
145
  }
@@ -289,103 +288,35 @@ class MongoRepository {
289
288
  });
290
289
  }
291
290
  }
292
- // tslint:disable-next-line:no-single-line-block-comment
293
- /* istanbul ignore else */
294
- if (params.offers !== undefined) {
295
- if (USE_DEPRECATED_EVENT_SEARCH_CONDITIONS) {
296
- // tslint:disable-next-line:no-single-line-block-comment
297
- /* istanbul ignore else */
298
- if (params.offers.availableFrom instanceof Date) {
299
- andConditions.push({
300
- 'offers.availabilityEnds': {
301
- $exists: true,
302
- $gte: params.offers.availableFrom
303
- }
304
- });
305
- }
306
- // tslint:disable-next-line:no-single-line-block-comment
307
- /* istanbul ignore else */
308
- if (params.offers.availableThrough instanceof Date) {
309
- andConditions.push({
310
- 'offers.availabilityStarts': {
311
- $exists: true,
312
- $lte: params.offers.availableThrough
313
- }
314
- });
315
- }
316
- // tslint:disable-next-line:no-single-line-block-comment
317
- /* istanbul ignore else */
318
- if (params.offers.validFrom instanceof Date) {
319
- andConditions.push({
320
- 'offers.validThrough': {
321
- $exists: true,
322
- $gte: params.offers.validFrom
323
- }
324
- });
325
- }
326
- // tslint:disable-next-line:no-single-line-block-comment
327
- /* istanbul ignore else */
328
- if (params.offers.validThrough instanceof Date) {
329
- andConditions.push({
330
- 'offers.validFrom': {
331
- $exists: true,
332
- $lte: params.offers.validThrough
333
- }
334
- });
291
+ const itemOfferedIdIn = (_12 = (_11 = (_10 = params.offers) === null || _10 === void 0 ? void 0 : _10.itemOffered) === null || _11 === void 0 ? void 0 : _11.id) === null || _12 === void 0 ? void 0 : _12.$in;
292
+ if (Array.isArray(itemOfferedIdIn)) {
293
+ andConditions.push({
294
+ 'offers.itemOffered.id': {
295
+ $exists: true,
296
+ $in: itemOfferedIdIn
335
297
  }
336
- }
337
- const itemOfferedIdIn = (_11 = (_10 = params.offers.itemOffered) === null || _10 === void 0 ? void 0 : _10.id) === null || _11 === void 0 ? void 0 : _11.$in;
338
- if (Array.isArray(itemOfferedIdIn)) {
339
- andConditions.push({
340
- 'offers.itemOffered.id': {
341
- $exists: true,
342
- $in: itemOfferedIdIn
343
- }
344
- });
345
- }
346
- // tslint:disable-next-line:no-single-line-block-comment
347
- /* istanbul ignore else */
348
- if (params.offers.itemOffered !== undefined) {
349
- // tslint:disable-next-line:no-single-line-block-comment
350
- /* istanbul ignore else */
351
- if (params.offers.itemOffered.serviceOutput !== undefined) {
352
- // tslint:disable-next-line:no-single-line-block-comment
353
- /* istanbul ignore else */
354
- if (params.offers.itemOffered.serviceOutput.reservedTicket !== undefined) {
355
- // tslint:disable-next-line:no-single-line-block-comment
356
- /* istanbul ignore else */
357
- if (params.offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat !== undefined) {
358
- // tslint:disable-next-line:no-single-line-block-comment
359
- /* istanbul ignore else */
360
- if (Array.isArray(params.offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOfs)) {
361
- andConditions.push({
362
- 'offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOf': {
363
- $exists: true,
364
- $in: params.offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOfs
365
- }
366
- });
367
- }
368
- }
369
- }
298
+ });
299
+ }
300
+ const itemOfferedTicketedSeatTypeOfIn = (_17 = (_16 = (_15 = (_14 = (_13 = params.offers) === null || _13 === void 0 ? void 0 : _13.itemOffered) === null || _14 === void 0 ? void 0 : _14.serviceOutput) === null || _15 === void 0 ? void 0 : _15.reservedTicket) === null || _16 === void 0 ? void 0 : _16.ticketedSeat) === null || _17 === void 0 ? void 0 : _17.typeOfs;
301
+ if (Array.isArray(itemOfferedTicketedSeatTypeOfIn)) {
302
+ andConditions.push({
303
+ 'offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOf': {
304
+ $exists: true,
305
+ $in: itemOfferedTicketedSeatTypeOfIn
370
306
  }
371
- // tslint:disable-next-line:no-single-line-block-comment
372
- /* istanbul ignore else */
373
- if (params.offers.itemOffered.serviceType !== undefined) {
374
- // tslint:disable-next-line:no-single-line-block-comment
375
- /* istanbul ignore else */
376
- if (Array.isArray(params.offers.itemOffered.serviceType.ids)) {
377
- andConditions.push({
378
- 'offers.itemOffered.serviceType.id': {
379
- $exists: true,
380
- $in: params.offers.itemOffered.serviceType.ids
381
- }
382
- });
383
- }
307
+ });
308
+ }
309
+ const itemOfferedServiceTypeIdIn = (_20 = (_19 = (_18 = params.offers) === null || _18 === void 0 ? void 0 : _18.itemOffered) === null || _19 === void 0 ? void 0 : _19.serviceType) === null || _20 === void 0 ? void 0 : _20.ids;
310
+ if (Array.isArray(itemOfferedServiceTypeIdIn)) {
311
+ andConditions.push({
312
+ 'offers.itemOffered.serviceType.id': {
313
+ $exists: true,
314
+ $in: itemOfferedServiceTypeIdIn
384
315
  }
385
- }
316
+ });
386
317
  }
387
- const sellerMakesOfferElemMatch = (_14 = (_13 = (_12 = params.offers) === null || _12 === void 0 ? void 0 : _12.seller) === null || _13 === void 0 ? void 0 : _13.makesOffer) === null || _14 === void 0 ? void 0 : _14.$elemMatch;
388
- if (typeof ((_15 = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _15 === void 0 ? void 0 : _15.$eq) === 'string') {
318
+ const sellerMakesOfferElemMatch = (_23 = (_22 = (_21 = params.offers) === null || _21 === void 0 ? void 0 : _21.seller) === null || _22 === void 0 ? void 0 : _22.makesOffer) === null || _23 === void 0 ? void 0 : _23.$elemMatch;
319
+ if (typeof ((_24 = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _24 === void 0 ? void 0 : _24.$eq) === 'string') {
389
320
  andConditions.push({
390
321
  'offers.seller.makesOffer': {
391
322
  $exists: true,
@@ -422,7 +353,7 @@ class MongoRepository {
422
353
  ]
423
354
  });
424
355
  }
425
- const locationIdEq = (_17 = (_16 = params.location) === null || _16 === void 0 ? void 0 : _16.id) === null || _17 === void 0 ? void 0 : _17.$eq;
356
+ const locationIdEq = (_26 = (_25 = params.location) === null || _25 === void 0 ? void 0 : _25.id) === null || _26 === void 0 ? void 0 : _26.$eq;
426
357
  // tslint:disable-next-line:no-single-line-block-comment
427
358
  /* istanbul ignore else */
428
359
  if (typeof locationIdEq === 'string') {
@@ -444,7 +375,7 @@ class MongoRepository {
444
375
  });
445
376
  }
446
377
  }
447
- const workPerformedIdentifierIn = (_18 = params.workPerformed) === null || _18 === void 0 ? void 0 : _18.identifiers;
378
+ const workPerformedIdentifierIn = (_27 = params.workPerformed) === null || _27 === void 0 ? void 0 : _27.identifiers;
448
379
  // tslint:disable-next-line:no-single-line-block-comment
449
380
  /* istanbul ignore else */
450
381
  if (Array.isArray(workPerformedIdentifierIn)) {
@@ -455,7 +386,7 @@ class MongoRepository {
455
386
  }
456
387
  });
457
388
  }
458
- const videoFormatTypeOfEq = (_20 = (_19 = params.videoFormat) === null || _19 === void 0 ? void 0 : _19.typeOf) === null || _20 === void 0 ? void 0 : _20.$eq;
389
+ const videoFormatTypeOfEq = (_29 = (_28 = params.videoFormat) === null || _28 === void 0 ? void 0 : _28.typeOf) === null || _29 === void 0 ? void 0 : _29.$eq;
459
390
  if (typeof videoFormatTypeOfEq === 'string') {
460
391
  andConditions.push({
461
392
  'videoFormat.typeOf': {
@@ -464,7 +395,7 @@ class MongoRepository {
464
395
  }
465
396
  });
466
397
  }
467
- const videoFormatTypeOfIn = (_22 = (_21 = params.videoFormat) === null || _21 === void 0 ? void 0 : _21.typeOf) === null || _22 === void 0 ? void 0 : _22.$in;
398
+ const videoFormatTypeOfIn = (_31 = (_30 = params.videoFormat) === null || _30 === void 0 ? void 0 : _30.typeOf) === null || _31 === void 0 ? void 0 : _31.$in;
468
399
  if (Array.isArray(videoFormatTypeOfIn)) {
469
400
  andConditions.push({
470
401
  'videoFormat.typeOf': {
@@ -473,7 +404,7 @@ class MongoRepository {
473
404
  }
474
405
  });
475
406
  }
476
- const soundFormatTypeOfEq = (_24 = (_23 = params.soundFormat) === null || _23 === void 0 ? void 0 : _23.typeOf) === null || _24 === void 0 ? void 0 : _24.$eq;
407
+ const soundFormatTypeOfEq = (_33 = (_32 = params.soundFormat) === null || _32 === void 0 ? void 0 : _32.typeOf) === null || _33 === void 0 ? void 0 : _33.$eq;
477
408
  if (typeof soundFormatTypeOfEq === 'string') {
478
409
  andConditions.push({
479
410
  'soundFormat.typeOf': {
@@ -482,7 +413,7 @@ class MongoRepository {
482
413
  }
483
414
  });
484
415
  }
485
- const soundFormatTypeOfIn = (_26 = (_25 = params.soundFormat) === null || _25 === void 0 ? void 0 : _25.typeOf) === null || _26 === void 0 ? void 0 : _26.$in;
416
+ const soundFormatTypeOfIn = (_35 = (_34 = params.soundFormat) === null || _34 === void 0 ? void 0 : _34.typeOf) === null || _35 === void 0 ? void 0 : _35.$in;
486
417
  if (Array.isArray(soundFormatTypeOfIn)) {
487
418
  andConditions.push({
488
419
  'soundFormat.typeOf': {
@@ -618,7 +549,7 @@ class MongoRepository {
618
549
  return __awaiter(this, void 0, void 0, function* () {
619
550
  let doc;
620
551
  const _a = params.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
621
- const id = (params.useOldEventId) ? params.oldEventId : uniqid();
552
+ const id = uniqid();
622
553
  doc = yield this.eventModel.findOneAndUpdate({
623
554
  typeOf: params.attributes.typeOf,
624
555
  // 追加特性をキーに更新
@@ -30,8 +30,8 @@ const schema = new mongoose.Schema({
30
30
  startDate: Date,
31
31
  workPerformed: mongoose.SchemaTypes.Mixed,
32
32
  superEvent: mongoose.SchemaTypes.Mixed,
33
- videoFormat: [mongoose.SchemaTypes.Mixed],
34
- soundFormat: [mongoose.SchemaTypes.Mixed],
33
+ videoFormat: mongoose.SchemaTypes.Mixed,
34
+ soundFormat: mongoose.SchemaTypes.Mixed,
35
35
  subtitleLanguage: mongoose.SchemaTypes.Mixed,
36
36
  dubLanguage: mongoose.SchemaTypes.Mixed,
37
37
  kanaName: String,
@@ -76,4 +76,13 @@ export declare class MongoRepository {
76
76
  $in: string[];
77
77
  };
78
78
  }): Promise<(string)[]>;
79
+ aggregateOrder(params: factory.order.ISearchConditions): Promise<{
80
+ orderCount: number;
81
+ acceptedOfferCount: number;
82
+ avgAcceptedOfferCount: number;
83
+ totalPrice: number;
84
+ maxPrice: number;
85
+ minPrice: number;
86
+ avgPrice: number;
87
+ }[]>;
79
88
  }
@@ -920,5 +920,41 @@ class MongoRepository {
920
920
  return [...new Set(reservationNumbers)];
921
921
  });
922
922
  }
923
+ aggregateOrder(params) {
924
+ var _a, _b;
925
+ return __awaiter(this, void 0, void 0, function* () {
926
+ return this.orderModel.aggregate([
927
+ {
928
+ $match: {
929
+ orderDate: {
930
+ $gte: (_a = params.orderDate) === null || _a === void 0 ? void 0 : _a.$gte,
931
+ $lte: (_b = params.orderDate) === null || _b === void 0 ? void 0 : _b.$lte
932
+ }
933
+ }
934
+ },
935
+ {
936
+ $group: {
937
+ _id: '$typeOf',
938
+ acceptedOfferCount: {
939
+ $sum: {
940
+ $cond: { if: { $isArray: '$acceptedOffers' }, then: { $size: '$acceptedOffers' }, else: 0 }
941
+ }
942
+ },
943
+ avgAcceptedOfferCount: {
944
+ $avg: {
945
+ $cond: { if: { $isArray: '$acceptedOffers' }, then: { $size: '$acceptedOffers' }, else: 0 }
946
+ }
947
+ },
948
+ orderCount: { $sum: 1 },
949
+ totalPrice: { $sum: '$price' },
950
+ maxPrice: { $max: '$price' },
951
+ minPrice: { $min: '$price' },
952
+ avgPrice: { $avg: '$price' }
953
+ }
954
+ }
955
+ ])
956
+ .exec();
957
+ });
958
+ }
923
959
  }
924
960
  exports.MongoRepository = MongoRepository;
@@ -2,6 +2,23 @@ import { Connection } from 'mongoose';
2
2
  import * as factory from '../factory';
3
3
  import { modelName } from './mongoose/model/transaction';
4
4
  export { modelName };
5
+ interface IAggregationByStatus {
6
+ transactionCount: number;
7
+ avgDuration: number;
8
+ maxDuration: number;
9
+ minDuration: number;
10
+ percentilesDuration: {
11
+ name: string;
12
+ value: number;
13
+ }[];
14
+ }
15
+ interface IStatus {
16
+ status: factory.transactionStatusType;
17
+ aggregation: IAggregationByStatus;
18
+ }
19
+ interface IAggregatePlaceOrder {
20
+ statuses: IStatus[];
21
+ }
5
22
  /**
6
23
  * 取引リポジトリ
7
24
  */
@@ -129,4 +146,5 @@ export declare class MongoRepository {
129
146
  findByIdAndDelete(params: {
130
147
  id: string;
131
148
  }): Promise<void>;
149
+ aggregatePlaceOrder(params: factory.transaction.placeOrder.ISearchConditions): Promise<IAggregatePlaceOrder>;
132
150
  }
@@ -600,5 +600,143 @@ class MongoRepository {
600
600
  .exec();
601
601
  });
602
602
  }
603
+ // tslint:disable-next-line:max-func-body-length
604
+ aggregatePlaceOrder(params) {
605
+ return __awaiter(this, void 0, void 0, function* () {
606
+ const statuses = yield Promise.all([
607
+ factory.transactionStatusType.Canceled,
608
+ factory.transactionStatusType.Expired,
609
+ factory.transactionStatusType.Confirmed
610
+ // tslint:disable-next-line:max-func-body-length
611
+ ].map((transactionStatus) => __awaiter(this, void 0, void 0, function* () {
612
+ var _a, _b, _c, _d;
613
+ const matchConditions = {
614
+ 'project.id': Object.assign({}, (typeof ((_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$ne) === 'string')
615
+ ? { $ne: (_d = (_c = params.project) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$ne }
616
+ : undefined),
617
+ startDate: {
618
+ $gte: params.startFrom,
619
+ $lte: params.startThrough
620
+ },
621
+ typeOf: { $eq: params.typeOf },
622
+ status: {
623
+ $in: [transactionStatus]
624
+ }
625
+ };
626
+ const aggregations = yield this.transactionModel.aggregate([
627
+ {
628
+ $match: matchConditions
629
+ },
630
+ {
631
+ $project: {
632
+ duration: {
633
+ $subtract: ['$endDate', '$startDate']
634
+ },
635
+ status: '$status',
636
+ startDate: '$startDate',
637
+ endDate: '$endDate',
638
+ typeOf: '$typeOf'
639
+ }
640
+ },
641
+ {
642
+ $group: {
643
+ _id: '$typeOf',
644
+ transactionCount: { $sum: 1 },
645
+ maxDuration: {
646
+ $max: '$duration'
647
+ },
648
+ minDuration: {
649
+ $min: '$duration'
650
+ },
651
+ avgDuration: {
652
+ $avg: '$duration'
653
+ },
654
+ stdDevDuration: { $stdDevPop: '$duration' }
655
+ }
656
+ },
657
+ {
658
+ $project: {
659
+ _id: 0,
660
+ transactionCount: '$transactionCount',
661
+ avgDuration: '$avgDuration',
662
+ maxDuration: '$maxDuration',
663
+ minDuration: '$minDuration',
664
+ stdDevDuration: '$stdDevDuration'
665
+ }
666
+ }
667
+ ])
668
+ .exec();
669
+ // tslint:disable-next-line:no-magic-numbers
670
+ const percents = [50, 95, 99];
671
+ if (aggregations.length === 0) {
672
+ return {
673
+ status: transactionStatus,
674
+ aggregation: {
675
+ transactionCount: 0,
676
+ avgDuration: 0,
677
+ maxDuration: 0,
678
+ minDuration: 0,
679
+ percentilesDuration: percents.map((percent) => {
680
+ return {
681
+ name: String(percent),
682
+ value: 0
683
+ };
684
+ })
685
+ }
686
+ };
687
+ }
688
+ const ranks4percentile = percents.map((percentile) => {
689
+ return {
690
+ percentile,
691
+ // tslint:disable-next-line:no-magic-numbers
692
+ rank: Math.floor(aggregations[0].transactionCount * percentile / 100)
693
+ };
694
+ });
695
+ const aggregations2 = yield this.transactionModel.aggregate([
696
+ {
697
+ $match: matchConditions
698
+ },
699
+ {
700
+ $project: {
701
+ duration: {
702
+ $subtract: ['$endDate', '$startDate']
703
+ },
704
+ status: '$status',
705
+ startDate: '$startDate',
706
+ endDate: '$endDate',
707
+ typeOf: '$typeOf'
708
+ }
709
+ },
710
+ { $sort: { duration: 1 } },
711
+ {
712
+ $group: {
713
+ _id: '$typeOf',
714
+ durations: { $push: '$duration' }
715
+ }
716
+ },
717
+ {
718
+ $project: {
719
+ _id: 0,
720
+ avgSmallDuration: '$avgSmallDuration',
721
+ avgMediumDuration: '$avgMediumDuration',
722
+ avgLargeDuration: '$avgLargeDuration',
723
+ percentilesDuration: ranks4percentile.map((rank) => {
724
+ return {
725
+ name: String(rank.percentile),
726
+ value: { $arrayElemAt: ['$durations', rank.rank] }
727
+ };
728
+ })
729
+ }
730
+ }
731
+ ])
732
+ .exec();
733
+ return {
734
+ status: transactionStatus,
735
+ aggregation: Object.assign(Object.assign({}, aggregations[0]), aggregations2[0])
736
+ };
737
+ })));
738
+ return { statuses };
739
+ });
740
+ }
603
741
  }
604
742
  exports.MongoRepository = MongoRepository;
@@ -11,13 +11,10 @@ function createPayActions(params) {
11
11
  if (payObject !== undefined) {
12
12
  const maskedCustomer = (0, order_1.createMaskedCustomer)(params.order);
13
13
  const simpleOrder = {
14
- // project: params.order.project,
15
14
  typeOf: params.order.typeOf,
16
15
  seller: params.order.seller,
17
16
  // mask
18
17
  customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
19
- // IOrderへ移行(2022-11-17~)
20
- // confirmationNumber: params.order.confirmationNumber,
21
18
  orderNumber: params.order.orderNumber,
22
19
  price: params.order.price,
23
20
  priceCurrency: params.order.priceCurrency,
@@ -25,13 +25,28 @@ export interface IStartOperationRepos {
25
25
  task: TaskRepo;
26
26
  }
27
27
  export declare type IStartOperation<T> = (repos: IStartOperationRepos) => Promise<T>;
28
- export declare type ICancelOperation<T> = (repos: {
28
+ export interface ICancelRepos {
29
+ action: ActionRepo;
30
+ accountingReport: AccountingReportRepo;
29
31
  assetTransaction: AssetTransactionRepo;
30
- }) => Promise<T>;
31
- export declare type IConfirmOperation<T> = (repos: {
32
+ product: ProductRepo;
33
+ project: ProjectRepo;
34
+ seller: SellerRepo;
35
+ task: TaskRepo;
36
+ }
37
+ export declare type ICancelOperation<T> = (repos: ICancelRepos) => Promise<T>;
38
+ export interface IConfirmRepos {
39
+ action: ActionRepo;
40
+ accountingReport: AccountingReportRepo;
32
41
  assetTransaction: AssetTransactionRepo;
42
+ event: EventRepo;
33
43
  order: OrderRepo;
34
- }) => Promise<T>;
44
+ product: ProductRepo;
45
+ project: ProjectRepo;
46
+ seller: SellerRepo;
47
+ task: TaskRepo;
48
+ }
49
+ export declare type IConfirmOperation<T> = (repos: IConfirmRepos) => Promise<T>;
35
50
  export declare type IExportTasksOperation<T> = (repos: {
36
51
  task: TaskRepo;
37
52
  assetTransaction: AssetTransactionRepo;
@@ -13,6 +13,7 @@ exports.searchGMOTrade = exports.exportTasksById = exports.cancel = exports.conf
13
13
  const moment = require("moment");
14
14
  const factory = require("../../factory");
15
15
  const settings_1 = require("../../settings");
16
+ const payment_1 = require("../payment");
16
17
  const CreditCardPayment = require("../payment/creditCard");
17
18
  const MovieTicketPayment = require("../payment/movieTicket");
18
19
  const PaymentCardPayment = require("../payment/paymentCard");
@@ -307,8 +308,19 @@ function confirm(params) {
307
308
  typeOf: factory.assetTransactionType.Pay,
308
309
  id: transaction.id,
309
310
  result: {},
310
- potentialActions: potentialActions
311
+ // sync対応(2023-01-14~)
312
+ potentialActions: (settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING)
313
+ ? { pay: [] }
314
+ : potentialActions
311
315
  });
316
+ // sync対応(2023-01-14~)
317
+ if (settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
318
+ if (Array.isArray(potentialActions.pay)) {
319
+ for (const payAction of potentialActions.pay) {
320
+ yield (0, payment_1.pay)(payAction)(repos);
321
+ }
322
+ }
323
+ }
312
324
  });
313
325
  }
314
326
  exports.confirm = confirm;
@@ -341,11 +353,23 @@ function fixOrderAsPurpose(params, transaction) {
341
353
  */
342
354
  function cancel(params) {
343
355
  return (repos) => __awaiter(this, void 0, void 0, function* () {
344
- yield repos.assetTransaction.cancel({
356
+ const transaction = yield repos.assetTransaction.cancel({
345
357
  typeOf: factory.assetTransactionType.Pay,
346
358
  id: params.id,
347
359
  transactionNumber: params.transactionNumber
348
360
  });
361
+ // sync対応(2023-01-14~)
362
+ if (settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
363
+ const payTransactionAsObject = {
364
+ project: transaction.project,
365
+ typeOf: transaction.typeOf,
366
+ id: transaction.id,
367
+ transactionNumber: transaction.transactionNumber,
368
+ object: transaction.object,
369
+ recipient: transaction.recipient
370
+ };
371
+ yield (0, payment_1.voidPayment)({ object: payTransactionAsObject })(repos);
372
+ }
349
373
  });
350
374
  }
351
375
  exports.cancel = cancel;
@@ -353,6 +377,7 @@ exports.cancel = cancel;
353
377
  * 取引のタスク出力
354
378
  */
355
379
  function exportTasksById(params) {
380
+ // tslint:disable-next-line:max-func-body-length
356
381
  return (repos) => __awaiter(this, void 0, void 0, function* () {
357
382
  const transaction = yield repos.assetTransaction.findById({
358
383
  typeOf: factory.assetTransactionType.Pay,
@@ -388,42 +413,50 @@ function exportTasksById(params) {
388
413
  .add(params.runsTasksAfterInSeconds, 'seconds')
389
414
  .toDate();
390
415
  }
416
+ const payTransactionAsObject = {
417
+ project: transaction.project,
418
+ typeOf: transaction.typeOf,
419
+ id: transaction.id,
420
+ transactionNumber: transaction.transactionNumber,
421
+ object: transaction.object,
422
+ recipient: transaction.recipient
423
+ };
424
+ const voidPaymentTasks = {
425
+ project: transaction.project,
426
+ name: factory.taskName.VoidPayment,
427
+ status: factory.taskStatus.Ready,
428
+ runsAt: taskRunsAt,
429
+ remainingNumberOfTries: 10,
430
+ numberOfTried: 0,
431
+ executionResults: [],
432
+ data: { object: payTransactionAsObject }
433
+ };
391
434
  switch (transaction.status) {
392
435
  case factory.transactionStatusType.Confirmed:
393
- // tslint:disable-next-line:no-single-line-block-comment
394
- /* istanbul ignore else */
395
- if (potentialActions !== undefined) {
396
- // tslint:disable-next-line:no-single-line-block-comment
397
- /* istanbul ignore else */
398
- if (potentialActions.pay !== undefined) {
399
- const payTasks = potentialActions.pay.map((a) => {
400
- return {
401
- project: transaction.project,
402
- name: factory.taskName.Pay,
403
- status: factory.taskStatus.Ready,
404
- runsAt: taskRunsAt,
405
- remainingNumberOfTries: 10,
406
- numberOfTried: 0,
407
- executionResults: [],
408
- data: a
409
- };
410
- });
411
- taskAttributes.push(...payTasks);
412
- }
436
+ const payActions = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.pay;
437
+ if (Array.isArray(payActions) && payActions.length > 0) {
438
+ const payTasks = payActions.map((a) => {
439
+ return {
440
+ project: transaction.project,
441
+ name: factory.taskName.Pay,
442
+ status: factory.taskStatus.Ready,
443
+ runsAt: taskRunsAt,
444
+ remainingNumberOfTries: 10,
445
+ numberOfTried: 0,
446
+ executionResults: [],
447
+ data: a
448
+ };
449
+ });
450
+ taskAttributes.push(...payTasks);
413
451
  }
414
452
  break;
415
453
  case factory.transactionStatusType.Canceled:
454
+ // sync対応(2023-01-14~)
455
+ if (!settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
456
+ taskAttributes.push(voidPaymentTasks);
457
+ }
458
+ break;
416
459
  case factory.transactionStatusType.Expired:
417
- const voidPaymentTasks = {
418
- project: transaction.project,
419
- name: factory.taskName.VoidPayment,
420
- status: factory.taskStatus.Ready,
421
- runsAt: taskRunsAt,
422
- remainingNumberOfTries: 10,
423
- numberOfTried: 0,
424
- executionResults: [],
425
- data: { object: transaction }
426
- };
427
460
  taskAttributes.push(voidPaymentTasks);
428
461
  break;
429
462
  default:
@@ -51,10 +51,6 @@ export declare function updateEvent4ttts(params: {
51
51
  * 旧イベントID
52
52
  */
53
53
  oldEventId: string;
54
- /**
55
- * 旧IDを使用しない場合、IDは自動発行される
56
- */
57
- useOldEventId: boolean;
58
54
  /**
59
55
  * イベント属性
60
56
  */
@@ -743,8 +743,7 @@ function updateEvent4ttts(params) {
743
743
  try {
744
744
  event = yield repos.event.save4ttts({
745
745
  oldEventId: params.oldEventId,
746
- attributes: params.attributes,
747
- useOldEventId: params.useOldEventId
746
+ attributes: params.attributes
748
747
  });
749
748
  }
750
749
  catch (error) {
@@ -47,7 +47,12 @@ declare function invalidatePaymentUrl(params: factory.task.IData<factory.taskNam
47
47
  */
48
48
  declare function processVoidPayTransaction(params: factory.task.IData<factory.taskName.VoidPayTransaction>): (repos: {
49
49
  action: ActionRepo;
50
+ accountingReport: AccountingReportRepo;
50
51
  assetTransaction: AssetTransactionRepo;
52
+ product: ProductRepo;
53
+ project: ProjectRepo;
54
+ seller: SellerRepo;
55
+ task: TaskRepo;
51
56
  transaction: TransactionRepo;
52
57
  }) => Promise<void>;
53
58
  interface IAuthorizeRepos {
@@ -10,9 +10,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.call = void 0;
13
+ const accountingReport_1 = require("../../repo/accountingReport");
13
14
  const action_1 = require("../../repo/action");
14
15
  const assetTransaction_1 = require("../../repo/assetTransaction");
16
+ const event_1 = require("../../repo/event");
15
17
  const order_1 = require("../../repo/order");
18
+ const product_1 = require("../../repo/product");
19
+ const project_1 = require("../../repo/project");
20
+ const seller_1 = require("../../repo/seller");
21
+ const task_1 = require("../../repo/task");
16
22
  const PayTransactionService = require("../assetTransaction/pay");
17
23
  /**
18
24
  * タスク実行関数
@@ -22,6 +28,12 @@ function call(data) {
22
28
  const actionRepo = new action_1.MongoRepository(settings.connection);
23
29
  const assetTransactionRepo = new assetTransaction_1.MongoRepository(settings.connection);
24
30
  const orderRepo = new order_1.MongoRepository(settings.connection);
31
+ const accountingReportRepo = new accountingReport_1.MongoRepository(settings.connection);
32
+ const eventRepo = new event_1.MongoRepository(settings.connection);
33
+ const productRepo = new product_1.MongoRepository(settings.connection);
34
+ const projectRepo = new project_1.MongoRepository(settings.connection);
35
+ const sellerRepo = new seller_1.MongoRepository(settings.connection);
36
+ const taskRepo = new task_1.MongoRepository(settings.connection);
25
37
  // アクション開始
26
38
  const action = yield actionRepo.start(data);
27
39
  try {
@@ -38,8 +50,15 @@ function call(data) {
38
50
  }
39
51
  }
40
52
  })({
53
+ action: actionRepo,
54
+ accountingReport: accountingReportRepo,
41
55
  assetTransaction: assetTransactionRepo,
42
- order: orderRepo
56
+ event: eventRepo,
57
+ order: orderRepo,
58
+ product: productRepo,
59
+ project: projectRepo,
60
+ seller: sellerRepo,
61
+ task: taskRepo
43
62
  });
44
63
  }
45
64
  }
@@ -24,6 +24,7 @@ export declare type ISettings = factory.project.ISettings & {
24
24
  };
25
25
  export declare const DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD: string;
26
26
  export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
27
+ export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
27
28
  /**
28
29
  * グローバル設定
29
30
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.settings = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = void 0;
3
+ exports.settings = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = void 0;
4
4
  const factory = require("./factory");
5
5
  const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
6
6
  ? process.env.INFORM_TRANSACTION_URL.split(',')
@@ -47,6 +47,7 @@ exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = 7;
47
47
  exports.DEFAULT_SENDER_EMAIL = process.env.DEFAULT_SENDER_EMAIL;
48
48
  exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = String(process.env.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD);
49
49
  exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
50
+ exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
50
51
  /**
51
52
  * グローバル設定
52
53
  */
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.281.0",
12
+ "@chevre/factory": "4.282.0-alpha.0",
13
13
  "@cinerino/sdk": "3.135.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.2.0-alpha.15"
123
+ "version": "20.2.0-alpha.17"
124
124
  }
@@ -1,32 +0,0 @@
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
- async function main() {
10
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
11
-
12
- // const now = new Date();
13
- await chevre.service.aggregation.project.aggregate({
14
- project: { id: project.id },
15
- reservationFor: {
16
- startFrom: moment('2022-01-01T00:00:00+09:00')
17
- .toDate(),
18
- startThrough: moment('2022-01-31T23:59:59+09:00')
19
- .toDate(),
20
- }
21
- })({
22
- project: new chevre.repository.Project(mongoose.connection),
23
- reservation: new chevre.repository.Reservation(mongoose.connection),
24
- task: new chevre.repository.Task(mongoose.connection)
25
- });
26
- }
27
-
28
- main()
29
- .then(() => {
30
- console.log('success!');
31
- })
32
- .catch(console.error);