@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.
- package/example/src/chevre/assetTransaction/processReserve.ts +102 -40
- package/example/src/chevre/event/updateSellerMakesOffersByIdentifier.ts +106 -0
- package/example/src/chevre/note/findNotes.ts +34 -0
- package/example/src/chevre/note/upsertNotesByIdentifier.ts +10 -5
- package/example/src/chevre/offerCatalog/updateManyOfferCatalogsByIds.ts +49 -0
- package/example/src/chevre/paymentServices/findPaymentServices.ts +37 -0
- package/example/src/chevre/product/findHasOfferCatalog.ts +31 -0
- package/example/src/chevre/reIndex.ts +1 -3
- package/example/src/chevre/roles/addAdminNotePermissionIfNotExists.ts +48 -0
- package/example/src/chevre/roles/{addAdminProductOfferPermissionIfNotExists.ts → addAdminPaymentServiceReadPermissionIfNotExists.ts} +20 -19
- package/example/src/chevre/roles/addAdminProductHasOfferCatalogReadPermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminSellerEventIfNotExists.ts +48 -0
- package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +1 -1
- package/example/src/chevre/roles/removePermissionIfExists.ts +1 -6
- package/example/src/chevre/unsetUnnecessaryFields.ts +5 -7
- package/example/src/objectId.ts +12 -0
- package/example/src/signPayload.ts +12 -7
- package/lib/chevre/errorHandler.d.ts +6 -2
- package/lib/chevre/errorHandler.js +18 -2
- package/lib/chevre/repo/categoryCode.d.ts +50 -7
- package/lib/chevre/repo/categoryCode.js +56 -15
- package/lib/chevre/repo/event.d.ts +14 -11
- package/lib/chevre/repo/event.js +44 -35
- package/lib/chevre/repo/eventSellerMakesOffer.d.ts +24 -39
- package/lib/chevre/repo/eventSellerMakesOffer.js +88 -43
- package/lib/chevre/repo/mongoose/schemas/eventSeries.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/eventSeries.js +5 -14
- package/lib/chevre/repo/mongoose/schemas/note.js +9 -0
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +4 -4
- package/lib/chevre/repo/mongoose/schemas/product.js +2 -2
- package/lib/chevre/repo/note.d.ts +2 -9
- package/lib/chevre/repo/note.js +52 -18
- package/lib/chevre/repo/noteAboutOrder.d.ts +4 -0
- package/lib/chevre/repo/noteAboutOrder.js +17 -0
- package/lib/chevre/repo/offerCatalog.d.ts +17 -2
- package/lib/chevre/repo/offerCatalog.js +5 -2
- package/lib/chevre/repo/product.js +15 -14
- package/lib/chevre/repo/productHasOfferCatalog.d.ts +43 -0
- package/lib/chevre/repo/productHasOfferCatalog.js +71 -0
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +14 -1
- package/lib/chevre/service/assetTransaction/reserve/start.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +15 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +159 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +16 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +184 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +4 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +25 -138
- package/lib/chevre/service/event.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +3 -3
- package/lib/chevre/service/offer/onEventChanged.js +2 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +19 -105
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +1 -1
- package/package.json +4 -4
- package/example/src/chevre/aggregateEventSellerMakesOffer.ts +0 -32
- package/example/src/chevre/searchCategoryCodesByAggregate.ts +0 -31
- package/example/src/chevre/searchOfferCatalogItems.ts +0 -59
- package/example/src/chevre/searchPaymentServices.ts +0 -32
- package/example/src/chevre/unsetUnnecessaryFieldsInAction.ts +0 -50
- 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);
|