@chevre/domain 23.1.0-alpha.8 → 23.1.0
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/{eventOffer/adminEventOffers.ts → acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts} +12 -11
- package/example/src/chevre/actions/checkAcceptPayActions.ts +60 -0
- package/example/src/chevre/assetTransaction/checkPayTransactionsTicketToken.ts +67 -0
- package/example/src/chevre/assetTransaction/processReserve.ts +7 -3
- package/example/src/chevre/authorizeEventServiceOffer.ts +6 -5
- package/example/src/chevre/eventSeries/migrateEventSeriesUnacceptedPaymentMethod.ts +93 -0
- package/example/src/chevre/importEventsFromCOA.ts +5 -5
- package/example/src/chevre/member/migrateMemberIdentifier.ts +20 -15
- package/example/src/chevre/pendingReservation/findEventSeatOffersBySection.ts +46 -0
- package/example/src/chevre/place/checkSectionCount.ts +27 -0
- package/example/src/chevre/place/findSectionsByRoom.ts +50 -0
- package/example/src/chevre/project/unsetProjectSettings.ts +73 -0
- package/example/src/chevre/reIndex.ts +1 -2
- package/example/src/chevre/roles/{addAdminSellerEventIfNotExists.ts → addAdminSellerEventOfferIfNotExists.ts} +1 -1
- package/example/src/chevre/stockHolder/findSeatsBySection.ts +59 -0
- package/example/src/chevre/stockHolder/searchSeats.ts +2 -2
- package/lib/chevre/repo/acceptedPaymentMethod.d.ts +41 -0
- package/lib/chevre/repo/acceptedPaymentMethod.js +180 -0
- package/lib/chevre/repo/authorization.d.ts +3 -2
- package/lib/chevre/repo/authorization.js +13 -5
- package/lib/chevre/repo/event.d.ts +1 -35
- package/lib/chevre/repo/event.js +2 -102
- package/lib/chevre/repo/eventOffer.js +3 -3
- package/lib/chevre/repo/mongoose/schemas/acceptedPaymentMethod.d.ts +10 -0
- package/lib/chevre/repo/mongoose/schemas/acceptedPaymentMethod.js +97 -0
- package/lib/chevre/repo/mongoose/schemas/eventOffer.js +48 -35
- package/lib/chevre/repo/mongoose/schemas/member.js +10 -0
- package/lib/chevre/repo/note.js +4 -2
- package/lib/chevre/repo/pendingReservation.js +28 -71
- package/lib/chevre/repo/place/seat.d.ts +24 -0
- package/lib/chevre/repo/place/seat.js +103 -21
- package/lib/chevre/repo/place/section.d.ts +20 -0
- package/lib/chevre/repo/place/section.js +47 -0
- package/lib/chevre/repo/ticket.d.ts +7 -1
- package/lib/chevre/repo/ticket.js +14 -1
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.js +8 -3
- package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.d.ts +16 -0
- package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.js +94 -0
- package/lib/chevre/service/assetTransaction/pay.d.ts +6 -1
- package/lib/chevre/service/assetTransaction/pay.js +6 -1
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +4 -0
- package/lib/chevre/service/assetTransaction/reserve/start.js +4 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.js +8 -8
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +7 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +32 -32
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +10 -54
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/verifyTicketTokenAsNeeded.d.ts +23 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/verifyTicketTokenAsNeeded.js +62 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +34 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +21 -9
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +0 -4
- package/lib/chevre/service/offer/event/authorize/factory.js +2 -5
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +1 -1
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -0
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -7
- package/lib/chevre/service/offer/event/authorize.d.ts +1 -0
- package/lib/chevre/service/offer/event/authorize.js +7 -7
- package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +48 -0
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +123 -0
- package/lib/chevre/service/offer/event.d.ts +2 -1
- package/lib/chevre/service/offer/event.js +3 -1
- package/lib/chevre/service/offer.d.ts +31 -1
- package/lib/chevre/service/offer.js +104 -34
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +9 -0
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.js +22 -11
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +19 -2
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +87 -9
- package/lib/chevre/service/payment/any/factory.d.ts +20 -3
- package/lib/chevre/service/payment/any/factory.js +26 -6
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.d.ts +4 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.js +15 -11
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +6 -3
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +8 -22
- package/lib/chevre/service/payment/any.d.ts +5 -1
- package/lib/chevre/service/payment/any.js +22 -13
- package/lib/chevre/service/payment/factory.js +0 -5
- package/lib/chevre/service/payment/movieTicket/authorize.js +0 -5
- package/lib/chevre/service/task/authorizePayment.js +2 -0
- package/lib/chevre/service/task/publishPaymentUrl.js +4 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/publishCode.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +9 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.js +2 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +8 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.js +45 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validatePrice.d.ts +3 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validatePrice.js +38 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +2 -8
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +5 -35
- package/package.json +3 -3
- package/example/src/chevre/checkReplaceActions.ts +0 -65
- package/example/src/chevre/upsertManyEventsByAdditionalProperty.ts +0 -193
- package/lib/chevre/service/code.d.ts +0 -8
- package/lib/chevre/service/code.js +0 -7
|
@@ -9,22 +9,23 @@ const project = { id: String(process.env.PROJECT_ID) };
|
|
|
9
9
|
async function main() {
|
|
10
10
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const acceptedPaymentMethodRepo = await chevre.repository.AcceptedPaymentMethod.createInstance(mongoose.connection);
|
|
13
13
|
|
|
14
14
|
const validFrom = moment()
|
|
15
15
|
.toDate();
|
|
16
16
|
const validThrough = moment(validFrom)
|
|
17
17
|
.add(1, 'hour')
|
|
18
18
|
.toDate();
|
|
19
|
-
const
|
|
19
|
+
const settingOffer: Omit<chevre.factory.acceptedPaymentMethodOffer.IAcceptedPaymentMethodOffer, 'id'> = {
|
|
20
20
|
typeOf: chevre.factory.offerType.Offer,
|
|
21
|
-
identifier: '
|
|
21
|
+
identifier: '20251202acceptedPaymentMethod',
|
|
22
22
|
itemOffered: {
|
|
23
|
-
id: '
|
|
24
|
-
typeOf: chevre.factory.eventType.
|
|
23
|
+
id: '7k9ayl8hc',
|
|
24
|
+
typeOf: chevre.factory.eventType.ScreeningEventSeries
|
|
25
25
|
},
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
acceptedPaymentMethod: {
|
|
27
|
+
id: '5f9a52994f3709000abe6417',
|
|
28
|
+
typeOf: chevre.factory.service.paymentService.PaymentServiceType.MovieTicket
|
|
28
29
|
},
|
|
29
30
|
validFrom,
|
|
30
31
|
validThrough,
|
|
@@ -35,10 +36,10 @@ async function main() {
|
|
|
35
36
|
project: { id: project.id, typeOf: chevre.factory.organizationType.Project }
|
|
36
37
|
};
|
|
37
38
|
|
|
38
|
-
let result = await
|
|
39
|
+
let result = await acceptedPaymentMethodRepo.upsertAcceptedPaymentMethodsByIdentifier(
|
|
39
40
|
[
|
|
40
41
|
{
|
|
41
|
-
$set:
|
|
42
|
+
$set: settingOffer,
|
|
42
43
|
$unset: {}
|
|
43
44
|
}
|
|
44
45
|
],
|
|
@@ -48,10 +49,10 @@ async function main() {
|
|
|
48
49
|
);
|
|
49
50
|
console.log(result);
|
|
50
51
|
|
|
51
|
-
result = await
|
|
52
|
+
result = await acceptedPaymentMethodRepo.upsertAcceptedPaymentMethodsByIdentifier(
|
|
52
53
|
[
|
|
53
54
|
{
|
|
54
|
-
$set:
|
|
55
|
+
$set: settingOffer,
|
|
55
56
|
$unset: {}
|
|
56
57
|
}
|
|
57
58
|
],
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
// tslint:disable-next-line:max-func-body-length
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
+
|
|
11
|
+
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const cursor = actionRepo.getCursor(
|
|
14
|
+
{
|
|
15
|
+
typeOf: { $eq: chevre.factory.actionType.AcceptAction },
|
|
16
|
+
'object.typeOf': { $exists: true, $eq: chevre.factory.assetTransactionType.Pay },
|
|
17
|
+
startDate: {
|
|
18
|
+
$gte: moment()
|
|
19
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
20
|
+
.add(-3, 'days')
|
|
21
|
+
.toDate()
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
console.log('docs found');
|
|
28
|
+
|
|
29
|
+
let i = 0;
|
|
30
|
+
let ticketTokenCount = 0;
|
|
31
|
+
await cursor.eachAsync(async (doc) => {
|
|
32
|
+
i += 1;
|
|
33
|
+
const acceptAction = <chevre.factory.action.accept.pay.IAction>doc.toObject();
|
|
34
|
+
|
|
35
|
+
const ticketTokenByInstrument = acceptAction.instrument?.find((instrument) => instrument.typeOf === 'Ticket')?.ticketToken;
|
|
36
|
+
if (typeof ticketTokenByInstrument === 'string' && ticketTokenByInstrument !== '') {
|
|
37
|
+
console.log(
|
|
38
|
+
ticketTokenByInstrument,
|
|
39
|
+
' ticket token exists.',
|
|
40
|
+
acceptAction.project.id, acceptAction.typeOf, acceptAction.object.typeOf,
|
|
41
|
+
acceptAction.startDate, acceptAction.identifier, i
|
|
42
|
+
);
|
|
43
|
+
ticketTokenCount += 1;
|
|
44
|
+
} else {
|
|
45
|
+
console.log(
|
|
46
|
+
ticketTokenByInstrument,
|
|
47
|
+
' ticket token does not exists.',
|
|
48
|
+
acceptAction.project.id, acceptAction.typeOf, acceptAction.object.typeOf,
|
|
49
|
+
acceptAction.startDate, acceptAction.identifier, i
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
console.log(i, 'docs checked');
|
|
55
|
+
console.log(ticketTokenCount, 'ticketToken exist');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
main()
|
|
59
|
+
.then()
|
|
60
|
+
.catch(console.error);
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
// tslint:disable-next-line:max-func-body-length
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
+
|
|
11
|
+
const assetTransactionRepo = await chevre.repository.AssetTransaction.createInstance(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const cursor = assetTransactionRepo.getCursor(
|
|
14
|
+
{
|
|
15
|
+
typeOf: { $eq: chevre.factory.assetTransactionType.Pay },
|
|
16
|
+
startDate: {
|
|
17
|
+
$gte: moment()
|
|
18
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
19
|
+
.add(-3, 'days')
|
|
20
|
+
.toDate()
|
|
21
|
+
},
|
|
22
|
+
'object.typeOf': {
|
|
23
|
+
$exists: true,
|
|
24
|
+
$in: [
|
|
25
|
+
// chevre.factory.service.paymentService.PaymentServiceType.FaceToFace,
|
|
26
|
+
// chevre.factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
27
|
+
chevre.factory.service.paymentService.PaymentServiceType.CreditCard
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
console.log('docs found');
|
|
35
|
+
|
|
36
|
+
let i = 0;
|
|
37
|
+
let ticketTokenCount = 0;
|
|
38
|
+
await cursor.eachAsync(async (doc) => {
|
|
39
|
+
i += 1;
|
|
40
|
+
const payTransaction = <chevre.factory.assetTransaction.pay.ITransaction>doc.toObject();
|
|
41
|
+
|
|
42
|
+
const ticketTokenByInstrument = payTransaction.instrument?.find((instrument) => instrument.typeOf === 'Ticket')?.ticketToken;
|
|
43
|
+
if (typeof ticketTokenByInstrument === 'string' && ticketTokenByInstrument !== '') {
|
|
44
|
+
console.log(
|
|
45
|
+
ticketTokenByInstrument,
|
|
46
|
+
' ticket token exists.',
|
|
47
|
+
payTransaction.project.id, payTransaction.typeOf, payTransaction.object.typeOf,
|
|
48
|
+
payTransaction.startDate, payTransaction.transactionNumber, i
|
|
49
|
+
);
|
|
50
|
+
ticketTokenCount += 1;
|
|
51
|
+
} else {
|
|
52
|
+
console.log(
|
|
53
|
+
ticketTokenByInstrument,
|
|
54
|
+
' ticket token does not exists.',
|
|
55
|
+
payTransaction.project.id, payTransaction.typeOf, payTransaction.object.typeOf,
|
|
56
|
+
payTransaction.startDate, payTransaction.transactionNumber, i
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
console.log(i, 'docs checked');
|
|
62
|
+
console.log(ticketTokenCount, 'ticketToken exist');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
main()
|
|
66
|
+
.then()
|
|
67
|
+
.catch(console.error);
|
|
@@ -76,8 +76,8 @@ async function main() {
|
|
|
76
76
|
reservationFor: {
|
|
77
77
|
id: EVENT_ID,
|
|
78
78
|
offers: {
|
|
79
|
-
token: OFFER_TOKEN,
|
|
80
|
-
identifier: 'LegacyReservation'
|
|
79
|
+
// token: OFFER_TOKEN,
|
|
80
|
+
// identifier: 'LegacyReservation'
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
},
|
|
@@ -88,7 +88,9 @@ async function main() {
|
|
|
88
88
|
validateEvent: false,
|
|
89
89
|
validateEventOfferPeriod: true,
|
|
90
90
|
validateAppliesToMovieTicket: true,
|
|
91
|
-
instrument: [
|
|
91
|
+
instrument: [
|
|
92
|
+
...(typeof OFFER_TOKEN === 'string') ? [{ ticketToken: OFFER_TOKEN, typeOf: <'Ticket'>'Ticket' }] : []
|
|
93
|
+
],
|
|
92
94
|
availableAtOrFrom: { id: APPLICATION_ID }
|
|
93
95
|
// stockHoldUntilDaysAfterEventEnd: STOCK_HOLD_UNTIL_DAYS_AFTER_EVENT_END
|
|
94
96
|
},
|
|
@@ -96,6 +98,7 @@ async function main() {
|
|
|
96
98
|
)(
|
|
97
99
|
{
|
|
98
100
|
advanceBookingRequirement: await chevre.repository.AdvanceBookingRequirement.createInstance(mongoose.connection),
|
|
101
|
+
authorization: await chevre.repository.Authorization.createInstance(mongoose.connection),
|
|
99
102
|
project: await chevre.repository.Project.createInstance(mongoose.connection),
|
|
100
103
|
stockHolder: await chevre.repository.StockHolder.createInstance({ connection: mongoose.connection }),
|
|
101
104
|
event: await chevre.repository.Event.createInstance(mongoose.connection),
|
|
@@ -115,6 +118,7 @@ async function main() {
|
|
|
115
118
|
seat: await chevre.repository.place.Seat.createInstance(mongoose.connection),
|
|
116
119
|
setting: await chevre.repository.Setting.createInstance(mongoose.connection),
|
|
117
120
|
task: await chevre.repository.Task.createInstance(mongoose.connection),
|
|
121
|
+
ticket: await chevre.repository.Ticket.createInstance(mongoose.connection),
|
|
118
122
|
assetTransaction: await chevre.repository.AssetTransaction.createInstance(mongoose.connection)
|
|
119
123
|
},
|
|
120
124
|
new chevre.settings.Settings({
|
|
@@ -29,10 +29,10 @@ async function main() {
|
|
|
29
29
|
reservationFor: {
|
|
30
30
|
id: 'bmcvkft63',
|
|
31
31
|
offers: {
|
|
32
|
-
validForMemberTier: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
32
|
+
// validForMemberTier: {
|
|
33
|
+
// token: 'xx',
|
|
34
|
+
// isTierOf: { identifier: 'DefaultMemberProgram' }
|
|
35
|
+
// }
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
}
|
|
@@ -41,7 +41,8 @@ async function main() {
|
|
|
41
41
|
transaction: { id: 'xxx' },
|
|
42
42
|
validateEventOfferPeriod: true,
|
|
43
43
|
validateEvent: false,
|
|
44
|
-
store: { id: 'xxx' }
|
|
44
|
+
store: { id: 'xxx' },
|
|
45
|
+
instrument: []
|
|
45
46
|
},
|
|
46
47
|
{
|
|
47
48
|
noOfferSpecified: true,
|
|
@@ -0,0 +1,93 @@
|
|
|
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 DEFAULT_PAYMENT_METHOD_TYPE_FOR_MOVIE_TICKET = 'MovieTicket';
|
|
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 eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const cursor = eventSeriesRepo.getCursor(
|
|
17
|
+
{
|
|
18
|
+
'project.id': { $eq: 'xxx' },
|
|
19
|
+
'offers.unacceptedPaymentMethod': {
|
|
20
|
+
$exists: true,
|
|
21
|
+
$ne: DEFAULT_PAYMENT_METHOD_TYPE_FOR_MOVIE_TICKET
|
|
22
|
+
},
|
|
23
|
+
startDate: {
|
|
24
|
+
$lte: moment()
|
|
25
|
+
.add(-1, 'year')
|
|
26
|
+
.toDate()
|
|
27
|
+
}
|
|
28
|
+
// _id: { $eq: 'bliy11ffa' }
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
// _id: 1,
|
|
32
|
+
// offers: 1,
|
|
33
|
+
// startDate: 1,
|
|
34
|
+
// project: 1,
|
|
35
|
+
// typeOf: 1
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
console.log('docs found');
|
|
39
|
+
|
|
40
|
+
let i = 0;
|
|
41
|
+
let updateCount = 0;
|
|
42
|
+
await cursor.eachAsync(async (doc) => {
|
|
43
|
+
i += 1;
|
|
44
|
+
const eventSeries: Pick<
|
|
45
|
+
chevre.factory.eventSeries.IEvent,
|
|
46
|
+
'id' | 'offers' | 'startDate' | 'project' | 'typeOf'
|
|
47
|
+
> = doc.toObject();
|
|
48
|
+
|
|
49
|
+
console.log(
|
|
50
|
+
'alreadyMigrated?', eventSeries.project.id, eventSeries.typeOf, eventSeries.id, eventSeries.startDate, i);
|
|
51
|
+
const unacceptedPaymentMethod = eventSeries.offers?.unacceptedPaymentMethod;
|
|
52
|
+
const alreadyMigrated = !Array.isArray(unacceptedPaymentMethod)
|
|
53
|
+
|| (Array.isArray(unacceptedPaymentMethod)
|
|
54
|
+
&& unacceptedPaymentMethod.every(
|
|
55
|
+
(paymentMethodType) => paymentMethodType === DEFAULT_PAYMENT_METHOD_TYPE_FOR_MOVIE_TICKET
|
|
56
|
+
));
|
|
57
|
+
|
|
58
|
+
if (alreadyMigrated) {
|
|
59
|
+
console.log(
|
|
60
|
+
'already migrated.', eventSeries.project.id, eventSeries.typeOf, eventSeries.id, eventSeries.startDate, i);
|
|
61
|
+
} else {
|
|
62
|
+
if (Array.isArray(unacceptedPaymentMethod)) {
|
|
63
|
+
const newUnacceptedPaymentMethod = unacceptedPaymentMethod.filter(
|
|
64
|
+
(paymentMethod) => paymentMethod === DEFAULT_PAYMENT_METHOD_TYPE_FOR_MOVIE_TICKET
|
|
65
|
+
);
|
|
66
|
+
console.log(
|
|
67
|
+
'updating project...',
|
|
68
|
+
newUnacceptedPaymentMethod,
|
|
69
|
+
eventSeries.project.id, eventSeries.typeOf, eventSeries.id, eventSeries.startDate, i);
|
|
70
|
+
await eventSeriesRepo.saveEventSeries({
|
|
71
|
+
id: eventSeries.id,
|
|
72
|
+
attributes: <any>{
|
|
73
|
+
...{
|
|
74
|
+
typeOf: eventSeries.typeOf,
|
|
75
|
+
'offers.unacceptedPaymentMethod': newUnacceptedPaymentMethod
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
updateCount += 1;
|
|
80
|
+
console.log(
|
|
81
|
+
'updated.',
|
|
82
|
+
eventSeries.project.id, eventSeries.typeOf, eventSeries.id, eventSeries.startDate, i);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
console.log(i, 'docs checked');
|
|
88
|
+
console.log(updateCount, 'docs updated');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
main()
|
|
92
|
+
.then()
|
|
93
|
+
.catch(console.error);
|
|
@@ -37,14 +37,14 @@ async function main() {
|
|
|
37
37
|
id: project.id,
|
|
38
38
|
typeOf: chevre.factory.organizationType.Project
|
|
39
39
|
},
|
|
40
|
-
locationBranchCode: '
|
|
41
|
-
importFrom: moment()
|
|
40
|
+
locationBranchCode: '016',
|
|
41
|
+
importFrom: moment('2025-12-10T04:45:00.181Z')
|
|
42
42
|
.toDate(),
|
|
43
|
-
importThrough: moment()
|
|
44
|
-
.add(1, 'day')
|
|
43
|
+
importThrough: moment('2025-12-11T04:45:00.181Z')
|
|
44
|
+
// .add(1, 'day')
|
|
45
45
|
.toDate(),
|
|
46
46
|
saveMovieTheater: false,
|
|
47
|
-
saveScreeningEventSeries:
|
|
47
|
+
saveScreeningEventSeries: true,
|
|
48
48
|
// saveScreeningEventSeries: true,
|
|
49
49
|
saveScreeningEventSeriesPeriodInMonth: 3
|
|
50
50
|
})({
|
|
@@ -53,35 +53,40 @@ async function main() {
|
|
|
53
53
|
i += 1;
|
|
54
54
|
const iamMember: chevre.factory.iam.IMember = doc.toObject();
|
|
55
55
|
|
|
56
|
-
const
|
|
56
|
+
const applicationIdentifier = iamMember.member.identifier;
|
|
57
|
+
const updatingIdentifier = identifierMap.find(({ id }) => id === iamMember.member.id)?.identifier;
|
|
58
|
+
if (typeof updatingIdentifier !== 'string') {
|
|
59
|
+
throw new Error(`map not found. ${iamMember.member.name}`);
|
|
60
|
+
}
|
|
61
|
+
const identifierExists = typeof applicationIdentifier === 'string';
|
|
57
62
|
|
|
58
63
|
if (identifierExists) {
|
|
64
|
+
if (applicationIdentifier !== updatingIdentifier) {
|
|
65
|
+
throw new Error(`unexpected application identifier. ${iamMember.member.name}`);
|
|
66
|
+
}
|
|
67
|
+
|
|
59
68
|
console.log(
|
|
60
69
|
'identifier exists',
|
|
61
70
|
iamMember.project.id,
|
|
62
71
|
iamMember.member.name,
|
|
63
|
-
|
|
72
|
+
applicationIdentifier
|
|
64
73
|
);
|
|
65
74
|
} else {
|
|
66
|
-
const updatingIdentifier = identifierMap.find(({ id }) => id === iamMember.member.id)?.identifier;
|
|
67
|
-
if (typeof updatingIdentifier !== 'string') {
|
|
68
|
-
throw new Error(`map not found. ${iamMember.member.name}`);
|
|
69
|
-
}
|
|
70
75
|
console.log(
|
|
71
76
|
'migrating identifier...',
|
|
72
77
|
iamMember.project.id,
|
|
73
78
|
iamMember.member.name,
|
|
74
79
|
updatingIdentifier
|
|
75
80
|
);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
await memberRepo.updateByMemberId({
|
|
82
|
+
project: { id: iamMember.project.id },
|
|
83
|
+
member: {
|
|
84
|
+
id: iamMember.member.id,
|
|
85
|
+
memberOf: iamMember.member.memberOf,
|
|
86
|
+
identifier: updatingIdentifier
|
|
87
|
+
},
|
|
88
|
+
$unset: {}
|
|
89
|
+
});
|
|
85
90
|
updated += 1;
|
|
86
91
|
}
|
|
87
92
|
});
|
|
@@ -0,0 +1,46 @@
|
|
|
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;
|
|
7
|
+
const formatter = new Intl.NumberFormat('ja-JP');
|
|
8
|
+
|
|
9
|
+
// tslint:disable-next-line:max-func-body-length
|
|
10
|
+
async function main() {
|
|
11
|
+
let startTime: [number, number] = process.hrtime();
|
|
12
|
+
let diff: [number, number] = process.hrtime(startTime);
|
|
13
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
+
|
|
15
|
+
setInterval(
|
|
16
|
+
async () => {
|
|
17
|
+
startTime = process.hrtime();
|
|
18
|
+
const result = await (await chevre.service.offer.createService()).findEventSeatOffersBySection({
|
|
19
|
+
limit: 100,
|
|
20
|
+
page: 10,
|
|
21
|
+
projectId: String(PROJECT_ID),
|
|
22
|
+
sellerId: '59d20831e53ebc2b4e774466',
|
|
23
|
+
eventId: '693622f7876e9977c32ae270',
|
|
24
|
+
/**
|
|
25
|
+
* セクションコード
|
|
26
|
+
*/
|
|
27
|
+
sectionCode: 'Default'
|
|
28
|
+
})({
|
|
29
|
+
event: await chevre.repository.Event.createInstance(mongoose.connection),
|
|
30
|
+
seat: await chevre.repository.place.Seat.createInstance(mongoose.connection),
|
|
31
|
+
stockHolder: await chevre.repository.StockHolder.createInstance({ connection: mongoose.connection })
|
|
32
|
+
});
|
|
33
|
+
diff = process.hrtime(startTime);
|
|
34
|
+
// tslint:disable-next-line:no-null-keyword
|
|
35
|
+
console.dir(result, { depth: null });
|
|
36
|
+
console.log(result.length, 'results found');
|
|
37
|
+
console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
38
|
+
},
|
|
39
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
40
|
+
1000
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
main()
|
|
45
|
+
.then()
|
|
46
|
+
.catch(console.error);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// tslint:disable:no-console no-magic-numbers
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// tslint:disable-next-line:max-func-body-length
|
|
7
|
+
async function main() {
|
|
8
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
|
+
|
|
10
|
+
const roomRepo = await chevre.repository.place.ScreeningRoom.createInstance(mongoose.connection);
|
|
11
|
+
|
|
12
|
+
const rooms = await roomRepo.searchScreeningRooms({
|
|
13
|
+
$projection: { sectionCount: 1 }
|
|
14
|
+
});
|
|
15
|
+
console.log('docs found');
|
|
16
|
+
console.log(rooms);
|
|
17
|
+
|
|
18
|
+
const mutipleSectionRooms = rooms.filter((room) => typeof room.sectionCount === 'number' && room.sectionCount > 1);
|
|
19
|
+
console.log(mutipleSectionRooms);
|
|
20
|
+
|
|
21
|
+
console.log(rooms.length, 'rooms');
|
|
22
|
+
console.log(mutipleSectionRooms.length, 'mutipleSectionRooms');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
main()
|
|
26
|
+
.then()
|
|
27
|
+
.catch(console.error);
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
const SCREEN_CODE = '100';
|
|
8
|
+
const MOVIE_THEATER_CODE = '118';
|
|
9
|
+
const SELLER_ID = '59d20831e53ebc2b4e774466';
|
|
10
|
+
|
|
11
|
+
const formatter = new Intl.NumberFormat('ja-JP');
|
|
12
|
+
|
|
13
|
+
// tslint:disable-next-line:max-func-body-length
|
|
14
|
+
async function main() {
|
|
15
|
+
let startTime: [number, number] = process.hrtime();
|
|
16
|
+
let diff: [number, number] = process.hrtime(startTime);
|
|
17
|
+
|
|
18
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
19
|
+
|
|
20
|
+
const sectionRepo = await chevre.repository.place.Section.createInstance(mongoose.connection);
|
|
21
|
+
|
|
22
|
+
setInterval(
|
|
23
|
+
async () => {
|
|
24
|
+
startTime = process.hrtime();
|
|
25
|
+
const seats = await sectionRepo.findSectionsByRoom(
|
|
26
|
+
{
|
|
27
|
+
limit: 10,
|
|
28
|
+
page: 1,
|
|
29
|
+
projectId: PROJECT_ID,
|
|
30
|
+
sellerId: SELLER_ID,
|
|
31
|
+
movieTheaterCode: MOVIE_THEATER_CODE,
|
|
32
|
+
roomCode: SCREEN_CODE
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
diff = process.hrtime(startTime);
|
|
36
|
+
// tslint:disable-next-line:no-null-keyword
|
|
37
|
+
console.dir(seats, { depth: null });
|
|
38
|
+
console.log(seats.length, 'sections found');
|
|
39
|
+
console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
40
|
+
},
|
|
41
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
42
|
+
1000
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
main()
|
|
47
|
+
.then(() => {
|
|
48
|
+
console.log('success!');
|
|
49
|
+
})
|
|
50
|
+
.catch(console.error);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// tslint:disable-next-line:max-func-body-length
|
|
7
|
+
async function main() {
|
|
8
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
|
+
|
|
10
|
+
const projectRepo = await chevre.repository.Project.createInstance(mongoose.connection);
|
|
11
|
+
|
|
12
|
+
const cursor = projectRepo.getCursor(
|
|
13
|
+
{
|
|
14
|
+
_id: {
|
|
15
|
+
$nin: [
|
|
16
|
+
'ttts-development',
|
|
17
|
+
'ttts-test',
|
|
18
|
+
'ttts-production'
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
_id: 1,
|
|
24
|
+
settings: 1,
|
|
25
|
+
typeOf: 1
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
console.log('docs found');
|
|
29
|
+
|
|
30
|
+
let i = 0;
|
|
31
|
+
let updateCount = 0;
|
|
32
|
+
await cursor.eachAsync(async (doc) => {
|
|
33
|
+
i += 1;
|
|
34
|
+
const project: Pick<chevre.factory.project.IProject, 'id' | 'typeOf' | 'settings'> = doc.toObject();
|
|
35
|
+
|
|
36
|
+
console.log(
|
|
37
|
+
'alreadyMigrated?', project.id, i);
|
|
38
|
+
const includeCustomerAsFindByConfirmationNumberResult = project.settings?.includeCustomerAsFindByConfirmationNumberResult;
|
|
39
|
+
let alreadyMigrated = true;
|
|
40
|
+
if (typeof includeCustomerAsFindByConfirmationNumberResult === 'boolean'
|
|
41
|
+
&& includeCustomerAsFindByConfirmationNumberResult === true) {
|
|
42
|
+
alreadyMigrated = false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (alreadyMigrated) {
|
|
46
|
+
console.log(
|
|
47
|
+
'already migrated.', project.id, i);
|
|
48
|
+
} else {
|
|
49
|
+
console.log(
|
|
50
|
+
'updating project...',
|
|
51
|
+
project.id, i);
|
|
52
|
+
await projectRepo.unsetUnnecessaryFields({
|
|
53
|
+
filter: {
|
|
54
|
+
_id: { $eq: project.id }
|
|
55
|
+
},
|
|
56
|
+
$unset: {
|
|
57
|
+
'settings.includeCustomerAsFindByConfirmationNumberResult': 1
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
updateCount += 1;
|
|
61
|
+
console.log(
|
|
62
|
+
'updated.',
|
|
63
|
+
project.id, i);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
console.log(i, 'docs checked');
|
|
68
|
+
console.log(updateCount, 'docs updated');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
main()
|
|
72
|
+
.then()
|
|
73
|
+
.catch(console.error);
|
|
@@ -11,8 +11,7 @@ mongoose.Model.on('index', (...args) => {
|
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
13
|
|
|
14
|
-
await chevre.repository.
|
|
15
|
-
// await chevre.repository.MovieTicketType.createInstance(mongoose.connection);
|
|
14
|
+
await chevre.repository.EventOffer.createInstance(mongoose.connection);
|
|
16
15
|
console.log('success!');
|
|
17
16
|
}
|
|
18
17
|
|
|
@@ -14,7 +14,7 @@ async function main() {
|
|
|
14
14
|
chevre.factory.role.organizationRole.RoleName.SellersInventoryManager
|
|
15
15
|
];
|
|
16
16
|
const permissions = [
|
|
17
|
-
'admin.sellers.
|
|
17
|
+
'admin.sellers.eventOffers.*'
|
|
18
18
|
];
|
|
19
19
|
for (const roleName of roleNames) {
|
|
20
20
|
for (const permission of permissions) {
|