@chevre/domain 23.0.0-alpha.2 → 23.0.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 (62) hide show
  1. package/example/src/chevre/assetTransaction/processReserve.ts +102 -40
  2. package/example/src/chevre/event/updateSellerMakesOffersByIdentifier.ts +106 -0
  3. package/example/src/chevre/note/findNotes.ts +34 -0
  4. package/example/src/chevre/note/upsertNotesByIdentifier.ts +10 -5
  5. package/example/src/chevre/offerCatalog/updateManyOfferCatalogsByIds.ts +49 -0
  6. package/example/src/chevre/paymentServices/findPaymentServices.ts +37 -0
  7. package/example/src/chevre/product/findHasOfferCatalog.ts +31 -0
  8. package/example/src/chevre/reIndex.ts +1 -3
  9. package/example/src/chevre/roles/addAdminNotePermissionIfNotExists.ts +48 -0
  10. package/example/src/chevre/roles/{addAdminProductOfferPermissionIfNotExists.ts → addAdminPaymentServiceReadPermissionIfNotExists.ts} +20 -19
  11. package/example/src/chevre/roles/addAdminProductHasOfferCatalogReadPermissionIfNotExists.ts +33 -0
  12. package/example/src/chevre/roles/addAdminSellerEventIfNotExists.ts +48 -0
  13. package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +1 -1
  14. package/example/src/chevre/roles/removePermissionIfExists.ts +1 -6
  15. package/example/src/chevre/unsetUnnecessaryFields.ts +5 -7
  16. package/example/src/objectId.ts +12 -0
  17. package/example/src/signPayload.ts +12 -7
  18. package/lib/chevre/errorHandler.d.ts +6 -2
  19. package/lib/chevre/errorHandler.js +18 -2
  20. package/lib/chevre/repo/categoryCode.d.ts +50 -7
  21. package/lib/chevre/repo/categoryCode.js +56 -15
  22. package/lib/chevre/repo/event.d.ts +14 -11
  23. package/lib/chevre/repo/event.js +44 -35
  24. package/lib/chevre/repo/eventSellerMakesOffer.d.ts +24 -39
  25. package/lib/chevre/repo/eventSellerMakesOffer.js +88 -43
  26. package/lib/chevre/repo/mongoose/schemas/eventSeries.d.ts +2 -2
  27. package/lib/chevre/repo/mongoose/schemas/eventSeries.js +5 -14
  28. package/lib/chevre/repo/mongoose/schemas/note.js +9 -0
  29. package/lib/chevre/repo/mongoose/schemas/product.d.ts +4 -4
  30. package/lib/chevre/repo/mongoose/schemas/product.js +2 -2
  31. package/lib/chevre/repo/note.d.ts +2 -9
  32. package/lib/chevre/repo/note.js +52 -18
  33. package/lib/chevre/repo/noteAboutOrder.d.ts +4 -0
  34. package/lib/chevre/repo/noteAboutOrder.js +17 -0
  35. package/lib/chevre/repo/offerCatalog.d.ts +17 -2
  36. package/lib/chevre/repo/offerCatalog.js +5 -2
  37. package/lib/chevre/repo/product.js +15 -14
  38. package/lib/chevre/repo/productHasOfferCatalog.d.ts +43 -0
  39. package/lib/chevre/repo/productHasOfferCatalog.js +71 -0
  40. package/lib/chevre/repository.d.ts +5 -0
  41. package/lib/chevre/repository.js +14 -1
  42. package/lib/chevre/service/assetTransaction/reserve/start.js +2 -2
  43. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +15 -0
  44. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +159 -0
  45. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +16 -0
  46. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +184 -0
  47. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +4 -1
  48. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +25 -138
  49. package/lib/chevre/service/event.js +1 -1
  50. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -3
  51. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +3 -3
  52. package/lib/chevre/service/offer/onEventChanged.js +2 -1
  53. package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +19 -105
  54. package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
  55. package/lib/chevre/service/task/onResourceUpdated.js +1 -1
  56. package/package.json +4 -4
  57. package/example/src/chevre/aggregateEventSellerMakesOffer.ts +0 -32
  58. package/example/src/chevre/searchCategoryCodesByAggregate.ts +0 -31
  59. package/example/src/chevre/searchOfferCatalogItems.ts +0 -59
  60. package/example/src/chevre/searchPaymentServices.ts +0 -32
  61. package/example/src/chevre/unsetUnnecessaryFieldsInAction.ts +0 -50
  62. package/example/src/chevre/unsetUnnecessaryFieldsInTransaction.ts +0 -46
@@ -1,50 +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 DAYS = 365;
8
- async function main() {
9
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
-
11
- const now = new Date();
12
- let updateResult: any;
13
-
14
- const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
15
-
16
- const startIndex = 8760;
17
- // tslint:disable-next-line:no-magic-numbers
18
- const hours = (DAYS * 24) + startIndex;
19
- // tslint:disable-next-line:no-increment-decrement no-magic-numbers
20
- for (let index = startIndex; index < hours; index++) {
21
- // for (let index = 0; index < hours; index++) {
22
- updateResult = await actionRepo.unsetUnnecessaryFields({
23
- filter: {
24
- // _id: { $eq: '667379e7be9a532411c29424' },
25
- typeOf: { $eq: chevre.factory.actionType.CheckAction },
26
- 'object.typeOf': { $exists: true, $eq: chevre.factory.service.paymentService.PaymentServiceType.MovieTicket },
27
- actionStatus: { $eq: chevre.factory.actionStatusType.CompletedActionStatus },
28
- startDate: {
29
- $gte: moment(now)
30
- .add(-(index + 1), 'hours')
31
- .toDate(),
32
- $lt: moment(now)
33
- .add(-index, 'hours')
34
- .toDate()
35
- }
36
- },
37
- $unset: {
38
- 'result.purchaseNumberAuthIn': 1,
39
- 'result.purchaseNumberAuthResult': 1
40
- }
41
- });
42
- console.log('unset processed.', updateResult, -(index + 1), 'hours', -index, 'hours');
43
- }
44
-
45
- console.log(DAYS, 'days processed');
46
- }
47
-
48
- main()
49
- .then()
50
- .catch(console.error);
@@ -1,46 +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 DAYS = 500;
8
- async function main() {
9
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
-
11
- const now = new Date();
12
- let updateResult: any;
13
-
14
- const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
15
-
16
- // tslint:disable-next-line:no-magic-numbers
17
- const hours = DAYS * 24;
18
- // tslint:disable-next-line:no-increment-decrement no-magic-numbers
19
- for (let index = 0; index < hours; index++) {
20
- updateResult = await transactionRepo.unsetUnnecessaryFields({
21
- filter: {
22
- // _id: { $eq: '649a7654ff1c885bcc40bbb7' },
23
- typeOf: { $eq: chevre.factory.transactionType.PlaceOrder },
24
- status: { $eq: chevre.factory.transactionStatusType.Confirmed },
25
- startDate: {
26
- $gte: moment(now)
27
- .add(-(index + 1), 'hours')
28
- .toDate(),
29
- $lt: moment(now)
30
- .add(-index, 'hours')
31
- .toDate()
32
- }
33
- },
34
- $unset: {
35
- 'result.order.acceptedOffers': 1
36
- }
37
- });
38
- console.log('unset processed.', updateResult, -(index + 1), 'hours', -index, 'hours');
39
- }
40
-
41
- console.log(DAYS, 'days processed');
42
- }
43
-
44
- main()
45
- .then()
46
- .catch(console.error);