@chevre/domain 20.1.0-alpha.5 → 20.1.0-alpha.50
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/deleteReservationTicketUnderNames.ts +20 -0
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +157 -0
- package/example/src/chevre/migrateCreativeWorkAdditionalProperties.ts +116 -0
- package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +139 -0
- package/example/src/chevre/migrateEventProjectAttributes.ts +57 -0
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +162 -0
- package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +64 -0
- package/example/src/chevre/searchEvents.ts +36 -16
- package/example/src/chevre/transaction/callOrderMembershipServiceTask.ts +0 -4
- package/example/src/chevre/transaction/orderMembershipService.ts +0 -4
- package/lib/chevre/factory/reservedAgentIdentifireNames.d.ts +1 -0
- package/lib/chevre/factory/reservedAgentIdentifireNames.js +12 -0
- package/lib/chevre/repo/accountAction.d.ts +0 -18
- package/lib/chevre/repo/accountAction.js +402 -355
- package/lib/chevre/repo/accountTitle.d.ts +1 -0
- package/lib/chevre/repo/accountTitle.js +6 -1
- package/lib/chevre/repo/additionalProperty.d.ts +35 -0
- package/lib/chevre/repo/additionalProperty.js +205 -0
- package/lib/chevre/repo/categoryCode.d.ts +1 -0
- package/lib/chevre/repo/categoryCode.js +15 -1
- package/lib/chevre/repo/creativeWork.js +10 -1
- package/lib/chevre/repo/customer.d.ts +1 -0
- package/lib/chevre/repo/customer.js +5 -0
- package/lib/chevre/repo/event.d.ts +12 -4
- package/lib/chevre/repo/event.js +84 -48
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -0
- package/lib/chevre/repo/merchantReturnPolicy.js +5 -0
- package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/additionalProperty.js +81 -0
- package/lib/chevre/repo/mongoose/model/categoryCode.js +18 -2
- package/lib/chevre/repo/mongoose/model/creativeWork.js +6 -0
- package/lib/chevre/repo/mongoose/model/event.js +53 -0
- package/lib/chevre/repo/mongoose/model/offer.js +7 -1
- package/lib/chevre/repo/mongoose/model/offerCatalog.js +21 -2
- package/lib/chevre/repo/mongoose/model/ownershipInfo.js +3 -15
- package/lib/chevre/repo/mongoose/model/place.js +42 -0
- package/lib/chevre/repo/offer.js +10 -1
- package/lib/chevre/repo/offerCatalog.js +10 -10
- package/lib/chevre/repo/person.js +4 -1
- package/lib/chevre/repo/place.d.ts +1 -0
- package/lib/chevre/repo/place.js +54 -7
- package/lib/chevre/repo/reservation.d.ts +17 -2
- package/lib/chevre/repo/reservation.js +41 -1
- package/lib/chevre/repo/transaction.js +20 -5
- package/lib/chevre/repository.d.ts +6 -3
- package/lib/chevre/repository.js +10 -5
- package/lib/chevre/service/account.d.ts +0 -4
- package/lib/chevre/service/account.js +24 -22
- package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/deposit.js +3 -3
- package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/transfer.js +3 -3
- package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
- package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +86 -42
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +9 -19
- package/lib/chevre/service/assetTransaction/reserve/factory.js +119 -115
- package/lib/chevre/service/assetTransaction/reserve.js +41 -95
- package/lib/chevre/service/delivery/factory.js +2 -1
- package/lib/chevre/service/event.js +20 -6
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
- package/lib/chevre/service/offer/event/authorize.js +65 -27
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +17 -12
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -9
- package/lib/chevre/service/offer/factory.js +7 -20
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +11 -3
- package/lib/chevre/service/order/onOrderStatusChanged.js +3 -2
- package/lib/chevre/service/order/placeOrder.js +13 -5
- package/lib/chevre/service/order/returnOrder.js +2 -1
- package/lib/chevre/service/order/sendOrder.js +2 -1
- package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -5
- package/lib/chevre/service/reserve/cancelReservation.js +260 -107
- package/lib/chevre/service/reserve/confirmReservation.js +65 -33
- package/lib/chevre/service/reserve/factory.d.ts +14 -2
- package/lib/chevre/service/reserve/factory.js +13 -6
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +85 -30
- package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +15 -31
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +20 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +10 -6
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
- package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +2 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +6 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +2 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -1
- package/lib/chevre/service/transaction/returnOrder.js +10 -1
- package/lib/chevre/service/transaction.js +1 -14
- package/lib/chevre/service.d.ts +2 -0
- package/lib/chevre/service.js +2 -0
- package/package.json +4 -4
- package/example/src/chevre/accountBlanceTest.ts +0 -24
- package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
- package/example/src/chevre/createSeats.ts +0 -59
- package/example/src/chevre/deleteEvents.ts +0 -50
- package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
- package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
- package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
- package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
- package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
- package/example/src/chevre/publishConfirmationNumber.ts +0 -30
- package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
- package/example/src/chevre/publishTransactionNumber.ts +0 -28
- package/example/src/chevre/renameTransaction.ts +0 -22
- package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
- package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
- package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
- package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
package/lib/chevre/service.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.factory = exports.util = exports.transaction = exports.task = exports.re
|
|
|
6
6
|
*/
|
|
7
7
|
const AccountTransactionIdentifierFactory = require("./factory/accountTransactionIdentifier");
|
|
8
8
|
const OrderFactory = require("./factory/order");
|
|
9
|
+
const ReservedAgentIdentifireNamesFactory = require("./factory/reservedAgentIdentifireNames");
|
|
9
10
|
const AccountService = require("./service/account");
|
|
10
11
|
const AccountTransactionService = require("./service/accountTransaction");
|
|
11
12
|
const AggregationService = require("./service/aggregation");
|
|
@@ -52,4 +53,5 @@ var factory;
|
|
|
52
53
|
factory.accountTransactionIdentifier = AccountTransactionIdentifierFactory;
|
|
53
54
|
// tslint:disable-next-line:no-shadowed-variable
|
|
54
55
|
factory.order = OrderFactory;
|
|
56
|
+
factory.reservedAgentIdentifireNames = ReservedAgentIdentifireNamesFactory;
|
|
55
57
|
})(factory = exports.factory || (exports.factory = {}));
|
package/package.json
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.280.0-alpha.12",
|
|
13
|
+
"@cinerino/sdk": "3.135.0-alpha.6",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
17
|
-
"@surfrock/sdk": "1.
|
|
17
|
+
"@surfrock/sdk": "1.2.0-alpha.0",
|
|
18
18
|
"@waiter/domain": "5.1.0",
|
|
19
19
|
"JSONStream": "^1.3.5",
|
|
20
20
|
"aws-sdk": "^2.984.0",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"postversion": "git push origin --tags",
|
|
121
121
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
122
122
|
},
|
|
123
|
-
"version": "20.1.0-alpha.
|
|
123
|
+
"version": "20.1.0-alpha.50"
|
|
124
124
|
}
|
|
@@ -1,24 +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
|
-
async function main() {
|
|
8
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
9
|
-
|
|
10
|
-
const accountRepo = new chevre.repository.Account(mongoose.connection);
|
|
11
|
-
|
|
12
|
-
// 不要な所有権を削除
|
|
13
|
-
const result = await accountRepo.authorizeAmount({
|
|
14
|
-
accountNumber: '139151625010963',
|
|
15
|
-
amount: 10,
|
|
16
|
-
transaction: <any>{ id: 'test' },
|
|
17
|
-
force: false
|
|
18
|
-
});
|
|
19
|
-
console.log('result:', result);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
main()
|
|
23
|
-
.then(console.log)
|
|
24
|
-
.catch(console.error);
|
|
@@ -1,56 +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 offerRepo = new chevre.repository.Offer(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const cursor = offerRepo.getCursor(
|
|
15
|
-
{
|
|
16
|
-
// 'project.id': { $eq: project.id }
|
|
17
|
-
'priceSpecification.appliesToMovieTicket': {
|
|
18
|
-
$exists: true,
|
|
19
|
-
$type: 'array'
|
|
20
|
-
// $not: { $type: 'array' }
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
// _id: 1,
|
|
25
|
-
// ownedFrom: 1,
|
|
26
|
-
// typeOfGood: 1
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
console.log('offers found');
|
|
30
|
-
|
|
31
|
-
let i = 0;
|
|
32
|
-
let isArrayCount = 0;
|
|
33
|
-
let updateCount = 0;
|
|
34
|
-
await cursor.eachAsync(async (doc) => {
|
|
35
|
-
i += 1;
|
|
36
|
-
const offer = <chevre.factory.unitPriceOffer.IUnitPriceOffer>doc.toObject();
|
|
37
|
-
const applieToMovieTicket = offer.priceSpecification?.appliesToMovieTicket;
|
|
38
|
-
if (Array.isArray(applieToMovieTicket)) {
|
|
39
|
-
console.log('is Array', offer.project.id, offer.id, i);
|
|
40
|
-
isArrayCount += 1;
|
|
41
|
-
} else if (typeof (<any>applieToMovieTicket)?.typeOf === 'string') {
|
|
42
|
-
console.log('is not array', offer.project.id, offer.id, i);
|
|
43
|
-
updateCount += 1;
|
|
44
|
-
} else {
|
|
45
|
-
console.log('no applieToMovieTicket', offer.project.id, offer.id, i);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
console.log(i, 'offers checked');
|
|
50
|
-
console.log(isArrayCount, 'isArrayCount');
|
|
51
|
-
console.log(updateCount, 'offers updated');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
main()
|
|
55
|
-
.then()
|
|
56
|
-
.catch(console.error);
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
|
|
4
|
-
const columns = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W'];
|
|
5
|
-
const rows = [
|
|
6
|
-
{ column: 'A', min: 4, max: 22 },
|
|
7
|
-
{ column: 'B', min: 4, max: 22 },
|
|
8
|
-
{ column: 'C', min: 3, max: 23 },
|
|
9
|
-
{ column: 'D', min: 3, max: 23 },
|
|
10
|
-
{ column: 'E', min: 3, max: 23 },
|
|
11
|
-
{ column: 'F', min: 2, max: 24 },
|
|
12
|
-
{ column: 'G', min: 2, max: 24 },
|
|
13
|
-
{ column: 'H', min: 1, max: 24 },
|
|
14
|
-
{ column: 'I', min: 1, max: 24 },
|
|
15
|
-
{ column: 'J', min: 1, max: 24 },
|
|
16
|
-
{ column: 'K', min: 1, max: 24 },
|
|
17
|
-
{ column: 'L', min: 1, max: 24 },
|
|
18
|
-
{ column: 'M', min: 1, max: 24 },
|
|
19
|
-
{ column: 'N', min: 1, max: 24 },
|
|
20
|
-
{ column: 'O', min: 1, max: 24 },
|
|
21
|
-
{ column: 'P', min: 1, max: 24 },
|
|
22
|
-
{ column: 'Q', min: 1, max: 24 },
|
|
23
|
-
{ column: 'R', min: 1, max: 24 },
|
|
24
|
-
{ column: 'S', min: 4, max: 21 },
|
|
25
|
-
{ column: 'T', min: 4, max: 21 },
|
|
26
|
-
{ column: 'U', min: 4, max: 21 },
|
|
27
|
-
{ column: 'V', min: 1, max: 24 },
|
|
28
|
-
{ column: 'W', min: 1, max: 24 }
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
const seats: {
|
|
32
|
-
branchCode: string;
|
|
33
|
-
typeOf: 'Seat';
|
|
34
|
-
}[] = [];
|
|
35
|
-
columns.forEach((column) => {
|
|
36
|
-
const row = rows.find((r) => r.column === column);
|
|
37
|
-
|
|
38
|
-
if (row !== undefined) {
|
|
39
|
-
const seatsByRow: {
|
|
40
|
-
branchCode: string;
|
|
41
|
-
typeOf: 'Seat';
|
|
42
|
-
}[] = [];
|
|
43
|
-
// tslint:disable-next-line:no-increment-decrement
|
|
44
|
-
for (let i = row.min; i <= row.max; i++) {
|
|
45
|
-
seatsByRow.push(
|
|
46
|
-
{
|
|
47
|
-
branchCode: `${column}-${i}`,
|
|
48
|
-
typeOf: 'Seat'
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
seats.push(...seatsByRow);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
console.log(seats);
|
|
58
|
-
// tslint:disable-next-line:non-literal-fs-path
|
|
59
|
-
fs.writeFileSync(`${__dirname}/createSeatsResult.json`, JSON.stringify(seats, null, ' '));
|
|
@@ -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 project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
11
|
-
|
|
12
|
-
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const cursor = eventRepo.getCursor(
|
|
15
|
-
{
|
|
16
|
-
'project.id': { $eq: project.id },
|
|
17
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
18
|
-
// 'superEvent.location.branchCode': { $eq: '118', $exists: true },
|
|
19
|
-
endDate: {
|
|
20
|
-
$exists: true,
|
|
21
|
-
$lt: moment()
|
|
22
|
-
.add(-1, 'month')
|
|
23
|
-
.toDate()
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
// _id: 1,
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
console.log('events found');
|
|
31
|
-
|
|
32
|
-
let i = 0;
|
|
33
|
-
let updateCount = 0;
|
|
34
|
-
await cursor.eachAsync(async (doc) => {
|
|
35
|
-
i += 1;
|
|
36
|
-
const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
|
|
37
|
-
|
|
38
|
-
console.log('deleting event...', event.project.id, event.id, event.startDate, i);
|
|
39
|
-
await eventRepo.deleteById({ id: event.id });
|
|
40
|
-
updateCount += 1;
|
|
41
|
-
console.log('deleted', event.project.id, event.id, event.startDate, i);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
console.log(i, 'events checked');
|
|
45
|
-
console.log(updateCount, 'events updated');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
main()
|
|
49
|
-
.then()
|
|
50
|
-
.catch(console.error);
|
|
@@ -1,35 +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 ownershipInfoId = '40576fe8-5e6a-4caa-9622-0944d6d9cf7b';
|
|
9
|
-
const newOwnerId = '600ad33b-8ed1-4a8c-ad50-694bec02ff12';
|
|
10
|
-
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
13
|
-
|
|
14
|
-
const ownershipInfoRepo = new chevre.repository.OwnershipInfo(mongoose.connection);
|
|
15
|
-
await ownershipInfoRepo.addOwnerIfNotExist({
|
|
16
|
-
id: ownershipInfoId,
|
|
17
|
-
ownedBy: {
|
|
18
|
-
id: newOwnerId,
|
|
19
|
-
typeOf: chevre.factory.personType.Person
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
console.log('added');
|
|
23
|
-
|
|
24
|
-
await ownershipInfoRepo.removeOwnerIfExist({
|
|
25
|
-
id: ownershipInfoId,
|
|
26
|
-
ownedBy: {
|
|
27
|
-
id: newOwnerId
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
console.log('removed');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
main()
|
|
34
|
-
.then()
|
|
35
|
-
.catch(console.error);
|
|
@@ -1,82 +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 eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
13
|
-
const productRepo = new chevre.repository.Product(mongoose.connection);
|
|
14
|
-
|
|
15
|
-
const cursor = eventRepo.getCursor(
|
|
16
|
-
{
|
|
17
|
-
// 'project.id': { $eq: project.id },
|
|
18
|
-
'project.id': { $ne: '' },
|
|
19
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
20
|
-
startDate: {
|
|
21
|
-
$gte: moment()
|
|
22
|
-
.add(-1, 'month')
|
|
23
|
-
.toDate()
|
|
24
|
-
}
|
|
25
|
-
// _id: { $eq: 'al6afd7np' }
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
// _id: 1,
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
console.log('events found');
|
|
32
|
-
|
|
33
|
-
let i = 0;
|
|
34
|
-
let updateCount = 0;
|
|
35
|
-
await cursor.eachAsync(async (doc) => {
|
|
36
|
-
i += 1;
|
|
37
|
-
const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
|
|
38
|
-
|
|
39
|
-
const itemOfferedId = (<chevre.factory.event.screeningEvent.IOffer | undefined>event.offers)?.itemOffered?.id;
|
|
40
|
-
const itemOfferedName = (<any>event.offers)?.itemOffered?.name?.ja;
|
|
41
|
-
|
|
42
|
-
if (typeof itemOfferedName === 'string' && itemOfferedName.length > 0) {
|
|
43
|
-
console.log(
|
|
44
|
-
'already exist...', event.project.id, event.id, event.startDate, itemOfferedId, i);
|
|
45
|
-
} else {
|
|
46
|
-
const existingProducts = await productRepo.search({
|
|
47
|
-
limit: 1,
|
|
48
|
-
page: 1,
|
|
49
|
-
project: { id: { $eq: event.project.id } },
|
|
50
|
-
id: { $eq: itemOfferedId }
|
|
51
|
-
});
|
|
52
|
-
const existingProduct = existingProducts.shift();
|
|
53
|
-
if (existingProduct === undefined) {
|
|
54
|
-
// throw new Error(`product not found ${event.id}`);
|
|
55
|
-
// no op
|
|
56
|
-
} else {
|
|
57
|
-
const newItemOfferedName: string = (typeof existingProduct.name === 'string')
|
|
58
|
-
? existingProduct.name
|
|
59
|
-
: String(existingProduct.name?.ja);
|
|
60
|
-
console.log(
|
|
61
|
-
'updating event...', event.project.id, event.id, event.startDate, itemOfferedId, newItemOfferedName, i);
|
|
62
|
-
await eventRepo.updatePartiallyById({
|
|
63
|
-
id: event.id,
|
|
64
|
-
attributes: <any>{
|
|
65
|
-
typeOf: event.typeOf,
|
|
66
|
-
'offers.itemOffered.name': { ja: newItemOfferedName }
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
updateCount += 1;
|
|
71
|
-
console.log(
|
|
72
|
-
'updated', event.project.id, event.id, event.startDate, itemOfferedId, i);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
console.log(i, 'events checked');
|
|
77
|
-
console.log(updateCount, 'events updated');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
main()
|
|
81
|
-
.then()
|
|
82
|
-
.catch(console.error);
|
|
@@ -1,92 +0,0 @@
|
|
|
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
|
-
type IMovieTicketPriceSpec =
|
|
8
|
-
chevre.factory.priceSpecification.IPriceSpecification<chevre.factory.priceSpecificationType.MovieTicketTypeChargeSpecification>;
|
|
9
|
-
const CREATING_VIDEO_FORMAT = 'all';
|
|
10
|
-
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
13
|
-
|
|
14
|
-
const priceSpecRepo = new chevre.repository.PriceSpecification(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = priceSpecRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
'project.id': { $eq: project.id },
|
|
19
|
-
typeOf: { $eq: chevre.factory.priceSpecificationType.MovieTicketTypeChargeSpecification }
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
// _id: 1,
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
console.log('priceSpecs found');
|
|
26
|
-
|
|
27
|
-
let i = 0;
|
|
28
|
-
let updateCount = 0;
|
|
29
|
-
await cursor.eachAsync(async (doc) => {
|
|
30
|
-
i += 1;
|
|
31
|
-
const priceSpec: IMovieTicketPriceSpec = doc.toObject();
|
|
32
|
-
const appliesToVideoFormat = priceSpec.appliesToVideoFormat;
|
|
33
|
-
|
|
34
|
-
if (appliesToVideoFormat === CREATING_VIDEO_FORMAT) {
|
|
35
|
-
console.log(
|
|
36
|
-
'appliesToVideoFormat is...',
|
|
37
|
-
CREATING_VIDEO_FORMAT,
|
|
38
|
-
priceSpec.project?.id, priceSpec.appliesToMovieTicket.serviceType, priceSpec.appliesToVideoFormat, priceSpec.price, i);
|
|
39
|
-
} else {
|
|
40
|
-
// 券種区分について、もうひとつの上映方式に対応する価格仕様が存在しなければ、作成する
|
|
41
|
-
const priceSpecs = await priceSpecRepo.search({
|
|
42
|
-
limit: 1,
|
|
43
|
-
page: 1,
|
|
44
|
-
project: { id: { $eq: project.id } },
|
|
45
|
-
typeOf: chevre.factory.priceSpecificationType.MovieTicketTypeChargeSpecification,
|
|
46
|
-
appliesToVideoFormats: [CREATING_VIDEO_FORMAT],
|
|
47
|
-
appliesToMovieTicket: {
|
|
48
|
-
serviceTypes: [priceSpec.appliesToMovieTicket.serviceType]
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
const priceSpec4all = priceSpecs.shift();
|
|
52
|
-
if (priceSpec4all !== undefined) {
|
|
53
|
-
console.log(
|
|
54
|
-
'already exist.',
|
|
55
|
-
priceSpec.project?.id, priceSpec.appliesToMovieTicket.serviceType, priceSpec.appliesToVideoFormat, priceSpec.price, i);
|
|
56
|
-
} else {
|
|
57
|
-
const newPriceSpec: IMovieTicketPriceSpec = {
|
|
58
|
-
typeOf: chevre.factory.priceSpecificationType.MovieTicketTypeChargeSpecification,
|
|
59
|
-
project: priceSpec.project,
|
|
60
|
-
price: priceSpec.price,
|
|
61
|
-
priceCurrency: priceSpec.priceCurrency,
|
|
62
|
-
name: priceSpec.name,
|
|
63
|
-
appliesToMovieTicket: priceSpec.appliesToMovieTicket,
|
|
64
|
-
appliesToVideoFormat: CREATING_VIDEO_FORMAT,
|
|
65
|
-
valueAddedTaxIncluded: true
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
console.log(
|
|
69
|
-
'creating priceSpec...',
|
|
70
|
-
priceSpec.project?.id,
|
|
71
|
-
newPriceSpec.appliesToMovieTicket.serviceType, newPriceSpec.appliesToVideoFormat, newPriceSpec.price, i);
|
|
72
|
-
await priceSpecRepo.save({
|
|
73
|
-
attributes: newPriceSpec
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
updateCount += 1;
|
|
77
|
-
console.log(
|
|
78
|
-
'created',
|
|
79
|
-
priceSpec.project?.id,
|
|
80
|
-
newPriceSpec.appliesToMovieTicket.serviceType, newPriceSpec.appliesToVideoFormat, newPriceSpec.price, i);
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
console.log(i, 'priceSpecs checked');
|
|
87
|
-
console.log(updateCount, 'priceSpecs updated');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
main()
|
|
91
|
-
.then()
|
|
92
|
-
.catch(console.error);
|
|
@@ -1,84 +0,0 @@
|
|
|
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
|
-
const AVAILABLE_ROLE_NAMES = ['customer', 'pos'];
|
|
9
|
-
|
|
10
|
-
async function main() {
|
|
11
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
12
|
-
|
|
13
|
-
const sellerRepo = new chevre.repository.Seller(mongoose.connection);
|
|
14
|
-
const memberRepo = new chevre.repository.Member(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = sellerRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
// 'project.id': { $eq: project.id },
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
// _id: 1,
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
console.log('sellers found');
|
|
25
|
-
|
|
26
|
-
let i = 0;
|
|
27
|
-
let updateCount = 0;
|
|
28
|
-
await cursor.eachAsync(async (doc) => {
|
|
29
|
-
i += 1;
|
|
30
|
-
const seller: chevre.factory.seller.ISeller = doc.toObject();
|
|
31
|
-
|
|
32
|
-
const makesOffer = seller.makesOffer;
|
|
33
|
-
|
|
34
|
-
if (Array.isArray(makesOffer) && makesOffer.length > 0) {
|
|
35
|
-
console.log(
|
|
36
|
-
'already exist...', seller.project.id, seller.id, makesOffer.length, i);
|
|
37
|
-
} else {
|
|
38
|
-
let existingApplicationMembers = await memberRepo.search({
|
|
39
|
-
limit: 100,
|
|
40
|
-
page: 1,
|
|
41
|
-
project: { id: { $eq: seller.project.id } },
|
|
42
|
-
member: {
|
|
43
|
-
typeOf: { $eq: chevre.factory.creativeWorkType.WebApplication }
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
// ロールで絞る(customer or pos)
|
|
47
|
-
existingApplicationMembers = existingApplicationMembers
|
|
48
|
-
.filter((m) => {
|
|
49
|
-
return Array.isArray(m.member.hasRole) && m.member.hasRole.some((r) => AVAILABLE_ROLE_NAMES.includes(r.roleName));
|
|
50
|
-
});
|
|
51
|
-
console.log(
|
|
52
|
-
existingApplicationMembers.length,
|
|
53
|
-
'existingApplicationMembers found.',
|
|
54
|
-
seller.project.id,
|
|
55
|
-
existingApplicationMembers.map((m) => m.member.name)
|
|
56
|
-
.join(',')
|
|
57
|
-
);
|
|
58
|
-
const newMakesOffer: chevre.factory.seller.IMakesOffer[] = existingApplicationMembers.map((a) => {
|
|
59
|
-
return {
|
|
60
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
61
|
-
availableAtOrFrom: [{ id: a.member.id }]
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
console.log(
|
|
65
|
-
'updating seller...', seller.project.id, seller.id, newMakesOffer.length, i);
|
|
66
|
-
await sellerRepo.save({
|
|
67
|
-
id: seller.id,
|
|
68
|
-
attributes: <any>{
|
|
69
|
-
makesOffer: newMakesOffer
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
updateCount += 1;
|
|
73
|
-
console.log(
|
|
74
|
-
'updated...', seller.project.id, seller.id, newMakesOffer.length, i);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
console.log(i, 'sellers checked');
|
|
79
|
-
console.log(updateCount, 'sellers updated');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
main()
|
|
83
|
-
.then()
|
|
84
|
-
.catch(console.error);
|
|
@@ -1,68 +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 eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const cursor = eventRepo.getCursor(
|
|
15
|
-
{
|
|
16
|
-
'project.id': { $eq: '' },
|
|
17
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
18
|
-
startDate: {
|
|
19
|
-
$gte: moment()
|
|
20
|
-
.add(-1, 'month')
|
|
21
|
-
.toDate()
|
|
22
|
-
}
|
|
23
|
-
// _id: { $eq: 'al6afd7np' }
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
// _id: 1,
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
console.log('events found');
|
|
30
|
-
|
|
31
|
-
let i = 0;
|
|
32
|
-
let updateCount = 0;
|
|
33
|
-
await cursor.eachAsync(async (doc) => {
|
|
34
|
-
i += 1;
|
|
35
|
-
const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
|
|
36
|
-
|
|
37
|
-
const oldEventId = event.additionalProperty?.find((p) => p.name === 'oldEventId')?.value;
|
|
38
|
-
|
|
39
|
-
if (typeof oldEventId === 'string' && event.id === oldEventId) {
|
|
40
|
-
console.log(
|
|
41
|
-
'already exist...', event.project.id, event.id, event.startDate, oldEventId, i);
|
|
42
|
-
} else {
|
|
43
|
-
const newAdditionalProperty: chevre.factory.propertyValue.IPropertyValue<string>[] = [
|
|
44
|
-
...(Array.isArray(event.additionalProperty)) ? event.additionalProperty : [],
|
|
45
|
-
{ name: 'oldEventId', value: String(event.id) }
|
|
46
|
-
];
|
|
47
|
-
console.log(
|
|
48
|
-
'updating event...', event.project.id, event.id, event.startDate, oldEventId, newAdditionalProperty, i);
|
|
49
|
-
await eventRepo.updatePartiallyById({
|
|
50
|
-
id: event.id,
|
|
51
|
-
attributes: <any>{
|
|
52
|
-
typeOf: event.typeOf,
|
|
53
|
-
additionalProperty: newAdditionalProperty
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
updateCount += 1;
|
|
57
|
-
console.log(
|
|
58
|
-
'updated', event.project.id, event.id, event.startDate, oldEventId, i);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
console.log(i, 'events checked');
|
|
63
|
-
console.log(updateCount, 'events updated');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
main()
|
|
67
|
-
.then()
|
|
68
|
-
.catch(console.error);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
import * as redis from 'redis';
|
|
5
|
-
|
|
6
|
-
import { chevre } from '../../../lib/index';
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
const client = redis.createClient({
|
|
10
|
-
host: process.env.REDIS_HOST,
|
|
11
|
-
port: Number(process.env.REDIS_PORT),
|
|
12
|
-
password: process.env.REDIS_KEY
|
|
13
|
-
});
|
|
14
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
15
|
-
|
|
16
|
-
const confirmationNumberRepo = new chevre.repository.ConfirmationNumber(client);
|
|
17
|
-
|
|
18
|
-
const confirmationNumber = await confirmationNumberRepo.publish({
|
|
19
|
-
orderDate: moment()
|
|
20
|
-
// .add(-1, 'month')
|
|
21
|
-
.toDate()
|
|
22
|
-
});
|
|
23
|
-
console.log(confirmationNumber);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
main()
|
|
27
|
-
.then(() => {
|
|
28
|
-
console.log('success!');
|
|
29
|
-
})
|
|
30
|
-
.catch(console.error);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
// import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
import * as redis from 'redis';
|
|
5
|
-
|
|
6
|
-
import { chevre } from '../../../lib/index';
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
const client = redis.createClient({
|
|
10
|
-
host: process.env.REDIS_HOST,
|
|
11
|
-
port: Number(process.env.REDIS_PORT),
|
|
12
|
-
password: process.env.REDIS_KEY
|
|
13
|
-
});
|
|
14
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
15
|
-
|
|
16
|
-
const serviceOutputIdentifierRepo = new chevre.repository.ServiceOutputIdentifier(client);
|
|
17
|
-
|
|
18
|
-
const identifier = await serviceOutputIdentifierRepo.publishByTimestamp({
|
|
19
|
-
startDate: new Date()
|
|
20
|
-
});
|
|
21
|
-
console.log(identifier);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
main()
|
|
25
|
-
.then(() => {
|
|
26
|
-
console.log('success!');
|
|
27
|
-
})
|
|
28
|
-
.catch(console.error);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
// import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
import * as redis from 'redis';
|
|
5
|
-
|
|
6
|
-
import { chevre } from '../../../lib/index';
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
const client = redis.createClient({
|
|
10
|
-
host: process.env.REDIS_HOST,
|
|
11
|
-
port: Number(process.env.REDIS_PORT),
|
|
12
|
-
password: process.env.REDIS_KEY
|
|
13
|
-
});
|
|
14
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
15
|
-
|
|
16
|
-
const transactionNumberRepo = new chevre.repository.TransactionNumber(client);
|
|
17
|
-
|
|
18
|
-
const reservationNumber = await transactionNumberRepo.publishByTimestamp({
|
|
19
|
-
startDate: new Date()
|
|
20
|
-
});
|
|
21
|
-
console.log(reservationNumber);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
main()
|
|
25
|
-
.then(() => {
|
|
26
|
-
console.log('success!');
|
|
27
|
-
})
|
|
28
|
-
.catch(console.error);
|