@chevre/domain 20.2.0-alpha.3 → 20.2.0-alpha.31
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/aggregateEventReservation.ts +37 -0
- package/example/src/chevre/aggregation/aggregateSystem.ts +104 -0
- package/example/src/chevre/importEventsFromCOA.ts +8 -1
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +2 -1
- package/example/src/chevre/migrateProjectSubscription.ts +51 -0
- package/example/src/chevre/searchEventIds.ts +24 -0
- package/example/src/chevre/searchEvents.ts +20 -41
- package/example/src/chevre/updateTransaction.ts +38 -0
- package/lib/chevre/factory/event.d.ts +2 -0
- package/lib/chevre/factory/event.js +2 -0
- package/lib/chevre/repo/action.d.ts +58 -0
- package/lib/chevre/repo/action.js +187 -0
- package/lib/chevre/repo/aggregation.d.ts +36 -0
- package/lib/chevre/repo/aggregation.js +66 -0
- package/lib/chevre/repo/assetTransaction.d.ts +32 -0
- package/lib/chevre/repo/assetTransaction.js +148 -0
- package/lib/chevre/repo/event.d.ts +47 -13
- package/lib/chevre/repo/event.js +386 -113
- package/lib/chevre/repo/mongoose/model/aggregation.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/aggregation.js +47 -0
- package/lib/chevre/repo/mongoose/model/event.js +4 -3
- package/lib/chevre/repo/mongoose/model/project.js +7 -1
- package/lib/chevre/repo/mongoose/model/telemetry.js +4 -28
- package/lib/chevre/repo/place.d.ts +15 -1
- package/lib/chevre/repo/place.js +175 -10
- package/lib/chevre/repo/product.d.ts +1 -0
- package/lib/chevre/repo/product.js +5 -0
- package/lib/chevre/repo/project.d.ts +4 -1
- package/lib/chevre/repo/project.js +9 -10
- package/lib/chevre/repo/reservation.d.ts +0 -6
- package/lib/chevre/repo/reservation.js +106 -66
- package/lib/chevre/repo/task.d.ts +31 -3
- package/lib/chevre/repo/task.js +141 -27
- package/lib/chevre/repo/transaction.d.ts +45 -5
- package/lib/chevre/repo/transaction.js +187 -29
- package/lib/chevre/repo/trip.js +33 -27
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +40 -15
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +3 -1
- package/lib/chevre/service/aggregation/system.d.ts +86 -0
- package/lib/chevre/service/aggregation/system.js +345 -0
- package/lib/chevre/service/aggregation.d.ts +2 -0
- package/lib/chevre/service/aggregation.js +3 -1
- package/lib/chevre/service/assetTransaction/pay/movieTicket/validation.js +5 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +2 -4
- package/lib/chevre/service/assetTransaction/pay.d.ts +19 -4
- package/lib/chevre/service/assetTransaction/pay.js +65 -32
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +3 -0
- package/lib/chevre/service/assetTransaction/reserve/factory.js +33 -2
- package/lib/chevre/service/assetTransaction/reserve.d.ts +7 -2
- package/lib/chevre/service/assetTransaction/reserve.js +43 -56
- package/lib/chevre/service/delivery/factory.js +1 -0
- package/lib/chevre/service/event.d.ts +2 -4
- package/lib/chevre/service/event.js +34 -13
- package/lib/chevre/service/offer/event/authorize.js +5 -1
- package/lib/chevre/service/offer/event/cancel.js +0 -1
- package/lib/chevre/service/offer/event/factory.d.ts +3 -2
- package/lib/chevre/service/offer/event/factory.js +25 -5
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +2 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +124 -9
- package/lib/chevre/service/offer/event/voidTransaction.js +0 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA.js +10 -2
- package/lib/chevre/service/offer.js +36 -20
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +2 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +2 -1
- package/lib/chevre/service/order/placeOrder.js +16 -0
- package/lib/chevre/service/payment/any.d.ts +5 -0
- package/lib/chevre/service/payment/any.js +1 -1
- package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket.js +8 -2
- package/lib/chevre/service/reserve/confirmReservation.js +7 -10
- package/lib/chevre/service/reserve/useReservation.js +2 -1
- package/lib/chevre/service/task/confirmPayTransaction.js +20 -1
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +4 -0
- package/lib/chevre/service/task/confirmReserveTransaction.js +5 -5
- package/lib/chevre/service/task/importEventsFromCOA.js +3 -1
- package/lib/chevre/service/task.js +6 -9
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +42 -27
- package/lib/chevre/service/transaction/placeOrderInProgress.js +7 -7
- package/lib/chevre/service/transaction/returnOrder.js +3 -3
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +7 -2
- package/package.json +3 -3
- package/example/src/chevre/aggregateReservationOnProject.ts +0 -32
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +0 -162
|
@@ -1,32 +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 project = { id: <string>process.env.PROJECT_ID };
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
11
|
-
|
|
12
|
-
// const now = new Date();
|
|
13
|
-
await chevre.service.aggregation.project.aggregate({
|
|
14
|
-
project: { id: project.id },
|
|
15
|
-
reservationFor: {
|
|
16
|
-
startFrom: moment('2022-01-01T00:00:00+09:00')
|
|
17
|
-
.toDate(),
|
|
18
|
-
startThrough: moment('2022-01-31T23:59:59+09:00')
|
|
19
|
-
.toDate(),
|
|
20
|
-
}
|
|
21
|
-
})({
|
|
22
|
-
project: new chevre.repository.Project(mongoose.connection),
|
|
23
|
-
reservation: new chevre.repository.Reservation(mongoose.connection),
|
|
24
|
-
task: new chevre.repository.Task(mongoose.connection)
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
main()
|
|
29
|
-
.then(() => {
|
|
30
|
-
console.log('success!');
|
|
31
|
-
})
|
|
32
|
-
.catch(console.error);
|
|
@@ -1,162 +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 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 placeRepo = new chevre.repository.Place(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = placeRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
// 'project.id': { $eq: project.id },
|
|
19
|
-
'project.id': { $ne: EXCLUDED_PROJECT_ID }
|
|
20
|
-
// typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries },
|
|
21
|
-
// starDate: { $gte: new Date() }
|
|
22
|
-
// _id: { $eq: 'al6aff83w' }
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
// _id: 1,
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
console.log('creativeWorks found');
|
|
29
|
-
|
|
30
|
-
const additionalPropertyNames: string[] = [];
|
|
31
|
-
const additionalPropertyNamesOnSections: string[] = [];
|
|
32
|
-
const additionalPropertyNamesOnSeats: string[] = [];
|
|
33
|
-
const projectIds: string[] = [];
|
|
34
|
-
const unexpextedprojectIds: string[] = [];
|
|
35
|
-
const projectIdsOnSections: string[] = [];
|
|
36
|
-
const unexpextedprojectIdsOnSections: string[] = [];
|
|
37
|
-
const projectIdsOnSeats: string[] = [];
|
|
38
|
-
const unexpextedprojectIdsOnSeats: string[] = [];
|
|
39
|
-
|
|
40
|
-
let i = 0;
|
|
41
|
-
let updateCount = 0;
|
|
42
|
-
// tslint:disable-next-line:max-func-body-length
|
|
43
|
-
await cursor.eachAsync(async (doc) => {
|
|
44
|
-
i += 1;
|
|
45
|
-
const movieTheater: chevre.factory.place.movieTheater.IPlace = doc.toObject();
|
|
46
|
-
|
|
47
|
-
if (Array.isArray(movieTheater.containsPlace)) {
|
|
48
|
-
movieTheater.containsPlace.forEach((screeningRoom) => {
|
|
49
|
-
const additionalPropertyNamesOnResource = screeningRoom.additionalProperty?.map((p) => p.name);
|
|
50
|
-
console.log(
|
|
51
|
-
(Array.isArray(additionalPropertyNamesOnResource)) ? additionalPropertyNamesOnResource.length : 0,
|
|
52
|
-
'additionalPropertyNamesOnResource found',
|
|
53
|
-
movieTheater.project.id,
|
|
54
|
-
movieTheater.id
|
|
55
|
-
);
|
|
56
|
-
if (Array.isArray(additionalPropertyNamesOnResource) && additionalPropertyNamesOnResource.length > 0) {
|
|
57
|
-
console.log(
|
|
58
|
-
additionalPropertyNamesOnResource.length,
|
|
59
|
-
'additionalPropertyNamesOnResource found',
|
|
60
|
-
movieTheater.project.id,
|
|
61
|
-
movieTheater.id
|
|
62
|
-
);
|
|
63
|
-
additionalPropertyNames.push(...additionalPropertyNamesOnResource);
|
|
64
|
-
projectIds.push(movieTheater.project.id);
|
|
65
|
-
additionalPropertyNamesOnResource.forEach((name) => {
|
|
66
|
-
if (!name.match(/^[a-zA-Z]*$/)) {
|
|
67
|
-
// throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
|
|
68
|
-
unexpextedprojectIds.push(movieTheater.project.id);
|
|
69
|
-
}
|
|
70
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
71
|
-
if (name.length < 5) {
|
|
72
|
-
// throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
|
|
73
|
-
unexpextedprojectIds.push(movieTheater.project.id);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (Array.isArray(screeningRoom.containsPlace)) {
|
|
79
|
-
screeningRoom.containsPlace.forEach((section) => {
|
|
80
|
-
const additionalPropertyNamesOnSection = section.additionalProperty?.map((p) => p.name);
|
|
81
|
-
console.log(
|
|
82
|
-
(Array.isArray(additionalPropertyNamesOnSection)) ? additionalPropertyNamesOnSection.length : 0,
|
|
83
|
-
'additionalPropertyNamesOnSection found',
|
|
84
|
-
movieTheater.project.id,
|
|
85
|
-
movieTheater.id
|
|
86
|
-
);
|
|
87
|
-
if (Array.isArray(additionalPropertyNamesOnSection) && additionalPropertyNamesOnSection.length > 0) {
|
|
88
|
-
console.log(
|
|
89
|
-
additionalPropertyNamesOnSection.length,
|
|
90
|
-
'additionalPropertyNamesOnSection found',
|
|
91
|
-
movieTheater.project.id,
|
|
92
|
-
movieTheater.id
|
|
93
|
-
);
|
|
94
|
-
additionalPropertyNamesOnSections.push(...additionalPropertyNamesOnSection);
|
|
95
|
-
projectIdsOnSections.push(movieTheater.project.id);
|
|
96
|
-
additionalPropertyNamesOnSection.forEach((name) => {
|
|
97
|
-
if (!name.match(/^[a-zA-Z]*$/)) {
|
|
98
|
-
// throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
|
|
99
|
-
unexpextedprojectIdsOnSections.push(movieTheater.project.id);
|
|
100
|
-
}
|
|
101
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
102
|
-
if (name.length < 5) {
|
|
103
|
-
// throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
|
|
104
|
-
unexpextedprojectIdsOnSections.push(movieTheater.project.id);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (Array.isArray(section.containsPlace)) {
|
|
110
|
-
section.containsPlace.forEach((seat) => {
|
|
111
|
-
const additionalPropertyNamesOnSeat = seat.additionalProperty?.map((p) => p.name);
|
|
112
|
-
console.log(
|
|
113
|
-
(Array.isArray(additionalPropertyNamesOnSeat)) ? additionalPropertyNamesOnSeat.length : 0,
|
|
114
|
-
'additionalPropertyNamesOnSeat found',
|
|
115
|
-
movieTheater.project.id,
|
|
116
|
-
movieTheater.id
|
|
117
|
-
);
|
|
118
|
-
if (Array.isArray(additionalPropertyNamesOnSeat) && additionalPropertyNamesOnSeat.length > 0) {
|
|
119
|
-
console.log(
|
|
120
|
-
additionalPropertyNamesOnSeat.length,
|
|
121
|
-
'additionalPropertyNamesOnSeat found',
|
|
122
|
-
movieTheater.project.id,
|
|
123
|
-
movieTheater.id
|
|
124
|
-
);
|
|
125
|
-
additionalPropertyNamesOnSeats.push(...additionalPropertyNamesOnSeat);
|
|
126
|
-
projectIdsOnSeats.push(movieTheater.project.id);
|
|
127
|
-
additionalPropertyNamesOnSeat.forEach((name) => {
|
|
128
|
-
if (!name.match(/^[a-zA-Z]*$/)) {
|
|
129
|
-
// throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
|
|
130
|
-
unexpextedprojectIdsOnSeats.push(movieTheater.project.id);
|
|
131
|
-
}
|
|
132
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
133
|
-
if (name.length < 5) {
|
|
134
|
-
// throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
|
|
135
|
-
unexpextedprojectIdsOnSeats.push(movieTheater.project.id);
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
console.log(i, 'places checked');
|
|
148
|
-
console.log(updateCount, 'places updated');
|
|
149
|
-
console.log([...new Set(additionalPropertyNames)], 'screeningRooms');
|
|
150
|
-
console.log([...new Set(projectIds)], 'screeningRooms');
|
|
151
|
-
console.log([...new Set(unexpextedprojectIds)], 'screeningRooms');
|
|
152
|
-
console.log([...new Set(additionalPropertyNamesOnSections)], 'sections');
|
|
153
|
-
console.log([...new Set(projectIdsOnSections)], 'sections');
|
|
154
|
-
console.log([...new Set(unexpextedprojectIdsOnSections)], 'sections');
|
|
155
|
-
console.log([...new Set(additionalPropertyNamesOnSeats)], 'seats');
|
|
156
|
-
console.log([...new Set(projectIdsOnSeats)], 'seats');
|
|
157
|
-
console.log([...new Set(unexpextedprojectIdsOnSeats)], 'seats');
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
main()
|
|
161
|
-
.then()
|
|
162
|
-
.catch(console.error);
|