@chevre/domain 22.5.0-alpha.2 → 22.5.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.
- package/example/src/chevre/aggregateEventPublicFields.ts +46 -0
- package/example/src/chevre/aggregateEventSellerMakesOffer.ts +32 -0
- package/example/src/chevre/findReservationByCode.ts +11 -10
- package/example/src/chevre/migrateEventSellerMakesOfferAvailableAt.ts +98 -0
- package/example/src/chevre/projectFields.ts +3 -3
- package/example/src/chevre/searchEventHasOfferCatalog.ts +43 -0
- package/example/src/chevre/searchOfferCatalogItemListElement.ts +26 -0
- package/example/src/chevre/searchOfferCatalogItems.ts +3 -2
- package/example/src/chevre/searchProjects.ts +2 -4
- package/example/src/chevre/unsetUnnecessaryFields.ts +5 -20
- package/example/src/chevre/upsertManyEventsByAdditionalProperty.ts +4 -4
- package/example/src/chevre/upsertProductsByProductId.ts +1 -1
- package/lib/chevre/repo/event.d.ts +15 -1
- package/lib/chevre/repo/event.js +138 -56
- package/lib/chevre/repo/eventSellerMakesOffer.d.ts +54 -0
- package/lib/chevre/repo/eventSellerMakesOffer.js +73 -0
- package/lib/chevre/repo/mongoose/schemas/event.js +9 -9
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +1 -1
- package/lib/chevre/repo/offer.js +0 -3
- package/lib/chevre/repo/offerCatalog.d.ts +19 -2
- package/lib/chevre/repo/offerCatalog.js +70 -22
- package/lib/chevre/repo/offerCatalogItem.d.ts +3 -6
- package/lib/chevre/repo/offerCatalogItem.js +84 -45
- package/lib/chevre/repo/product.d.ts +16 -3
- package/lib/chevre/repo/product.js +29 -0
- package/lib/chevre/repo/project.d.ts +1 -2
- package/lib/chevre/repo/project.js +11 -25
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -2
- package/lib/chevre/service/aggregation/project.js +2 -2
- package/lib/chevre/service/assetTransaction/cancelReservation.js +4 -4
- package/lib/chevre/service/assetTransaction/registerService.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +9 -8
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +4 -1
- package/lib/chevre/service/moneyTransfer.js +2 -2
- package/lib/chevre/service/notification.js +2 -2
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +2 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize.js +25 -8
- package/lib/chevre/service/offer/event/checkAvailability.d.ts +10 -0
- package/lib/chevre/service/offer/event/checkAvailability.js +48 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +3 -89
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +43 -356
- package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.d.ts +38 -0
- package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +97 -0
- package/lib/chevre/service/offer/event/searchOfferCatalogItemAvailability.d.ts +48 -0
- package/lib/chevre/service/offer/event/searchOfferCatalogItemAvailability.js +109 -0
- package/lib/chevre/service/offer/event/searchOfferCatalogItems.d.ts +38 -0
- package/lib/chevre/service/offer/event/searchOfferCatalogItems.js +95 -0
- package/lib/chevre/service/offer/event/searchOffersByIds.d.ts +57 -0
- package/lib/chevre/service/offer/event/searchOffersByIds.js +238 -0
- package/lib/chevre/service/offer/event/searchPriceSpecs4event.d.ts +19 -0
- package/lib/chevre/service/offer/event/searchPriceSpecs4event.js +69 -0
- package/lib/chevre/service/offer/event.d.ts +4 -1
- package/lib/chevre/service/offer/event.js +6 -3
- package/lib/chevre/service/offer/onEventChanged.js +9 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +10 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +0 -3
- package/lib/chevre/service/reserve/useReservation.d.ts +1 -1
- package/lib/chevre/service/reserve/useReservation.js +4 -4
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +0 -7
- package/lib/chevre/service/reserve/verifyToken4reservation.js +17 -12
- package/lib/chevre/service/task/deletePerson.d.ts +6 -0
- package/lib/chevre/service/task/deletePerson.js +421 -0
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +2 -2
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +2 -2
- package/lib/chevre/service/task.js +1 -0
- package/lib/chevre/service/transaction/returnOrder/preStart.js +2 -2
- package/package.json +5 -7
- package/example/src/chevre/migrateProductHasOfferCatalog.ts +0 -80
- package/example/src/chevre/migrateProjectMakesOffer.ts +0 -78
- package/example/src/chevre/offerCatalog2offerCatalogItem.ts +0 -161
|
@@ -0,0 +1,46 @@
|
|
|
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 eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
13
|
+
const result = await eventRepo.aggregatePublicFields<chevre.factory.eventType.ScreeningEvent>(
|
|
14
|
+
{
|
|
15
|
+
limit: 10,
|
|
16
|
+
page: 1,
|
|
17
|
+
sort: { startDate: chevre.factory.sortType.Ascending },
|
|
18
|
+
// id: { $eq: 'bm0f0cadu' },
|
|
19
|
+
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
20
|
+
project: { id: { $eq: project.id } },
|
|
21
|
+
startFrom: new Date(),
|
|
22
|
+
startThrough: moment()
|
|
23
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
24
|
+
.add(3, 'days')
|
|
25
|
+
.toDate()
|
|
26
|
+
// availableAtOrFrom: { id: { $eq: '3eo6okferrsdpfd9j2ce1iv9k7' } },
|
|
27
|
+
// itemOffered: {
|
|
28
|
+
// serviceOutput: { reservationFor: { id: { $in: ['bm0f0cadu', 'blco2394l'] } } }
|
|
29
|
+
// }
|
|
30
|
+
},
|
|
31
|
+
['eventStatus', 'startDate'],
|
|
32
|
+
{
|
|
33
|
+
// includeOffers: true,
|
|
34
|
+
includeOffers: false,
|
|
35
|
+
sellerMakesOfferAvailableAtIn: ['51qbjcfr72h62m06vtv5kkhgje', 'g']
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
// tslint:disable-next-line:no-null-keyword
|
|
39
|
+
console.dir(result, { depth: null });
|
|
40
|
+
console.log(result.length, 'results found');
|
|
41
|
+
console.log(result.at(0)?.offers?.seller?.makesOffer.length, 'makesOffer found');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
main()
|
|
45
|
+
.then(console.log)
|
|
46
|
+
.catch(console.error);
|
|
@@ -0,0 +1,32 @@
|
|
|
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 eventSellerMakesOfferRepo = await chevre.repository.EventSellerMakesOffer.createInstance(mongoose.connection);
|
|
12
|
+
const result = await eventSellerMakesOfferRepo.aggregateMakesOffer(
|
|
13
|
+
{
|
|
14
|
+
limit: 10,
|
|
15
|
+
page: 1,
|
|
16
|
+
// id: { $eq: 'bm0f0cadu' },
|
|
17
|
+
// typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
18
|
+
project: { id: { $eq: project.id } },
|
|
19
|
+
availableAtOrFrom: { id: { $eq: '3eo6okferrsdpfd9j2ce1iv9k7' } },
|
|
20
|
+
itemOffered: {
|
|
21
|
+
serviceOutput: { reservationFor: { id: { $in: ['bm0f0cadu', 'blco2394l'] } } }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
// tslint:disable-next-line:no-null-keyword
|
|
26
|
+
console.dir(result, { depth: null });
|
|
27
|
+
console.dir(result.length, 'results found');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
main()
|
|
31
|
+
.then(console.log)
|
|
32
|
+
.catch(console.error);
|
|
@@ -32,17 +32,18 @@ async function main() {
|
|
|
32
32
|
authorization: authorizationRepo,
|
|
33
33
|
order: orderRepo,
|
|
34
34
|
ticket: ticketRepo
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
jwt: await chevre.credentials.JWT.createInstance({
|
|
38
|
-
secret: <string>process.env.TOKEN_SECRET,
|
|
39
|
-
issuers: (typeof process.env.TOKEN_ISSUERS_BY_AUTHORIZATION === 'string')
|
|
40
|
-
? process.env.TOKEN_ISSUERS_BY_AUTHORIZATION.split(' ')
|
|
41
|
-
: [],
|
|
42
|
-
version: (typeof process.env.TOKEN_VERSION === 'string') ? process.env.TOKEN_VERSION : '2024-05-02',
|
|
43
|
-
payloadTypPrefix: (typeof process.env.TOKEN_PAYLOAD_TYP_PREFIX === 'string') ? process.env.TOKEN_PAYLOAD_TYP_PREFIX : 'chevre'
|
|
44
|
-
})
|
|
45
35
|
}
|
|
36
|
+
// {
|
|
37
|
+
// jwt: await chevre.credentials.JWT.createInstance({
|
|
38
|
+
// secret: <string>process.env.TOKEN_SECRET,
|
|
39
|
+
// issuers: (typeof process.env.TOKEN_ISSUERS_BY_AUTHORIZATION === 'string')
|
|
40
|
+
// ? process.env.TOKEN_ISSUERS_BY_AUTHORIZATION.split(' ')
|
|
41
|
+
// : [],
|
|
42
|
+
// version: (typeof process.env.TOKEN_VERSION === 'string') ? process.env.TOKEN_VERSION : '2024-05-02',
|
|
43
|
+
// payloadTypPrefix:
|
|
44
|
+
// (typeof process.env.TOKEN_PAYLOAD_TYP_PREFIX === 'string') ? process.env.TOKEN_PAYLOAD_TYP_PREFIX : 'chevre'
|
|
45
|
+
// })
|
|
46
|
+
// }
|
|
46
47
|
);
|
|
47
48
|
console.log('verified.');
|
|
48
49
|
|
|
@@ -0,0 +1,98 @@
|
|
|
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 excludedProject = { id: String(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 eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const cursor = eventRepo.getCursor(
|
|
17
|
+
{
|
|
18
|
+
'project.id': { $ne: excludedProject.id },
|
|
19
|
+
startDate: {
|
|
20
|
+
$gte: moment()
|
|
21
|
+
.add(-1, 'days')
|
|
22
|
+
.toDate()
|
|
23
|
+
},
|
|
24
|
+
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent }
|
|
25
|
+
// _id: { $eq: 'blyk9q24f' }
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
_id: 1,
|
|
29
|
+
offers: 1,
|
|
30
|
+
startDate: 1,
|
|
31
|
+
project: 1,
|
|
32
|
+
typeOf: 1
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
console.log('events found');
|
|
36
|
+
|
|
37
|
+
let i = 0;
|
|
38
|
+
let updateCount = 0;
|
|
39
|
+
await cursor.eachAsync(async (doc) => {
|
|
40
|
+
i += 1;
|
|
41
|
+
const event: Pick<
|
|
42
|
+
chevre.factory.event.screeningEvent.IEvent,
|
|
43
|
+
'id' | 'offers' | 'startDate' | 'project' | 'typeOf'
|
|
44
|
+
> = doc.toObject();
|
|
45
|
+
|
|
46
|
+
console.log(
|
|
47
|
+
'alreadyMigrated?', event.project.id, event.typeOf, event.id, event.startDate, i);
|
|
48
|
+
const originMakesOffer = event.offers.seller.makesOffer;
|
|
49
|
+
const alreadyMigrated = Array.isArray(originMakesOffer)
|
|
50
|
+
&& originMakesOffer.every(
|
|
51
|
+
({ availableAtOrFrom }) => !Array.isArray(availableAtOrFrom) && typeof availableAtOrFrom?.id === 'string'
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
if (alreadyMigrated) {
|
|
55
|
+
console.log(
|
|
56
|
+
'already migrated.', event.project.id, event.typeOf, event.id, event.startDate, i);
|
|
57
|
+
} else {
|
|
58
|
+
const newMakesOffer: chevre.factory.event.screeningEvent.ISellerMakesOffer[] = originMakesOffer.map((offer) => {
|
|
59
|
+
let newAvailableAtOrFrom: { id: string } | undefined;
|
|
60
|
+
if (Array.isArray(offer.availableAtOrFrom)) {
|
|
61
|
+
newAvailableAtOrFrom = offer.availableAtOrFrom.at(0);
|
|
62
|
+
}
|
|
63
|
+
if (newAvailableAtOrFrom === undefined) {
|
|
64
|
+
throw new Error('newAvailableAtOrFrom undefined');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
...offer,
|
|
69
|
+
availableAtOrFrom: newAvailableAtOrFrom
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
console.log(
|
|
73
|
+
'updating project...',
|
|
74
|
+
event.project.id, event.typeOf, event.id, event.startDate, i);
|
|
75
|
+
await eventRepo.updatePartiallyById({
|
|
76
|
+
project: { id: event.project.id },
|
|
77
|
+
id: event.id,
|
|
78
|
+
attributes: {
|
|
79
|
+
typeOf: event.typeOf,
|
|
80
|
+
...{
|
|
81
|
+
'offers.seller.makesOffer': newMakesOffer
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
updateCount += 1;
|
|
86
|
+
console.log(
|
|
87
|
+
'updated.',
|
|
88
|
+
event.project.id, event.typeOf, event.id, event.startDate, i);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
console.log(i, 'events checked');
|
|
93
|
+
console.log(updateCount, 'events updated');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
main()
|
|
97
|
+
.then()
|
|
98
|
+
.catch(console.error);
|
|
@@ -8,15 +8,15 @@ const project = { id: String(process.env.PROJECT_ID) };
|
|
|
8
8
|
async function main() {
|
|
9
9
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
10
|
|
|
11
|
-
const repo = await chevre.repository.
|
|
11
|
+
const repo = await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
|
|
12
12
|
|
|
13
13
|
const docs = await repo.projectFields(
|
|
14
14
|
{
|
|
15
|
-
limit:
|
|
15
|
+
limit: 10,
|
|
16
16
|
page: 1,
|
|
17
17
|
project: { id: { $eq: project.id } }
|
|
18
18
|
},
|
|
19
|
-
['
|
|
19
|
+
['relatedOffer']
|
|
20
20
|
);
|
|
21
21
|
// tslint:disable-next-line:no-null-keyword
|
|
22
22
|
console.dir(docs, { depth: null });
|
|
@@ -0,0 +1,43 @@
|
|
|
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 eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
12
|
+
const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
|
|
13
|
+
|
|
14
|
+
const event = (await eventRepo.projectEventFields(
|
|
15
|
+
{
|
|
16
|
+
id: { $eq: 'bm0f0cadm' },
|
|
17
|
+
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
18
|
+
project: { id: { $eq: project.id } }
|
|
19
|
+
},
|
|
20
|
+
['offers.itemOffered.id']
|
|
21
|
+
)).shift();
|
|
22
|
+
console.log('event:', event);
|
|
23
|
+
if (event === undefined) {
|
|
24
|
+
throw new Error('event not found');
|
|
25
|
+
}
|
|
26
|
+
const productId = event.offers.itemOffered.id;
|
|
27
|
+
if (typeof productId !== 'string') {
|
|
28
|
+
throw new Error('offers.itemOffered.id undefined');
|
|
29
|
+
}
|
|
30
|
+
const catalogs = await productRepo.aggregateHasOfferCatalog(
|
|
31
|
+
{
|
|
32
|
+
id: productId,
|
|
33
|
+
limit: 10,
|
|
34
|
+
page: 1
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
console.log(catalogs);
|
|
38
|
+
console.log(catalogs.length);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
main()
|
|
42
|
+
.then(console.log)
|
|
43
|
+
.catch(console.error);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// const PROJECT_ID = process.env.PROJECT_ID;
|
|
7
|
+
mongoose.Model.on('index', (...args) => {
|
|
8
|
+
console.error('******** index event emitted. ********\n', args);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
async function main() {
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
+
|
|
14
|
+
const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const result = await offerCatalogRepo.searchItemListElement({
|
|
17
|
+
id: { $in: ['blpj322ni', 'blpc770py', 'xxxx', 'blos0d5gu'] },
|
|
18
|
+
itemListElement: { id: { $in: ['xxx', '65669285c7b871dba60ed72e', '65669285c7b871dba60ed742', '1008'] } }
|
|
19
|
+
});
|
|
20
|
+
console.log(result);
|
|
21
|
+
console.log(result.length);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
main()
|
|
25
|
+
.then(console.log)
|
|
26
|
+
.catch(console.error);
|
|
@@ -18,10 +18,11 @@ async function main() {
|
|
|
18
18
|
|
|
19
19
|
const result = await (await chevre.service.offer.createService()).event.searchOfferCatalogItems({
|
|
20
20
|
event: {
|
|
21
|
-
id: '
|
|
21
|
+
id: 'bm0f0cadm'
|
|
22
22
|
},
|
|
23
23
|
limit: 10,
|
|
24
|
-
page: 1
|
|
24
|
+
page: 1,
|
|
25
|
+
options: { includedInDataCatalog: { id: 'blpj322ni' } }
|
|
25
26
|
})({
|
|
26
27
|
event: eventRepo,
|
|
27
28
|
offerCatalog: offerCatalogRepo,
|
|
@@ -12,8 +12,7 @@ async function main() {
|
|
|
12
12
|
|
|
13
13
|
const project = await projectRepo.findById({
|
|
14
14
|
id: PROJECT_ID,
|
|
15
|
-
inclusion: []
|
|
16
|
-
exclusion: ['settings', 'hasMerchantReturnPolicy']
|
|
15
|
+
inclusion: ['settings']
|
|
17
16
|
});
|
|
18
17
|
console.log('project:', project);
|
|
19
18
|
|
|
@@ -23,8 +22,7 @@ async function main() {
|
|
|
23
22
|
page: 1,
|
|
24
23
|
id: { $eq: project.id }
|
|
25
24
|
},
|
|
26
|
-
['typeOf']
|
|
27
|
-
[]
|
|
25
|
+
['typeOf']
|
|
28
26
|
);
|
|
29
27
|
console.log(projects);
|
|
30
28
|
console.log(projects.length, 'projects found');
|
|
@@ -6,30 +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
|
|
10
|
-
const offerItemConditionRepo = await chevre.repository.OfferItemCondition.createInstance(mongoose.connection);
|
|
9
|
+
const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
|
|
11
10
|
|
|
12
11
|
let updateResult: any;
|
|
13
|
-
updateResult = await
|
|
12
|
+
updateResult = await productRepo.unsetUnnecessaryFields({
|
|
14
13
|
filter: {
|
|
15
|
-
|
|
14
|
+
'hasOfferCatalog.id': { $exists: true }
|
|
16
15
|
},
|
|
17
|
-
$unset:
|
|
18
|
-
|
|
19
|
-
updatedAt: 1,
|
|
20
|
-
__v: 1
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
console.log(updateResult);
|
|
24
|
-
|
|
25
|
-
updateResult = await offerItemConditionRepo.unsetUnnecessaryFields({
|
|
26
|
-
filter: {
|
|
27
|
-
_id: { $exists: true }
|
|
28
|
-
},
|
|
29
|
-
$unset: <any>{
|
|
30
|
-
createdAt: 1,
|
|
31
|
-
updatedAt: 1,
|
|
32
|
-
__v: 1
|
|
16
|
+
$unset: {
|
|
17
|
+
'hasOfferCatalog.id': 1
|
|
33
18
|
}
|
|
34
19
|
});
|
|
35
20
|
console.log(updateResult);
|
|
@@ -45,8 +45,8 @@ async function main() {
|
|
|
45
45
|
},
|
|
46
46
|
offers: {
|
|
47
47
|
typeOf: chevre.factory.offerType.Offer,
|
|
48
|
-
availabilityEnds: new Date('2024-09-15T11:45:00.000Z'),
|
|
49
|
-
availabilityStarts: new Date('2024-09-01T15:00:00.000Z'),
|
|
48
|
+
// availabilityEnds: new Date('2024-09-15T11:45:00.000Z'),
|
|
49
|
+
// availabilityStarts: new Date('2024-09-01T15:00:00.000Z'),
|
|
50
50
|
eligibleQuantity: {
|
|
51
51
|
typeOf: 'QuantitativeValue',
|
|
52
52
|
unitCode: chevre.factory.unitCode.C62,
|
|
@@ -97,8 +97,8 @@ async function main() {
|
|
|
97
97
|
typeOf: 'CategoryCode'
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
-
validFrom: new Date('2024-09-01T15:00:00.000Z'),
|
|
101
|
-
validThrough: new Date('2024-09-15T11:45:00.000Z'),
|
|
100
|
+
// validFrom: new Date('2024-09-01T15:00:00.000Z'),
|
|
101
|
+
// validThrough: new Date('2024-09-15T11:45:00.000Z'),
|
|
102
102
|
seller: {
|
|
103
103
|
typeOf: chevre.factory.organizationType.Corporation,
|
|
104
104
|
id: '59d20831e53ebc2b4e774466',
|
|
@@ -70,7 +70,8 @@ interface IAggregateEvent {
|
|
|
70
70
|
statuses: IStatus[];
|
|
71
71
|
}
|
|
72
72
|
export import IMinimizedIndividualEvent = EventFactory.IMinimizedIndividualEvent;
|
|
73
|
-
type IKeyOfProjection<T extends AvailableEventType> = Exclude<keyof factory.event.IEvent<T>, 'id'> | 'aggregateEntranceGate' | 'aggregateOffer' | 'superEvent.location.id' | 'offers.itemOffered';
|
|
73
|
+
type IKeyOfProjection<T extends AvailableEventType> = Exclude<keyof factory.event.IEvent<T>, 'id'> | 'aggregateEntranceGate' | 'aggregateOffer' | 'superEvent.location.id' | 'offers.itemOffered' | 'offers.itemOffered.id';
|
|
74
|
+
type IKeyOfProjection4publicFields<T extends AvailableEventType> = Exclude<keyof factory.event.IEvent<T>, 'id' | 'offers'>;
|
|
74
75
|
/**
|
|
75
76
|
* minimizedEvent検索時のprojection候補
|
|
76
77
|
* add(2024-07-18~)
|
|
@@ -161,6 +162,19 @@ export declare class EventRepo {
|
|
|
161
162
|
* イベントを検索する(inclusion projection)
|
|
162
163
|
*/
|
|
163
164
|
projectEventFields<T extends AvailableEventType>(params: ISearchConditions<T>, inclusion: IKeyOfProjection<T>[]): Promise<Omit<factory.event.IEvent<T>, 'aggregateEntranceGate' | 'aggregateOffer'>[]>;
|
|
165
|
+
/**
|
|
166
|
+
* apiで公開属性を検索する(2024-10-13~)
|
|
167
|
+
*/
|
|
168
|
+
aggregatePublicFields<T extends AvailableEventType>(params: ISearchConditions<T>, inclusion: IKeyOfProjection4publicFields<T>[], options: {
|
|
169
|
+
/**
|
|
170
|
+
* offersを属性をprojectするかどうか
|
|
171
|
+
*/
|
|
172
|
+
includeOffers: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* offers.seller.makesOfferをavailableAtOrFromでfilterする
|
|
175
|
+
*/
|
|
176
|
+
sellerMakesOfferAvailableAtIn?: string[];
|
|
177
|
+
}): Promise<Omit<factory.event.IEvent<T>, 'aggregateEntranceGate' | 'aggregateOffer'>[]>;
|
|
164
178
|
/**
|
|
165
179
|
* IDのみで検索する
|
|
166
180
|
* projectionなし
|