@chevre/domain 20.1.0-alpha.9 → 20.2.0-alpha.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/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 +17 -5
- 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 +6 -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 +24 -0
- package/lib/chevre/repo/mongoose/model/trip.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/trip.js +51 -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 +55 -8
- 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/repo/trip.d.ts +54 -0
- package/lib/chevre/repo/trip.js +222 -0
- package/lib/chevre/repository.d.ts +9 -3
- package/lib/chevre/repository.js +13 -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 +7 -18
- package/lib/chevre/service/assetTransaction/reserve/factory.js +81 -113
- package/lib/chevre/service/assetTransaction/reserve.js +41 -95
- package/lib/chevre/service/event.js +20 -6
- package/lib/chevre/service/offer/event/authorize.d.ts +3 -0
- package/lib/chevre/service/offer/event/authorize.js +32 -21
- 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 +32 -22
- 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 -28
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +14 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +10 -6
- 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.js +10 -1
- 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/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
|
@@ -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,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);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
// import * as redis from 'redis';
|
|
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
|
-
// Access the underlying database object provided by the MongoDB driver.
|
|
11
|
-
const db = mongoose.connection.db;
|
|
12
|
-
|
|
13
|
-
// Rename the `test` collection to `foobar`
|
|
14
|
-
const result = await db.collection('transactions')
|
|
15
|
-
.rename('assetTransactions', { dropTarget: true });
|
|
16
|
-
|
|
17
|
-
console.log(result);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
main()
|
|
21
|
-
.then(console.log)
|
|
22
|
-
.catch(console.error);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.call = void 0;
|
|
13
|
-
const account_1 = require("../../repo/account");
|
|
14
|
-
const accountAction_1 = require("../../repo/accountAction");
|
|
15
|
-
const accountTransaction_1 = require("../../repo/accountTransaction");
|
|
16
|
-
const AccountService = require("../account");
|
|
17
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
18
|
-
/* istanbul ignore next */
|
|
19
|
-
function call(data) {
|
|
20
|
-
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const accountRepo = new account_1.MongoRepository(settings.connection);
|
|
22
|
-
const accountActionRepo = new accountAction_1.MongoRepository(settings.connection);
|
|
23
|
-
const accountTransactionRepo = new accountTransaction_1.MongoRepository(settings.connection);
|
|
24
|
-
yield AccountService.transferMoney(data.actionAttributes)({
|
|
25
|
-
account: accountRepo,
|
|
26
|
-
accountAction: accountActionRepo,
|
|
27
|
-
accountTransaction: accountTransactionRepo
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
exports.call = call;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.call = void 0;
|
|
13
|
-
const account_1 = require("../../repo/account");
|
|
14
|
-
const accountAction_1 = require("../../repo/accountAction");
|
|
15
|
-
const accountTransaction_1 = require("../../repo/accountTransaction");
|
|
16
|
-
const AccountService = require("../account");
|
|
17
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
18
|
-
/* istanbul ignore next */
|
|
19
|
-
function call(data) {
|
|
20
|
-
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const accountRepo = new account_1.MongoRepository(settings.connection);
|
|
22
|
-
const actionRepo = new accountAction_1.MongoRepository(settings.connection);
|
|
23
|
-
const transactionRepo = new accountTransaction_1.MongoRepository(settings.connection);
|
|
24
|
-
yield AccountService.cancelMoneyTransfer({
|
|
25
|
-
transaction: data.transaction
|
|
26
|
-
})({
|
|
27
|
-
account: accountRepo,
|
|
28
|
-
accountAction: actionRepo,
|
|
29
|
-
accountTransaction: transactionRepo
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
exports.call = call;
|