@chevre/domain 21.18.0-alpha.2 → 21.18.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/example/src/chevre/aggreateOwnershipInfosByOrder.ts +24 -0
  2. package/example/src/chevre/searchAcceptedOfferIds.ts +57 -0
  3. package/example/src/chevre/searchOrderAcceptedOffers.ts +12 -12
  4. package/example/src/chevre/searchOrders.ts +36 -19
  5. package/example/src/chevre/searchReservationsByOrder.ts +30 -0
  6. package/example/src/chevre/searchTransactions.ts +41 -0
  7. package/example/src/chevre/transaction/processReturnOrder.ts +1 -0
  8. package/example/src/chevre/upsertMoviesByIdentifier.ts +57 -0
  9. package/example/src/chevre/upsertScreeningEventSeriesByVersion.ts +141 -0
  10. package/example/src/duration.ts +22 -0
  11. package/lib/chevre/repo/acceptedOffer.d.ts +60 -0
  12. package/lib/chevre/repo/acceptedOffer.js +158 -0
  13. package/lib/chevre/repo/creativeWork.d.ts +5 -1
  14. package/lib/chevre/repo/creativeWork.js +42 -22
  15. package/lib/chevre/repo/event.d.ts +12 -0
  16. package/lib/chevre/repo/event.js +61 -0
  17. package/lib/chevre/repo/offerCatalog.d.ts +8 -2
  18. package/lib/chevre/repo/offerCatalog.js +8 -8
  19. package/lib/chevre/repo/order.d.ts +14 -54
  20. package/lib/chevre/repo/order.js +46 -180
  21. package/lib/chevre/repo/place.js +14 -10
  22. package/lib/chevre/repo/transaction.d.ts +5 -4
  23. package/lib/chevre/repository.d.ts +5 -7
  24. package/lib/chevre/repository.js +14 -17
  25. package/lib/chevre/service/assetTransaction/pay/potentialActions.d.ts +3 -1
  26. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
  27. package/lib/chevre/service/assetTransaction/pay.d.ts +2 -0
  28. package/lib/chevre/service/assetTransaction/pay.js +10 -6
  29. package/lib/chevre/service/delivery/factory.d.ts +3 -1
  30. package/lib/chevre/service/delivery/factory.js +4 -2
  31. package/lib/chevre/service/delivery.d.ts +1 -2
  32. package/lib/chevre/service/delivery.js +1 -3
  33. package/lib/chevre/service/offer/product.d.ts +0 -14
  34. package/lib/chevre/service/offer/product.js +59 -42
  35. package/lib/chevre/service/order/confirmPayTransaction.d.ts +2 -0
  36. package/lib/chevre/service/order/confirmPayTransaction.js +1 -0
  37. package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +3 -1
  38. package/lib/chevre/service/order/createAccountingReportIfNotExist.js +4 -1
  39. package/lib/chevre/service/order/deleteOrder.d.ts +2 -0
  40. package/lib/chevre/service/order/deleteOrder.js +15 -4
  41. package/lib/chevre/service/order/findPlaceOrderTransaction.d.ts +3 -1
  42. package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -2
  43. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +3 -3
  44. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +15 -9
  45. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +11 -0
  46. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.js +54 -0
  47. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.d.ts +10 -0
  48. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +38 -0
  49. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +12 -0
  50. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +111 -0
  51. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +12 -0
  52. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +64 -0
  53. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +10 -0
  54. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +103 -0
  55. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +30 -0
  56. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +227 -0
  57. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +14 -0
  58. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +216 -0
  59. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +10 -0
  60. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +110 -0
  61. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +14 -0
  62. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +164 -0
  63. package/lib/chevre/service/order/onOrderStatusChanged.d.ts +9 -15
  64. package/lib/chevre/service/order/onOrderStatusChanged.js +11 -446
  65. package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +6 -0
  66. package/lib/chevre/service/order/onOrderUpdated/factory.js +45 -0
  67. package/lib/chevre/service/order/onOrderUpdated.js +1 -1
  68. package/lib/chevre/service/order/payOrder.d.ts +2 -2
  69. package/lib/chevre/service/order/placeOrder.d.ts +2 -3
  70. package/lib/chevre/service/order/placeOrder.js +65 -22
  71. package/lib/chevre/service/order/returnOrder.d.ts +2 -2
  72. package/lib/chevre/service/order/returnOrder.js +34 -13
  73. package/lib/chevre/service/order/sendOrder.d.ts +2 -2
  74. package/lib/chevre/service/order/sendOrder.js +19 -6
  75. package/lib/chevre/service/order.d.ts +2 -2
  76. package/lib/chevre/service/order.js +2 -2
  77. package/lib/chevre/service/payment/any.js +1 -1
  78. package/lib/chevre/service/reserve/searchByOrder.d.ts +21 -0
  79. package/lib/chevre/service/reserve/searchByOrder.js +113 -0
  80. package/lib/chevre/service/reserve/verifyToken4reservation.js +0 -11
  81. package/lib/chevre/service/reserve.d.ts +2 -1
  82. package/lib/chevre/service/reserve.js +3 -1
  83. package/lib/chevre/service/task/confirmPayTransaction.js +2 -1
  84. package/lib/chevre/service/task/deleteTransaction.js +2 -0
  85. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +5 -6
  86. package/lib/chevre/service/task/onAuthorizationCreated.js +9 -18
  87. package/lib/chevre/service/task/onOrderPaymentCompleted.js +5 -6
  88. package/lib/chevre/service/task/placeOrder.js +10 -17
  89. package/lib/chevre/service/task/returnOrder.js +10 -17
  90. package/lib/chevre/service/task/sendOrder.js +10 -17
  91. package/lib/chevre/service/task/voidRegisterServiceTransaction.js +3 -7
  92. package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
  93. package/lib/chevre/service/transaction/moneyTransfer.js +3 -4
  94. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -1
  95. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +1 -1
  96. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.d.ts +1 -0
  97. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +3 -3
  98. package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +1 -0
  99. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -1
  100. package/lib/chevre/service/transaction/returnOrder.d.ts +3 -0
  101. package/lib/chevre/service/transaction/returnOrder.js +73 -55
  102. package/package.json +2 -2
  103. package/lib/chevre/repo/action/registerServiceInProgress.d.ts +0 -29
  104. package/lib/chevre/repo/action/registerServiceInProgress.js +0 -58
  105. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +0 -42
  106. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +0 -467
@@ -0,0 +1,24 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ // const project = { id: String(process.env.PROJECT_ID) };
7
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
10
+
11
+ const acceptedOfferRepo = await chevre.repository.AcceptedOffer.createInstance(mongoose.connection);
12
+
13
+ const ownershipInfos = await acceptedOfferRepo.aggreateOwnershipInfosByOrder(
14
+ {
15
+ orderNumber: { $eq: 'CIN4-3943271-4221863' }
16
+ }
17
+ );
18
+ // tslint:disable-next-line:no-null-keyword
19
+ console.dir(ownershipInfos, { depth: 1 });
20
+ }
21
+
22
+ main()
23
+ .then()
24
+ .catch(console.error);
@@ -0,0 +1,57 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ // const project = { id: String(process.env.PROJECT_ID) };
7
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
10
+
11
+ const acceptedOfferRepo = await chevre.repository.AcceptedOffer.createInstance(mongoose.connection);
12
+
13
+ let offerIds: string[];
14
+
15
+ // const searchConditions: chevre.factory.order.ISearchConditions = {
16
+ // limit: 10,
17
+ // page: 1,
18
+ // project: { id: { $eq: project.id } },
19
+ // orderNumbers: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'],
20
+ // acceptedOffers: { itemOffered: { typeOf: { $in: [chevre.factory.reservationType.EventReservation] } } }
21
+ // };
22
+ // let offerIds = await acceptedOfferRepo.__searchAcceptedOfferIds(searchConditions);
23
+ // console.log(offerIds);
24
+ offerIds = await acceptedOfferRepo.distinctValues(
25
+ { orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
26
+ 'acceptedOffers.id'
27
+ );
28
+ console.log(offerIds);
29
+
30
+ const productIds = await acceptedOfferRepo.distinctValues(
31
+ { orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
32
+ 'acceptedOffers.itemOffered.issuedThrough.id'
33
+ );
34
+ console.log(productIds);
35
+
36
+ const locationBranchCodes = await acceptedOfferRepo.distinctValues(
37
+ { orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
38
+ 'acceptedOffers.itemOffered.reservationFor.superEvent.location.branchCode'
39
+ );
40
+ console.log(locationBranchCodes);
41
+
42
+ const offeredThroughIdentifiers = await acceptedOfferRepo.distinctValues(
43
+ { orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
44
+ 'acceptedOffers.offeredThrough.identifier'
45
+ );
46
+ console.log(offeredThroughIdentifiers);
47
+
48
+ const invalidValues = await acceptedOfferRepo.distinctValues(
49
+ { orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
50
+ <any>'invalidValues'
51
+ );
52
+ console.log(invalidValues);
53
+ }
54
+
55
+ main()
56
+ .then()
57
+ .catch(console.error);
@@ -8,19 +8,19 @@ const project = { id: String(process.env.PROJECT_ID) };
8
8
  async function main() {
9
9
  await mongoose.connect(<string>process.env.MONGOLAB_URI);
10
10
 
11
- const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
11
+ const acceptedOfferRepo = await chevre.repository.AcceptedOffer.createInstance(mongoose.connection);
12
12
 
13
- const searchConditions: chevre.factory.order.ISearchConditions = {
14
- // tslint:disable-next-line:no-magic-numbers
15
- limit: 10,
16
- page: 1,
17
- project: { id: { $eq: project.id } },
18
- confirmationNumbers: ['36684'],
19
- orderNumbers: ['CIN1-3743286-2441943'],
20
- acceptedOffers: { itemOffered: { typeOf: { $in: [chevre.factory.reservationType.EventReservation] } } }
21
- // ...(typeof req.seller?.id === 'string') ? { seller: { id: { $eq: req.seller.id } } } : undefined // req.seller.idを考慮
22
- };
23
- const acceptedOffers = await orderRepo.searchAcceptedOffers(searchConditions, ['itemOffered', 'id']);
13
+ const acceptedOffers = await acceptedOfferRepo.searchAcceptedOffersByOrderNumber(
14
+ {
15
+ // tslint:disable-next-line:no-magic-numbers
16
+ limit: 10,
17
+ page: 1,
18
+ project: { id: { $eq: project.id } },
19
+ orderNumber: { $eq: 'CIN3-0760465-8981560' },
20
+ acceptedOffers: { itemOffered: { typeOf: { $in: [chevre.factory.reservationType.EventReservation] } } }
21
+ },
22
+ ['itemOffered', 'id']
23
+ );
24
24
  // tslint:disable-next-line:no-null-keyword
25
25
  console.dir(acceptedOffers, { depth: 1 });
26
26
  const reservationIds = acceptedOffers.map((acceptedOffer) => {
@@ -10,28 +10,45 @@ async function main() {
10
10
 
11
11
  const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
12
12
 
13
- const orders = await orderRepo.search({
14
- limit: 10,
15
- project: { id: { $eq: project.id } },
16
- acceptedOffers: {
17
- // $size: 1
18
- // itemOffered: {
19
- // issuedThrough: { typeOf: { $eq: chevre.factory.product.ProductType.MembershipService } }
13
+ const order = await orderRepo.findByOrderNumber({
14
+ orderNumber: 'CIN4-3943271-4221863',
15
+ project: { id: project.id },
16
+ inclusion: [
17
+ // 'project', 'typeOf', 'orderNumber', 'dateReturned', 'id',
18
+ // 'customer', 'returner', 'seller', 'price', 'priceCurrency', 'orderDate'
19
+ ],
20
+ exclusion: ['acceptedOffers']
21
+ });
22
+ console.log(order);
23
+
24
+ const orders = await orderRepo.search(
25
+ {
26
+ limit: 10,
27
+ project: { id: { $eq: project.id } },
28
+ acceptedOffers: {
29
+ // $size: 1
30
+ // itemOffered: {
31
+ // issuedThrough: { typeOf: { $eq: chevre.factory.product.ProductType.MembershipService } }
32
+ // }
33
+ },
34
+ orderedItem: {
35
+ $size: 3
36
+ }
37
+ // paymentMethods: {
38
+ // paymentMethod: { identifier: { $in: ['Cash'] } }
39
+ // additionalProperty: {
40
+ // $in: [
41
+ // { name: 'orderId', value: '0102022031518442020' },
42
+ // { name: 'orderId', value: '0102022031518423030' }
43
+ // ]
20
44
  // }
45
+ // }
21
46
  },
22
- orderedItem: {
23
- $size: 3
47
+ {
48
+ orderNumber: 1,
49
+ customer: 1
24
50
  }
25
- // paymentMethods: {
26
- // paymentMethod: { identifier: { $in: ['Cash'] } }
27
- // additionalProperty: {
28
- // $in: [
29
- // { name: 'orderId', value: '0102022031518442020' },
30
- // { name: 'orderId', value: '0102022031518423030' }
31
- // ]
32
- // }
33
- // }
34
- });
51
+ );
35
52
  console.log('orders found', orders);
36
53
  console.log(orders.length, 'orders found');
37
54
  }
@@ -0,0 +1,30 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
+
11
+ const { reservations } = await (await chevre.service.reserve.createService()).searchByOrder({
12
+ limit: 10,
13
+ page: 1,
14
+ project: { id: project.id },
15
+ orderNumber: 'CIN3-0760465-8981560',
16
+ // orderNumber: 'SSK1-3743647-5975553',
17
+ // orderNumber: 'SSK9-4864565-8689164',
18
+ typeOf: chevre.factory.reservationType.EventReservation
19
+ })({
20
+ acceptedOffer: await chevre.repository.AcceptedOffer.createInstance(mongoose.connection),
21
+ order: await chevre.repository.Order.createInstance(mongoose.connection),
22
+ reservation: await chevre.repository.Reservation.createInstance(mongoose.connection)
23
+ });
24
+ console.log(reservations);
25
+ console.log(reservations.length, 'reservations found');
26
+ }
27
+
28
+ main()
29
+ .then(console.log)
30
+ .catch(console.error);
@@ -0,0 +1,41 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
+
11
+ const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
12
+
13
+ const transactions = await transactionRepo.search<chevre.factory.transactionType.PlaceOrder>({
14
+ limit: 1,
15
+ page: 1,
16
+ project: { id: { $eq: project.id } },
17
+ typeOf: chevre.factory.transactionType.PlaceOrder,
18
+ statuses: [chevre.factory.transactionStatusType.Confirmed],
19
+ result: {
20
+ order: {
21
+ confirmationNumber: { $eq: '14438' },
22
+ orderNumbers: ['CIN3-0760465-8981560']
23
+ }
24
+ },
25
+ inclusion: ['id'],
26
+ exclusion: []
27
+ });
28
+ console.log('transactions found', transactions);
29
+ console.log(transactions.length, 'transactions found');
30
+
31
+ const transaction = await transactionRepo.findById({
32
+ typeOf: chevre.factory.transactionType.PlaceOrder,
33
+ id: '6570f9d7834f9638ceec86ad',
34
+ inclusion: ['_id', 'typeOf', 'status']
35
+ });
36
+ console.log('transaction found', transaction);
37
+ }
38
+
39
+ main()
40
+ .then()
41
+ .catch(console.error);
@@ -23,6 +23,7 @@ async function main() {
23
23
  id: 'xxx'
24
24
  }
25
25
  })({
26
+ acceptedOffer: await chevre.repository.AcceptedOffer.createInstance(mongoose.connection),
26
27
  event: await chevre.repository.Event.createInstance(mongoose.connection),
27
28
  merchantReturnPolicy: await chevre.repository.MerchantReturnPolicy.createInstance(mongoose.connection),
28
29
  offer: await chevre.repository.Offer.createInstance(mongoose.connection),
@@ -0,0 +1,57 @@
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, { autoIndex: false });
11
+
12
+ const creativeWorkRepo = await chevre.repository.CreativeWork.createInstance(mongoose.connection);
13
+
14
+ const result = await creativeWorkRepo.upsertMoviesByIdentifier(
15
+ [
16
+ {
17
+ attributes: {
18
+ id: '',
19
+ identifier: '00001',
20
+ typeOf: chevre.factory.creativeWorkType.Movie,
21
+ duration: 'PT2H',
22
+ name: { ja: '名探偵コナン ゼロの執行人', en: 'Detective Conan Zero Enforcer' },
23
+ offers: {
24
+ typeOf: chevre.factory.offerType.Offer,
25
+ availabilityEnds: moment('2118-11-04T15:00:00.000Z')
26
+ .toDate(),
27
+ availabilityStarts: moment('2018-11-25T15:00:00.000Z')
28
+ .toDate()
29
+ },
30
+ project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
31
+ additionalProperty: [
32
+ {
33
+ name: 'posterImage',
34
+ value: 'https://iwiz-movies.c.yimg.jp/c/movies/pict/p/p/90/cb/174755_02.jpg'
35
+ }
36
+ ],
37
+ headline: 'サブタイトルサブタイトルサブタイトル',
38
+ datePublished: moment('2018-11-04T15:00:00.000Z')
39
+ .toDate(),
40
+ distributor: {
41
+ id: '5e35398a8067a30012dd6717',
42
+ codeValue: '001',
43
+ ...{
44
+ distributorType: '001'
45
+ }
46
+ }
47
+ }
48
+ }
49
+ ],
50
+ { replace: true }
51
+ );
52
+ console.log('result:', result);
53
+ }
54
+
55
+ main()
56
+ .then(console.log)
57
+ .catch(console.error);
@@ -0,0 +1,141 @@
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
+ // tslint:disable-next-line:max-func-body-length
10
+ async function main() {
11
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
+
13
+ const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
14
+
15
+ const result = await eventRepo.upsertScreeningEventSeriesByVersion(
16
+ [
17
+ {
18
+ attributes: {
19
+ eventStatus: chevre.factory.eventStatusType.EventScheduled,
20
+ videoFormat: [],
21
+ soundFormat: [],
22
+ kanaName: '',
23
+ startDate: moment('2023-12-08T15:00:00Z')
24
+ .toDate(),
25
+ endDate: moment('2123-12-08T15:00:00Z')
26
+ .toDate(),
27
+ typeOf: chevre.factory.eventType.ScreeningEventSeries,
28
+ duration: 'PT2H',
29
+ name: { ja: '名探偵コナン ゼロの執行人', en: 'Detective Conan Zero Enforcer' },
30
+ offers: {
31
+ typeOf: chevre.factory.offerType.Offer
32
+ },
33
+ project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
34
+ additionalProperty: [
35
+ ],
36
+ location: {
37
+ branchCode: '118',
38
+ id: '5bfb841d5a78d7948369979a',
39
+ kanaName: 'シネモーションアカサカ',
40
+ name: { ja: 'シネモーション赤坂 ', en: 'CineMotion Akasaka' },
41
+ typeOf: chevre.factory.placeType.MovieTheater
42
+ },
43
+ workPerformed: {
44
+ typeOf: chevre.factory.creativeWorkType.Movie,
45
+ id: '5bfb841d5a78d79483699801',
46
+ identifier: '071953',
47
+ name: {
48
+ ja: '男はつらいよ 純情篇'
49
+ },
50
+ duration: 'PT1H29M',
51
+ version: '2'
52
+ },
53
+ organizer: { id: '59d20831e53ebc2b4e774466' }
54
+ }
55
+ },
56
+ {
57
+ attributes: {
58
+ eventStatus: chevre.factory.eventStatusType.EventScheduled,
59
+ videoFormat: [],
60
+ soundFormat: [],
61
+ kanaName: '',
62
+ startDate: moment('2023-12-08T15:00:00Z')
63
+ .toDate(),
64
+ endDate: moment('2123-12-08T15:00:00Z')
65
+ .toDate(),
66
+ typeOf: chevre.factory.eventType.ScreeningEventSeries,
67
+ duration: 'PT2H',
68
+ name: { ja: '名探偵コナン ゼロの執行人', en: 'Detective Conan Zero Enforcer' },
69
+ offers: {
70
+ typeOf: chevre.factory.offerType.Offer
71
+ },
72
+ project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
73
+ additionalProperty: [
74
+ ],
75
+ location: {
76
+ branchCode: '118',
77
+ id: '5bfb841d5a78d7948369979a',
78
+ kanaName: 'シネモーションアカサカ',
79
+ name: { ja: 'シネモーション赤坂 ', en: 'CineMotion Akasaka' },
80
+ typeOf: chevre.factory.placeType.MovieTheater
81
+ },
82
+ workPerformed: {
83
+ typeOf: chevre.factory.creativeWorkType.Movie,
84
+ id: '5bfb841d5a78d79483699801',
85
+ identifier: '071953',
86
+ name: {
87
+ ja: '男はつらいよ 純情篇'
88
+ },
89
+ duration: 'PT1H29M',
90
+ version: '3'
91
+ },
92
+ organizer: { id: '59d20831e53ebc2b4e774466' }
93
+ }
94
+ },
95
+ {
96
+ attributes: {
97
+ eventStatus: chevre.factory.eventStatusType.EventScheduled,
98
+ videoFormat: [],
99
+ soundFormat: [],
100
+ kanaName: '',
101
+ startDate: moment('2023-12-08T15:00:00Z')
102
+ .toDate(),
103
+ endDate: moment('2123-12-08T15:00:00Z')
104
+ .toDate(),
105
+ typeOf: chevre.factory.eventType.ScreeningEventSeries,
106
+ duration: 'PT2H',
107
+ name: { ja: '名探偵コナン ゼロの執行人', en: 'Detective Conan Zero Enforcer' },
108
+ offers: {
109
+ typeOf: chevre.factory.offerType.Offer
110
+ },
111
+ project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
112
+ additionalProperty: [
113
+ ],
114
+ location: {
115
+ branchCode: '118',
116
+ id: '5bfb841d5a78d7948369979a',
117
+ kanaName: 'シネモーションアカサカ',
118
+ name: { ja: 'シネモーション赤坂 ', en: 'CineMotion Akasaka' },
119
+ typeOf: chevre.factory.placeType.MovieTheater
120
+ },
121
+ workPerformed: {
122
+ typeOf: chevre.factory.creativeWorkType.Movie,
123
+ id: '5bfb841d5a78d79483699801',
124
+ identifier: '071953',
125
+ name: {
126
+ ja: '男はつらいよ 純情篇'
127
+ },
128
+ duration: 'PT1H29M',
129
+ version: '4'
130
+ },
131
+ organizer: { id: '59d20831e53ebc2b4e774466' }
132
+ }
133
+ }
134
+ ]
135
+ );
136
+ console.log('result:', result);
137
+ }
138
+
139
+ main()
140
+ .then(console.log)
141
+ .catch(console.error);
@@ -0,0 +1,22 @@
1
+ // tslint:disable:no-console
2
+ import * as moment from 'moment';
3
+
4
+ const MINUTES = 10;
5
+
6
+ async function main() {
7
+ const duration = moment.duration(MINUTES, 'minutes');
8
+ const newDuration = moment.duration(duration.toISOString());
9
+ console.log(duration);
10
+ console.log(newDuration);
11
+ console.log(duration.toISOString());
12
+ console.log(newDuration.toISOString());
13
+ console.log(newDuration.isValid());
14
+ console.log(moment.duration('invalid')
15
+ .isValid());
16
+ }
17
+
18
+ main()
19
+ .then(() => {
20
+ console.log('success!');
21
+ })
22
+ .catch(console.error);
@@ -0,0 +1,60 @@
1
+ import type { Connection } from 'mongoose';
2
+ import * as factory from '../factory';
3
+ type IProjection4searchWithUnwoundAcceptedOffers = {
4
+ [key in keyof factory.order.IOrder]?: 1;
5
+ } & {
6
+ _id?: 0 | 1;
7
+ };
8
+ type IDistinctField = 'acceptedOffers.id' | 'acceptedOffers.itemOffered.reservationNumber' | 'acceptedOffers.itemOffered.reservationFor.id' | 'acceptedOffers.itemOffered.issuedThrough.id' | 'acceptedOffers.offeredThrough.identifier' | 'acceptedOffers.itemOffered.reservationFor.superEvent.location.branchCode';
9
+ /**
10
+ * 注文オファーリポジトリ
11
+ */
12
+ export declare class MongoRepository {
13
+ private readonly orderModel;
14
+ constructor(connection: Connection);
15
+ /**
16
+ * オファー展開の注文検索
17
+ */
18
+ searchWithUnwoundAcceptedOffers(params: factory.order.ISearchConditions, projection?: IProjection4searchWithUnwoundAcceptedOffers): Promise<factory.order.IOrder[]>;
19
+ aggreateOwnershipInfosByOrder(filter: {
20
+ orderNumber: {
21
+ $eq: string;
22
+ };
23
+ }): Promise<{
24
+ identifier: string;
25
+ }[]>;
26
+ /**
27
+ * 注文オファーを展開して検索する
28
+ */
29
+ searchAcceptedOffersByOrderNumber(filter: {
30
+ limit?: number;
31
+ page?: number;
32
+ orderNumber: {
33
+ $eq: string;
34
+ };
35
+ project: {
36
+ id: {
37
+ $eq: string;
38
+ };
39
+ };
40
+ /**
41
+ * アイテムタイプで絞る場合
42
+ */
43
+ acceptedOffers?: {
44
+ itemOffered?: {
45
+ typeOf?: {
46
+ $in?: string[];
47
+ };
48
+ };
49
+ };
50
+ }, inclusion?: (keyof factory.order.IAcceptedOffer<factory.order.IItemOffered>)[]): Promise<factory.order.IAcceptedOffer<factory.order.IItemOffered>[]>;
51
+ /**
52
+ * 特定のフィールド値リストを検索する
53
+ */
54
+ distinctValues(filter: {
55
+ orderNumber: {
56
+ $in: string[];
57
+ };
58
+ }, field: IDistinctField): Promise<string[]>;
59
+ }
60
+ export {};