@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.
Files changed (65) hide show
  1. package/example/src/chevre/aggregateEventReservation.ts +1 -1
  2. package/example/src/chevre/createManyEventsIfNotExist.ts +10 -10
  3. package/example/src/chevre/deleteMovieTicketCategoryChargePriceSpecs.ts +21 -0
  4. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +96 -0
  5. package/example/src/chevre/searchEventTicketOffers.ts +7 -4
  6. package/example/src/chevre/searchOffersByCatalog.ts +2 -1
  7. package/example/src/chevre/unsetUnnecessaryFields.ts +21 -0
  8. package/lib/chevre/repo/account.d.ts +4 -10
  9. package/lib/chevre/repo/account.js +72 -60
  10. package/lib/chevre/repo/assetTransaction.d.ts +1 -0
  11. package/lib/chevre/repo/assetTransaction.js +5 -0
  12. package/lib/chevre/repo/event.d.ts +5 -4
  13. package/lib/chevre/repo/event.js +12 -30
  14. package/lib/chevre/repo/mongoose/model/comments.d.ts +1 -1
  15. package/lib/chevre/repo/mongoose/model/comments.js +1 -1
  16. package/lib/chevre/repo/mongoose/model/offer.js +12 -0
  17. package/lib/chevre/repo/offer.d.ts +17 -2
  18. package/lib/chevre/repo/offer.js +77 -44
  19. package/lib/chevre/repo/priceSpecification.d.ts +10 -0
  20. package/lib/chevre/repo/priceSpecification.js +9 -0
  21. package/lib/chevre/repo/serviceOutput.d.ts +4 -0
  22. package/lib/chevre/repo/serviceOutput.js +6 -0
  23. package/lib/chevre/repository.d.ts +6 -0
  24. package/lib/chevre/repository.js +8 -1
  25. package/lib/chevre/service/account.d.ts +0 -8
  26. package/lib/chevre/service/account.js +16 -10
  27. package/lib/chevre/service/accountTransaction/deposit.js +2 -1
  28. package/lib/chevre/service/accountTransaction/factory.js +25 -20
  29. package/lib/chevre/service/accountTransaction/transfer.js +4 -2
  30. package/lib/chevre/service/accountTransaction/withdraw.js +2 -1
  31. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +46 -83
  32. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +3 -1
  33. package/lib/chevre/service/assetTransaction/moneyTransfer.js +19 -11
  34. package/lib/chevre/service/assetTransaction/pay.js +19 -14
  35. package/lib/chevre/service/assetTransaction/registerService/factory.js +9 -4
  36. package/lib/chevre/service/assetTransaction/reserve.js +2 -0
  37. package/lib/chevre/service/delivery.js +12 -3
  38. package/lib/chevre/service/event.js +3 -23
  39. package/lib/chevre/service/moneyTransfer.d.ts +1 -1
  40. package/lib/chevre/service/moneyTransfer.js +7 -8
  41. package/lib/chevre/service/offer/event/authorize.js +2 -1
  42. package/lib/chevre/service/offer/event/factory.js +1 -1
  43. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +6 -6
  44. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +106 -91
  45. package/lib/chevre/service/offer/factory.d.ts +4 -1
  46. package/lib/chevre/service/offer/factory.js +57 -26
  47. package/lib/chevre/service/offer/moneyTransfer/authorize.js +0 -1
  48. package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +0 -1
  49. package/lib/chevre/service/offer/product/searchProductOffers.js +5 -1
  50. package/lib/chevre/service/payment/any/factory.js +29 -2
  51. package/lib/chevre/service/payment/any.js +11 -4
  52. package/lib/chevre/service/payment/movieTicket.d.ts +7 -2
  53. package/lib/chevre/service/payment/movieTicket.js +17 -8
  54. package/lib/chevre/service/payment/paymentCard.d.ts +6 -2
  55. package/lib/chevre/service/payment/paymentCard.js +16 -8
  56. package/lib/chevre/service/permit.d.ts +5 -1
  57. package/lib/chevre/service/permit.js +18 -11
  58. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +25 -53
  59. package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
  60. package/lib/chevre/settings.d.ts +6 -0
  61. package/lib/chevre/settings.js +8 -2
  62. package/package.json +3 -3
  63. package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +0 -157
  64. package/example/src/chevre/migrateProjectSubscription.ts +0 -51
  65. package/example/src/chevre/migrateSection.ts +0 -105
@@ -1,105 +0,0 @@
1
- // tslint:disable:no-console no-magic-numbers
2
- // import * as moment from 'moment';
3
- import * as mongoose from 'mongoose';
4
- import * as redis from 'redis';
5
-
6
- import { chevre } from '../../../lib/index';
7
-
8
- async function main() {
9
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
10
-
11
- const client = redis.createClient({
12
- host: <string>process.env.REDIS_HOST,
13
- port: Number(process.env.REDIS_PORT),
14
- password: <string>process.env.REDIS_KEY
15
- });
16
-
17
- const eventRepo = new chevre.repository.Event(mongoose.connection);
18
-
19
- const events = await eventRepo.search({
20
- typeOf: chevre.factory.eventType.ScreeningEvent,
21
- project: { id: { $eq: '' } },
22
- startFrom: new Date()
23
- // startThrough: moment().add(4, 'day').toDate()
24
- });
25
- console.log(events.length, 'events found');
26
-
27
- const sectionCode = 'Default';
28
- await Promise.all(events.map(async (event) => {
29
- await new Promise<void>((resolve) => {
30
- const key = `chevre:itemAvailability:screeningEvent:${event.id}`;
31
- client.hgetall(key, async (__, reply) => {
32
- if (reply !== null && Object.keys(reply).length > 0) {
33
-
34
- const fieldAndValues = reply;
35
- for (const field of Object.keys(fieldAndValues)) {
36
- // セクションがなければキーを更新
37
- if (field.slice(0, 7) !== sectionCode) {
38
- console.log(event.id, field);
39
- const newField = `${sectionCode}${field}`;
40
- const newValue = fieldAndValues[field];
41
- console.log('saving...', newField, newValue);
42
-
43
- await new Promise<void>((resolveSet) => {
44
- client.hsetnx(key, newField, newValue, (___, setReply) => {
45
- console.log('set', setReply, newField, newValue);
46
-
47
- resolveSet();
48
- });
49
- });
50
-
51
- // 元のフィールドを削除
52
- await new Promise<void>((resolveSet) => {
53
- client.hdel(key, field, (___, setReply) => {
54
- console.log('deleted', setReply, field);
55
-
56
- resolveSet();
57
- });
58
- });
59
- }
60
- }
61
- }
62
-
63
- resolve();
64
- // if (err !== null) {
65
- // reject(err);
66
- // } else {
67
- // if (reply !== null) {
68
- // client.ttl(targetKey, (ttlErr, ttl) => {
69
- // console.log('ttl:', ttl);
70
- // const args = Object.keys(reply)
71
- // .reduce(
72
- // (a, b) => {
73
- // return [...a, b, reply[b]];
74
- // },
75
- // []
76
- // );
77
- // console.log(args.length, 'args ready');
78
-
79
- // newClient.multi()
80
- // .hmset(newKey, ...args)
81
- // .expire(newKey, ttl)
82
- // .exec((hmsetErr, reply) => {
83
- // console.log('hmset result:', hmsetErr, reply);
84
- // resolve();
85
- // });
86
- // });
87
- // } else {
88
- // console.error('targetKey not found');
89
- // }
90
- // }
91
- });
92
- });
93
- }));
94
-
95
- // client.keys('chevre:itemAvailability:screeningEvent:*', async (err, reply) => {
96
- // console.log(err, reply.length, 'keys found');
97
- // const targetKeys = reply;
98
-
99
- // });
100
-
101
- }
102
-
103
- main()
104
- .then(console.log)
105
- .catch(console.error);