@chevre/domain 22.3.0-alpha.2 → 22.3.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 (123) hide show
  1. package/example/src/chevre/aggregateScreeningEventMaxVersion.ts +36 -0
  2. package/example/src/chevre/aggregation/createAggregateEventTasks.ts +1 -1
  3. package/example/src/chevre/importEventsFromCOA.ts +6 -3
  4. package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +126 -0
  5. package/example/src/chevre/migrateEventSeries2secondary.ts +70 -0
  6. package/example/src/chevre/projectFields.ts +5 -15
  7. package/example/src/chevre/syncEventSeries2secondary.ts +20 -0
  8. package/example/src/chevre/unsetUnnecessaryFields.ts +6 -6
  9. package/example/src/chevre/upsertScreeningEventSeriesByVersion.ts +2 -2
  10. package/lib/chevre/repo/account.d.ts +25 -1
  11. package/lib/chevre/repo/accountTitle.d.ts +4 -4
  12. package/lib/chevre/repo/accountingReport.d.ts +25 -1
  13. package/lib/chevre/repo/action.d.ts +11 -11
  14. package/lib/chevre/repo/action.js +4 -1
  15. package/lib/chevre/repo/additionalProperty.d.ts +28 -0
  16. package/lib/chevre/repo/additionalProperty.js +6 -0
  17. package/lib/chevre/repo/aggregateOffer.d.ts +26 -2
  18. package/lib/chevre/repo/aggregateReservation.d.ts +25 -1
  19. package/lib/chevre/repo/aggregation.d.ts +26 -2
  20. package/lib/chevre/repo/assetTransaction.d.ts +5 -5
  21. package/lib/chevre/repo/authorization.d.ts +25 -1
  22. package/lib/chevre/repo/categoryCode.d.ts +1 -1
  23. package/lib/chevre/repo/comment.d.ts +3 -3
  24. package/lib/chevre/repo/creativeWork.d.ts +5 -5
  25. package/lib/chevre/repo/creativeWork.js +1 -1
  26. package/lib/chevre/repo/customer.d.ts +16 -10
  27. package/lib/chevre/repo/customer.js +40 -13
  28. package/lib/chevre/repo/event.d.ts +37 -127
  29. package/lib/chevre/repo/event.js +206 -386
  30. package/lib/chevre/repo/eventSeries.d.ts +147 -0
  31. package/lib/chevre/repo/eventSeries.js +664 -0
  32. package/lib/chevre/repo/member.d.ts +4 -4
  33. package/lib/chevre/repo/merchantReturnPolicy.d.ts +3 -3
  34. package/lib/chevre/repo/message.d.ts +25 -1
  35. package/lib/chevre/repo/mongoose/schemas/account.d.ts +1 -1
  36. package/lib/chevre/repo/mongoose/schemas/account.js +29 -13
  37. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +1 -1
  38. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +1 -1
  39. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +17 -12
  40. package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +10 -12
  41. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +1 -1
  42. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +21 -23
  43. package/lib/chevre/repo/mongoose/schemas/event.js +5 -12
  44. package/lib/chevre/repo/mongoose/schemas/eventSeries.d.ts +13 -0
  45. package/lib/chevre/repo/mongoose/schemas/eventSeries.js +219 -0
  46. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +1 -1
  47. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +9 -15
  48. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +1 -1
  49. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +21 -23
  50. package/lib/chevre/repo/mongoose/schemas/place.d.ts +1 -1
  51. package/lib/chevre/repo/mongoose/schemas/place.js +21 -23
  52. package/lib/chevre/repo/mongoose/schemas/productModel.js +6 -14
  53. package/lib/chevre/repo/mongoose/schemas/trip.js +10 -4
  54. package/lib/chevre/repo/note.d.ts +25 -1
  55. package/lib/chevre/repo/offer.d.ts +8 -8
  56. package/lib/chevre/repo/offerCatalog.d.ts +4 -4
  57. package/lib/chevre/repo/offerCatalogItem.d.ts +25 -1
  58. package/lib/chevre/repo/offerItemCondition.d.ts +28 -0
  59. package/lib/chevre/repo/offerItemCondition.js +8 -1
  60. package/lib/chevre/repo/order.d.ts +5 -5
  61. package/lib/chevre/repo/orderInTransaction.d.ts +27 -3
  62. package/lib/chevre/repo/ownershipInfo.d.ts +5 -5
  63. package/lib/chevre/repo/paymentService.d.ts +25 -1
  64. package/lib/chevre/repo/paymentServiceProvider.d.ts +26 -2
  65. package/lib/chevre/repo/place/movieTheater.d.ts +8 -4
  66. package/lib/chevre/repo/place/movieTheater.js +8 -1
  67. package/lib/chevre/repo/priceSpecification.d.ts +4 -4
  68. package/lib/chevre/repo/product.d.ts +4 -4
  69. package/lib/chevre/repo/productModel.d.ts +28 -0
  70. package/lib/chevre/repo/productModel.js +6 -0
  71. package/lib/chevre/repo/productOffer.d.ts +25 -1
  72. package/lib/chevre/repo/project.d.ts +5 -5
  73. package/lib/chevre/repo/reservation.d.ts +5 -5
  74. package/lib/chevre/repo/reservation.js +6 -28
  75. package/lib/chevre/repo/seller.d.ts +5 -5
  76. package/lib/chevre/repo/serviceOutput.d.ts +25 -1
  77. package/lib/chevre/repo/task.d.ts +8 -8
  78. package/lib/chevre/repo/transaction.d.ts +4 -4
  79. package/lib/chevre/repo/trip.d.ts +28 -0
  80. package/lib/chevre/repo/trip.js +6 -0
  81. package/lib/chevre/repository.d.ts +5 -0
  82. package/lib/chevre/repository.js +15 -2
  83. package/lib/chevre/service/aggregation/event/aggregateOffers.js +2 -2
  84. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -3
  85. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
  86. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +2 -0
  87. package/lib/chevre/service/assetTransaction/reserve/start.js +1 -1
  88. package/lib/chevre/service/event/createEvent.d.ts +2 -0
  89. package/lib/chevre/service/event/createEvent.js +1 -1
  90. package/lib/chevre/service/event.d.ts +6 -0
  91. package/lib/chevre/service/event.js +120 -43
  92. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +2 -0
  93. package/lib/chevre/service/offer/event/authorize.d.ts +2 -0
  94. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +3 -0
  95. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +6 -6
  96. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +1 -1
  97. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +1 -1
  98. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -1
  99. package/lib/chevre/service/offer/onEventChanged.d.ts +2 -0
  100. package/lib/chevre/service/offer/onEventChanged.js +31 -4
  101. package/lib/chevre/service/offer.js +1 -1
  102. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +1 -1
  103. package/lib/chevre/service/payment/movieTicket/factory.js +0 -6
  104. package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +1 -1
  105. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +0 -6
  106. package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
  107. package/lib/chevre/service/report/telemetry.js +1 -1
  108. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +1 -1
  109. package/lib/chevre/service/task/createEvent.js +2 -0
  110. package/lib/chevre/service/task/importEventsFromCOA.js +2 -0
  111. package/lib/chevre/service/task/onEventChanged.js +2 -0
  112. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
  113. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +16 -7
  114. package/lib/chevre/service/task/onResourceUpdated.js +2 -0
  115. package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
  116. package/lib/chevre/settings.d.ts +6 -0
  117. package/package.json +6 -6
  118. package/example/src/chevre/createManyEvents.ts +0 -75
  119. package/example/src/chevre/migrateMembers2.ts +0 -74
  120. package/example/src/chevre/projectEventFields.ts +0 -39
  121. package/example/src/chevre/searchAvaialbleAppliesToMovieTicketByOfferCatalogId.ts +0 -45
  122. package/example/src/chevre/searchEventIds.ts +0 -24
  123. package/example/src/chevre/searchScreeningEventSeries.ts +0 -34
@@ -0,0 +1,36 @@
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 eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
12
+ const result = await eventSeriesRepo.aggregateMaxVersion(
13
+ {
14
+ project: {
15
+ id: { $eq: project.id }
16
+ },
17
+ workPerformed: {
18
+ identifier: {
19
+ $eq: '00001'
20
+ }
21
+ },
22
+ location: {
23
+ branchCode: {
24
+ $in: ['118']
25
+ }
26
+ }
27
+ }
28
+ );
29
+ // tslint:disable-next-line:no-null-keyword
30
+ console.dir(result, { depth: null });
31
+ console.log(result);
32
+ }
33
+
34
+ main()
35
+ .then(console.log)
36
+ .catch(console.error);
@@ -15,7 +15,7 @@ async function main() {
15
15
  const events = <Pick<
16
16
  chevre.factory.event.IEvent<chevre.factory.eventType.ScreeningEvent>,
17
17
  'id' | 'typeOf' | 'startDate' | 'project'
18
- >[]>await eventRepo.projectFields<chevre.factory.eventType.ScreeningEvent>(
18
+ >[]>await eventRepo.projectEventFields<chevre.factory.eventType.ScreeningEvent>(
19
19
  {
20
20
  typeOf: chevre.factory.eventType.ScreeningEvent,
21
21
  project: { id: { $eq: PROJECT.id } },
@@ -14,18 +14,19 @@ async function main() {
14
14
  const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
15
15
  const creativeWorkRepo = await chevre.repository.CreativeWork.createInstance(mongoose.connection);
16
16
  const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
17
+ const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
17
18
  const screeningRoomRepo = await chevre.repository.place.ScreeningRoom.createInstance(mongoose.connection);
18
19
  const movieTheaterRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
19
20
  const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
20
21
 
21
22
  const coaAuthClient = new (await chevre.loadCOA()).auth.RefreshToken({
22
- endpoint: '',
23
- refreshToken: '',
23
+ endpoint: String(process.env.COA_ENDPOINT),
24
+ refreshToken: process.env.COA_REFRESH_TOKEN,
24
25
  useFetch: true
25
26
  });
26
27
  const masterService = new (await chevre.loadCOA()).service.Master(
27
28
  {
28
- endpoint: '',
29
+ endpoint: String(process.env.COA_ENDPOINT),
29
30
  auth: coaAuthClient
30
31
  },
31
32
  { timeout: 20000 }
@@ -44,12 +45,14 @@ async function main() {
44
45
  .toDate(),
45
46
  saveMovieTheater: false,
46
47
  saveScreeningEventSeries: false,
48
+ // saveScreeningEventSeries: true,
47
49
  saveScreeningEventSeriesPeriodInMonth: 3
48
50
  })({
49
51
  action: actionRepo,
50
52
  categoryCode: categoryCodeRepo,
51
53
  creativeWork: creativeWorkRepo,
52
54
  event: eventRepo,
55
+ eventSeries: eventSeriesRepo,
53
56
  movieTheater: movieTheaterRepo,
54
57
  screeningRoom: screeningRoomRepo,
55
58
  seller: sellerRepo,
@@ -0,0 +1,126 @@
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
+ // const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
9
+
10
+ // tslint:disable-next-line:max-func-body-length
11
+ async function main() {
12
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
+
14
+ const additionalPropertyRepo = await chevre.repository.AdditionalProperty.createInstance(mongoose.connection);
15
+ const accountTitleRepo = await chevre.repository.AccountTitle.createInstance(mongoose.connection);
16
+
17
+ const cursor = accountTitleRepo.getCursor(
18
+ {
19
+ // 'project.id': { $eq: project.id },
20
+ // 'project.id': { $ne: EXCLUDED_PROJECT_ID },
21
+ },
22
+ {
23
+ // paymentMethods: 1,
24
+ // project: 1,
25
+ // orderDate: 1
26
+ }
27
+ );
28
+ console.log('docs found');
29
+
30
+ const additionalPropertyNames: string[] = [];
31
+ const projectIds: string[] = [];
32
+ const unexpextedprojectIds: string[] = [];
33
+ let checked: number = 0;
34
+ let created: number = 0;
35
+
36
+ let i = 0;
37
+ await cursor.eachAsync(async (doc) => {
38
+ i += 1;
39
+ const accountTitleCategory: chevre.factory.accountTitle.IAccountTitle = doc.toObject();
40
+ const accountTitleSets: Pick<chevre.factory.accountTitle.IAccountTitle, 'additionalProperty' | 'codeValue' | 'typeOf' | 'hasCategoryCode'>[] =
41
+ (Array.isArray(accountTitleCategory.hasCategoryCode))
42
+ ? accountTitleCategory.hasCategoryCode
43
+ : [];
44
+ for (const accountTitleSet of accountTitleSets) {
45
+ const accountTitles: Pick<chevre.factory.accountTitle.IAccountTitle, 'additionalProperty' | 'codeValue' | 'typeOf'>[] =
46
+ (Array.isArray(accountTitleSet.hasCategoryCode))
47
+ ? accountTitleSet.hasCategoryCode
48
+ : [];
49
+ for (const accountTitle of accountTitles) {
50
+ const additionalPropertyNamesOnResource = (Array.isArray(accountTitle.additionalProperty))
51
+ ? accountTitle.additionalProperty?.map((p) => p.name)
52
+ : [];
53
+ if (Array.isArray(additionalPropertyNamesOnResource) && additionalPropertyNamesOnResource.length > 0) {
54
+ console.log(
55
+ additionalPropertyNamesOnResource.join(','),
56
+ additionalPropertyNamesOnResource.length,
57
+ 'additionalPropertyNamesOnResource found',
58
+ accountTitleCategory.project.id,
59
+ accountTitle.codeValue
60
+ );
61
+ additionalPropertyNames.push(...additionalPropertyNamesOnResource);
62
+ projectIds.push(accountTitleCategory.project.id);
63
+ additionalPropertyNamesOnResource.forEach((name) => {
64
+ if (!name.match(/^[a-zA-Z]*$/)) {
65
+ // throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
66
+ unexpextedprojectIds.push(accountTitleCategory.project.id);
67
+ }
68
+ // tslint:disable-next-line:no-magic-numbers
69
+ if (name.length < 5) {
70
+ // throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
71
+ unexpextedprojectIds.push(accountTitleCategory.project.id);
72
+ }
73
+ });
74
+
75
+ for (const additionalPropertyNameOnResource of additionalPropertyNamesOnResource) {
76
+ checked += 1;
77
+ const existingAdditionalProperties = await additionalPropertyRepo.search({
78
+ limit: 1,
79
+ project: { id: { $eq: accountTitleCategory.project.id } },
80
+ codeValue: { $eq: additionalPropertyNameOnResource },
81
+ inCodeSet: { identifier: { $eq: accountTitle.typeOf } }
82
+ });
83
+ if (existingAdditionalProperties.length === 0) {
84
+ const additionalProperty: chevre.factory.additionalProperty.IAdditionalProperty = {
85
+ project: accountTitleCategory.project,
86
+ // id?: string;
87
+ typeOf: 'CategoryCode',
88
+ codeValue: additionalPropertyNameOnResource,
89
+ inCodeSet: {
90
+ typeOf: 'CategoryCodeSet',
91
+ identifier: accountTitle.typeOf
92
+ },
93
+ name: { ja: additionalPropertyNameOnResource }
94
+ };
95
+ await additionalPropertyRepo.save({ attributes: additionalProperty });
96
+ created += 1;
97
+ console.log(
98
+ 'additionalProerty created',
99
+ additionalPropertyNameOnResource,
100
+ accountTitleCategory.project.id,
101
+ accountTitle.codeValue
102
+ );
103
+ } else {
104
+ console.log(
105
+ 'additionalProerty existed',
106
+ additionalPropertyNameOnResource,
107
+ accountTitleCategory.project.id,
108
+ accountTitle.codeValue
109
+ );
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ });
116
+ console.log(i, 'docs checked');
117
+ console.log('additionalPropertyNames:', [...new Set(additionalPropertyNames)]);
118
+ console.log('projectIds:', [...new Set(projectIds)]);
119
+ console.log('unexpextedprojectIds:', [...new Set(unexpextedprojectIds)]);
120
+ console.log('checked:', checked);
121
+ console.log('created:', created);
122
+ }
123
+
124
+ main()
125
+ .then()
126
+ .catch(console.error);
@@ -0,0 +1,70 @@
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
+ // tslint:disable-next-line:max-func-body-length
9
+ async function main() {
10
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
+
12
+ const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
13
+
14
+ const cursor = eventSeriesRepo.getCursor(
15
+ {
16
+ typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries }
17
+ },
18
+ {
19
+ _id: 1,
20
+ startDate: 1,
21
+ project: 1,
22
+ typeOf: 1
23
+ }
24
+ );
25
+ console.log('docs found');
26
+
27
+ let i = 0;
28
+ let updateCount = 0;
29
+ await cursor.eachAsync(async (doc) => {
30
+ i += 1;
31
+ const eventSeries: Pick<chevre.factory.event.screeningEventSeries.IEvent, 'id' | 'startDate' | 'project' | 'typeOf'> =
32
+ doc.toObject();
33
+ const alreadyMigrated = false;
34
+ if (alreadyMigrated) {
35
+ console.log(
36
+ 'already exist.',
37
+ eventSeries.project.id,
38
+ eventSeries.typeOf,
39
+ eventSeries.id,
40
+ eventSeries.startDate, i, updateCount
41
+ );
42
+ } else {
43
+ updateCount += 1;
44
+ console.log(
45
+ 'updating...',
46
+ eventSeries.project.id,
47
+ eventSeries.typeOf,
48
+ eventSeries.id,
49
+ eventSeries.startDate, i, updateCount
50
+ );
51
+ await eventSeriesRepo.sync2secondary({
52
+ id: eventSeries.id
53
+ });
54
+ console.log(
55
+ 'updated.',
56
+ eventSeries.project.id,
57
+ eventSeries.typeOf,
58
+ eventSeries.id,
59
+ eventSeries.startDate, i, updateCount
60
+ );
61
+ }
62
+ });
63
+
64
+ console.log(i, 'docs checked');
65
+ console.log(updateCount, 'docs updated');
66
+ }
67
+
68
+ main()
69
+ .then()
70
+ .catch(console.error);
@@ -12,29 +12,19 @@ mongoose.Model.on('index', (...args) => {
12
12
  async function main() {
13
13
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
14
14
 
15
- const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
15
+ const customerRepo = await chevre.repository.Customer.createInstance(mongoose.connection);
16
16
 
17
- const docs = await actionRepo.search(
17
+ const docs = await customerRepo.projectFields(
18
18
  {
19
19
  limit: 1,
20
- page: 1,
21
- typeOf: { $eq: chevre.factory.actionType.AuthorizeAction }
20
+ page: 1
22
21
  },
23
- ['id', 'typeOf', 'actionStatus'],
24
- ['result', 'cancelAction', 'instrument', 'object']
22
+ ['contactPoint', 'additionalProperty'],
23
+ ['contactPoint', 'additionalProperty']
25
24
  );
26
25
  // tslint:disable-next-line:no-null-keyword
27
26
  console.dir(docs, { depth: null });
28
27
  console.log(docs.length, 'docs found');
29
-
30
- const actions = await actionRepo.searchByOrderNumber(
31
- {
32
- orderNumber: 'CIN9-4893721-9248784'
33
- }
34
- );
35
- // tslint:disable-next-line:no-null-keyword
36
- console.dir(actions, { depth: null });
37
- console.log(actions.length, 'actions found');
38
28
  }
39
29
 
40
30
  main()
@@ -0,0 +1,20 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ async function main() {
7
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
8
+
9
+ const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
10
+
11
+ await eventSeriesRepo.sync2secondary({
12
+ id: '7k9ayl8hc'
13
+ });
14
+ }
15
+
16
+ main()
17
+ .then(() => {
18
+ console.log('success!');
19
+ })
20
+ .catch(console.error);
@@ -6,15 +6,15 @@ import { chevre } from '../../../lib/index';
6
6
  async function main() {
7
7
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
8
8
 
9
- const accountTitleRepo = await chevre.repository.AccountTitle.createInstance(mongoose.connection);
10
- const customerRepo = await chevre.repository.Customer.createInstance(mongoose.connection);
9
+ const creativeWorkRepo = await chevre.repository.CreativeWork.createInstance(mongoose.connection);
10
+ const offerItemConditionRepo = await chevre.repository.OfferItemCondition.createInstance(mongoose.connection);
11
11
 
12
12
  let updateResult: any;
13
- updateResult = await customerRepo.unsetUnnecessaryFields({
13
+ updateResult = await creativeWorkRepo.unsetUnnecessaryFields({
14
14
  filter: {
15
15
  _id: { $exists: true }
16
16
  },
17
- $unset: {
17
+ $unset: <any>{
18
18
  createdAt: 1,
19
19
  updatedAt: 1,
20
20
  __v: 1
@@ -22,11 +22,11 @@ async function main() {
22
22
  });
23
23
  console.log(updateResult);
24
24
 
25
- updateResult = await accountTitleRepo.unsetUnnecessaryFields({
25
+ updateResult = await offerItemConditionRepo.unsetUnnecessaryFields({
26
26
  filter: {
27
27
  _id: { $exists: true }
28
28
  },
29
- $unset: {
29
+ $unset: <any>{
30
30
  createdAt: 1,
31
31
  updatedAt: 1,
32
32
  __v: 1
@@ -10,9 +10,9 @@ const PROJECT_ID = String(process.env.PROJECT_ID);
10
10
  async function main() {
11
11
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
12
 
13
- const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
13
+ const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
14
14
 
15
- const result = await eventRepo.upsertScreeningEventSeriesByVersion(
15
+ const result = await eventSeriesRepo.upsertByVersion(
16
16
  [
17
17
  {
18
18
  $set: {
@@ -1,3 +1,27 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
1
25
  import type { Connection } from 'mongoose';
2
26
  import * as factory from '../factory';
3
27
  /**
@@ -125,5 +149,5 @@ export declare class AccountRepo {
125
149
  unsetUnnecessaryFields(params: {
126
150
  filter: any;
127
151
  $unset: any;
128
- }): Promise<import("mongodb").UpdateResult>;
152
+ }): Promise<import("mongoose").UpdateWriteOpResult>;
129
153
  }
@@ -36,13 +36,13 @@ export declare class AccountTitleRepo {
36
36
  id: string;
37
37
  };
38
38
  }): Promise<void>;
39
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, factory.accountTitle.IAccountTitle> & Omit<factory.accountTitle.IAccountTitle & {
39
+ getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, factory.accountTitle.IAccountTitle> & factory.accountTitle.IAccountTitle & {
40
40
  _id: import("mongoose").Types.ObjectId;
41
- }, never>, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, factory.accountTitle.IAccountTitle> & Omit<factory.accountTitle.IAccountTitle & {
41
+ }, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, factory.accountTitle.IAccountTitle> & factory.accountTitle.IAccountTitle & {
42
42
  _id: import("mongoose").Types.ObjectId;
43
- }, never>>>;
43
+ }>>;
44
44
  unsetUnnecessaryFields(params: {
45
45
  filter: any;
46
46
  $unset: any;
47
- }): Promise<import("mongodb").UpdateResult>;
47
+ }): Promise<import("mongoose").UpdateWriteOpResult>;
48
48
  }
@@ -1,3 +1,27 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
1
25
  import type { Connection, PipelineStage } from 'mongoose';
2
26
  import { IAccountingReport, IChildReport, IOrder4report } from './mongoose/schemas/accountingReport';
3
27
  import * as factory from '../factory';
@@ -44,5 +68,5 @@ export declare class AccountingReportRepo {
44
68
  unsetUnnecessaryFields(params: {
45
69
  filter: any;
46
70
  $unset: any;
47
- }): Promise<import("mongodb").UpdateResult>;
71
+ }): Promise<import("mongoose").UpdateWriteOpResult>;
48
72
  }
@@ -284,8 +284,8 @@ export declare class ActionRepo {
284
284
  } | null>;
285
285
  saveRecipeWithDateCreated(savingRecipe: IRecipeAsDocument & {
286
286
  dateModified: Date;
287
- }): Promise<import("mongodb").UpdateResult>;
288
- saveActionWithEndDate(savingAction: Omit<factory.action.authorize.invoice.IAction, 'id'>): Promise<import("mongodb").UpdateResult>;
287
+ }): Promise<import("mongoose").UpdateWriteOpResult>;
288
+ saveActionWithEndDate(savingAction: Omit<factory.action.authorize.invoice.IAction, 'id'>): Promise<import("mongoose").UpdateWriteOpResult>;
289
289
  findRecipeByAction<T extends factory.recipe.RecipeCategory>(params: {
290
290
  project: {
291
291
  id: string;
@@ -381,6 +381,7 @@ export declare class ActionRepo {
381
381
  location?: any;
382
382
  description?: string | undefined;
383
383
  result?: any;
384
+ toLocation?: any;
384
385
  actionStatus: factory.actionStatusType;
385
386
  endDate?: Date | undefined;
386
387
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
@@ -391,11 +392,10 @@ export declare class ActionRepo {
391
392
  recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
392
393
  sameAs?: import("@chevre/factory/lib/action").ISameAs | undefined;
393
394
  fromLocation?: any;
394
- toLocation?: any;
395
395
  replacer?: any;
396
396
  targetCollection?: any;
397
397
  cancelAction?: any;
398
- }> & Omit<{
398
+ }> & {
399
399
  object: any;
400
400
  error?: any;
401
401
  project: Pick<factory.project.IProject, "id" | "typeOf">;
@@ -404,6 +404,7 @@ export declare class ActionRepo {
404
404
  location?: any;
405
405
  description?: string | undefined;
406
406
  result?: any;
407
+ toLocation?: any;
407
408
  actionStatus: factory.actionStatusType;
408
409
  endDate?: Date | undefined;
409
410
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
@@ -414,13 +415,12 @@ export declare class ActionRepo {
414
415
  recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
415
416
  sameAs?: import("@chevre/factory/lib/action").ISameAs | undefined;
416
417
  fromLocation?: any;
417
- toLocation?: any;
418
418
  replacer?: any;
419
419
  targetCollection?: any;
420
420
  cancelAction?: any;
421
421
  } & {
422
422
  _id: import("mongoose").Types.ObjectId;
423
- }, never>, QueryOptions<import("mongoose").Document<unknown, {}, {
423
+ }, QueryOptions<import("mongoose").Document<unknown, {}, {
424
424
  object: any;
425
425
  error?: any;
426
426
  project: Pick<factory.project.IProject, "id" | "typeOf">;
@@ -429,6 +429,7 @@ export declare class ActionRepo {
429
429
  location?: any;
430
430
  description?: string | undefined;
431
431
  result?: any;
432
+ toLocation?: any;
432
433
  actionStatus: factory.actionStatusType;
433
434
  endDate?: Date | undefined;
434
435
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
@@ -439,11 +440,10 @@ export declare class ActionRepo {
439
440
  recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
440
441
  sameAs?: import("@chevre/factory/lib/action").ISameAs | undefined;
441
442
  fromLocation?: any;
442
- toLocation?: any;
443
443
  replacer?: any;
444
444
  targetCollection?: any;
445
445
  cancelAction?: any;
446
- }> & Omit<{
446
+ }> & {
447
447
  object: any;
448
448
  error?: any;
449
449
  project: Pick<factory.project.IProject, "id" | "typeOf">;
@@ -452,6 +452,7 @@ export declare class ActionRepo {
452
452
  location?: any;
453
453
  description?: string | undefined;
454
454
  result?: any;
455
+ toLocation?: any;
455
456
  actionStatus: factory.actionStatusType;
456
457
  endDate?: Date | undefined;
457
458
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
@@ -462,17 +463,16 @@ export declare class ActionRepo {
462
463
  recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
463
464
  sameAs?: import("@chevre/factory/lib/action").ISameAs | undefined;
464
465
  fromLocation?: any;
465
- toLocation?: any;
466
466
  replacer?: any;
467
467
  targetCollection?: any;
468
468
  cancelAction?: any;
469
469
  } & {
470
470
  _id: import("mongoose").Types.ObjectId;
471
- }, never>>>;
471
+ }>>;
472
472
  unsetUnnecessaryFields(params: {
473
473
  filter: FilterQuery<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>>;
474
474
  $unset: any;
475
- }): Promise<import("mongodb").UpdateResult>;
475
+ }): Promise<import("mongoose").UpdateWriteOpResult>;
476
476
  private agggregateByStatus;
477
477
  private upsertRecipe;
478
478
  }
@@ -1221,7 +1221,10 @@ class ActionRepo {
1221
1221
  return this.actionRecipeModel.findOne({
1222
1222
  'project.id': { $eq: params.project.id },
1223
1223
  'recipeFor.id': { $eq: params.recipeFor.id }
1224
- }, { step: 1, recipeCategory: 1 }, { lean: true })
1224
+ }, { step: 1, recipeCategory: 1 }
1225
+ // { lean: true }
1226
+ )
1227
+ .lean()
1225
1228
  .exec();
1226
1229
  // if (result === null) {
1227
1230
  // throw new factory.errors.NotFound(this.actionRecipeModel.modelName);
@@ -1,3 +1,27 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
1
25
  import type { Connection } from 'mongoose';
2
26
  import * as factory from '../factory';
3
27
  /**
@@ -32,4 +56,8 @@ export declare class AdditionalPropertyRepo {
32
56
  id: string;
33
57
  };
34
58
  }): Promise<void>;
59
+ unsetUnnecessaryFields(params: {
60
+ filter: any;
61
+ $unset: any;
62
+ }): Promise<import("mongoose").UpdateWriteOpResult>;
35
63
  }
@@ -202,5 +202,11 @@ class AdditionalPropertyRepo {
202
202
  .exec();
203
203
  });
204
204
  }
205
+ unsetUnnecessaryFields(params) {
206
+ return __awaiter(this, void 0, void 0, function* () {
207
+ return this.additionalPropertyModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
208
+ .exec();
209
+ });
210
+ }
205
211
  }
206
212
  exports.AdditionalPropertyRepo = AdditionalPropertyRepo;