@chevre/domain 21.4.0-alpha.3 → 21.4.0-alpha.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/cleanActions.ts +23 -0
- package/example/src/chevre/cleanEventsByMovieTheater.ts +32 -0
- package/example/src/chevre/createDeleteTransactionTasksOfDeletedPeople.ts +126 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +6 -0
- package/example/src/chevre/iam/searchMemberOfIdsByMemberId.ts +31 -0
- package/example/src/chevre/iam/searchProjectIdsByMemberId.ts +32 -0
- package/example/src/chevre/migrateEventOrganizer.ts +125 -0
- package/example/src/chevre/migrateIAMMemberMemberOf.ts +59 -0
- package/example/src/chevre/migrateReservationProvider.ts +119 -0
- package/example/src/chevre/migrateScreeningRoomOrganizer.ts +91 -0
- package/example/src/chevre/processReserve.ts +0 -1
- package/example/src/chevre/searchEvents.ts +1 -9
- package/example/src/chevre/searchPermissions.ts +7 -15
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/repo/action.d.ts +6 -0
- package/lib/chevre/repo/action.js +13 -0
- package/lib/chevre/repo/assetTransaction.d.ts +4 -1
- package/lib/chevre/repo/assetTransaction.js +6 -12
- package/lib/chevre/repo/event.d.ts +25 -4
- package/lib/chevre/repo/event.js +122 -60
- package/lib/chevre/repo/member.d.ts +76 -1
- package/lib/chevre/repo/member.js +82 -20
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +7 -4
- package/lib/chevre/repo/mongoose/schemas/event.js +15 -2
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +7 -7
- package/lib/chevre/repo/mongoose/schemas/member.js +12 -6
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -6
- package/lib/chevre/repo/mongoose/schemas/place.js +9 -2
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +6 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.js +10 -4
- package/lib/chevre/repo/order.d.ts +21 -0
- package/lib/chevre/repo/order.js +54 -62
- package/lib/chevre/repo/place.d.ts +57 -16
- package/lib/chevre/repo/place.js +112 -167
- package/lib/chevre/repo/product.d.ts +2 -4
- package/lib/chevre/repo/product.js +52 -7
- package/lib/chevre/repo/reservation.d.ts +33 -21
- package/lib/chevre/repo/reservation.js +97 -79
- package/lib/chevre/repo/seller.d.ts +18 -5
- package/lib/chevre/repo/seller.js +53 -46
- package/lib/chevre/repo/stockHolder.d.ts +2 -77
- package/lib/chevre/repo/stockHolder.js +200 -476
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
- package/lib/chevre/service/assetTransaction/pay.js +9 -1
- package/lib/chevre/service/assetTransaction/registerService.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +10 -4
- package/lib/chevre/service/assetTransaction/reserve/factory.js +21 -40
- package/lib/chevre/service/assetTransaction/reserve.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/reserve.js +7 -22
- package/lib/chevre/service/event/createEvent.d.ts +11 -0
- package/lib/chevre/service/event/createEvent.js +112 -0
- package/lib/chevre/service/event.d.ts +2 -0
- package/lib/chevre/service/event.js +26 -26
- package/lib/chevre/service/iam.d.ts +5 -0
- package/lib/chevre/service/iam.js +7 -19
- package/lib/chevre/service/moneyTransfer.js +1 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
- package/lib/chevre/service/offer/event/authorize.js +6 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +16 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +1 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +8 -1
- package/lib/chevre/service/order/sendOrder.js +8 -1
- package/lib/chevre/service/payment/creditCard.js +9 -1
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +2 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
- package/lib/chevre/service/payment/movieTicket.js +19 -2
- package/lib/chevre/service/payment/paymentCard.js +1 -3
- package/lib/chevre/service/reserve/cancelReservation.js +15 -28
- package/lib/chevre/service/reserve/confirmReservation.js +14 -30
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +3 -1
- package/lib/chevre/service/task/{syncScreeningRooms.d.ts → createEvent.d.ts} +1 -1
- package/lib/chevre/service/task/{syncScreeningRooms.js → createEvent.js} +11 -3
- package/lib/chevre/service/task/onAuthorizationCreated.js +1 -0
- package/lib/chevre/service/task/returnPayTransaction.js +1 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
- package/lib/chevre/service/transaction/returnOrder.js +9 -3
- package/lib/chevre/settings.d.ts +0 -2
- package/lib/chevre/settings.js +7 -7
- package/package.json +3 -3
- package/example/src/chevre/findByOrderNumberAndReservationId.ts +0 -20
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +0 -27
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +0 -90
- package/example/src/chevre/migrateEventOffersItemOfferedTypeOf.ts +0 -75
- package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +0 -64
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +0 -79
- package/example/src/chevre/searchHoldReservations.ts +0 -38
- package/example/src/chevre/searchScreeningRooms.ts +0 -33
- package/example/src/chevre/syncScreeningRooms.ts +0 -21
- package/example/src/chevre/syncScreeningRoomsAll.ts +0 -41
- package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +0 -75
- package/lib/chevre/repo/mongoose/schemas/holdReservation.js +0 -93
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -39,8 +39,6 @@ export declare const DEFAULT_TASKS_EXPORT_AGENT_NAME: string;
|
|
|
39
39
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
40
40
|
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
41
41
|
export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
|
|
42
|
-
export declare const USE_NEW_STOCK_HOLDER_REPO_FROM: moment.Moment;
|
|
43
|
-
export declare const USE_NEW_STOCK_HOLDER_REPO_IDS: string[];
|
|
44
42
|
export declare const INFORM_RESERVATION_TASK_DELAY_IN_SECONDS: number;
|
|
45
43
|
export declare const MONGO_MAX_TIME_MS: number;
|
|
46
44
|
/**
|
package/lib/chevre/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.settings = exports.MONGO_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.
|
|
3
|
+
exports.settings = exports.MONGO_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
4
4
|
const moment = require("moment");
|
|
5
5
|
const factory = require("./factory");
|
|
6
6
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
@@ -65,12 +65,12 @@ exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TR
|
|
|
65
65
|
exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
|
|
66
66
|
? moment(process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM)
|
|
67
67
|
: moment('2023-08-31T15:00:00Z');
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
// export const USE_NEW_STOCK_HOLDER_REPO_FROM: moment.Moment = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_FROM === 'string')
|
|
69
|
+
// ? moment(process.env.USE_NEW_STOCK_HOLDER_REPO_FROM)
|
|
70
|
+
// : moment('2024-11-30T15:00:00Z');
|
|
71
|
+
// export const USE_NEW_STOCK_HOLDER_REPO_IDS: string[] = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_IDS === 'string')
|
|
72
|
+
// ? process.env.USE_NEW_STOCK_HOLDER_REPO_IDS.split(' ')
|
|
73
|
+
// : [];
|
|
74
74
|
exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = (typeof process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS === 'string')
|
|
75
75
|
? Number(process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS)
|
|
76
76
|
: 0;
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.316.0-alpha.6",
|
|
13
|
+
"@cinerino/sdk": "3.162.0-alpha.1",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.4.0-alpha.
|
|
120
|
+
"version": "21.4.0-alpha.31"
|
|
121
121
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
8
|
-
|
|
9
|
-
const orderRepo = new chevre.repository.Order(mongoose.connection);
|
|
10
|
-
|
|
11
|
-
const order = await orderRepo.findByOrderNumberAndReservationId({
|
|
12
|
-
orderNumber: 'CIN9-4783801-1618274',
|
|
13
|
-
reservationId: '139787058570943-0'
|
|
14
|
-
});
|
|
15
|
-
console.log('order found', order);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
main()
|
|
19
|
-
.then()
|
|
20
|
-
.catch(console.error);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
8
|
-
|
|
9
|
-
const placeRepo = new chevre.repository.Place(mongoose.connection);
|
|
10
|
-
|
|
11
|
-
const screeningRoom = await placeRepo.findScreeningRoomsByBranchCode({
|
|
12
|
-
branchCode: {
|
|
13
|
-
$eq: '20'
|
|
14
|
-
},
|
|
15
|
-
containedInPlace: {
|
|
16
|
-
id: {
|
|
17
|
-
$eq: '5bfb841d5a78d7948369979a'
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
console.log('room found', screeningRoom);
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
main()
|
|
26
|
-
.then(console.log)
|
|
27
|
-
.catch(console.error);
|
|
@@ -1,90 +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
|
-
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
10
|
-
|
|
11
|
-
// tslint:disable-next-line:max-func-body-length
|
|
12
|
-
async function main() {
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
14
|
-
|
|
15
|
-
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
16
|
-
|
|
17
|
-
const cursor = eventRepo.getCursor(
|
|
18
|
-
{
|
|
19
|
-
// 'project.id': { $eq: project.id },
|
|
20
|
-
'project.id': { $ne: EXCLUDED_PROJECT_ID },
|
|
21
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
22
|
-
startDate: {
|
|
23
|
-
$gte: moment()
|
|
24
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
25
|
-
.add(-6, 'months')
|
|
26
|
-
.toDate()
|
|
27
|
-
}
|
|
28
|
-
// _id: { $eq: 'al6aff83w' }
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
// _id: 1,
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
console.log('events found');
|
|
35
|
-
|
|
36
|
-
let i = 0;
|
|
37
|
-
let updateCount = 0;
|
|
38
|
-
await cursor.eachAsync(async (doc) => {
|
|
39
|
-
i += 1;
|
|
40
|
-
const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
|
|
41
|
-
|
|
42
|
-
const eventOffers = <chevre.factory.event.screeningEvent.IOffer | undefined>event.offers;
|
|
43
|
-
if (eventOffers === undefined) {
|
|
44
|
-
throw new Error('event.offers undefined');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const availableChannel = eventOffers.itemOffered.availableChannel;
|
|
48
|
-
|
|
49
|
-
const alreadyMigrated = availableChannel?.typeOf === 'ServiceChannel';
|
|
50
|
-
|
|
51
|
-
if (alreadyMigrated) {
|
|
52
|
-
console.log(
|
|
53
|
-
'already exist...', event.project.id, event.id, event.startDate, availableChannel.serviceLocation.branchCode, i);
|
|
54
|
-
} else {
|
|
55
|
-
const newAvailableChannel: chevre.factory.reservation.IServiceChannel = {
|
|
56
|
-
typeOf: 'ServiceChannel',
|
|
57
|
-
serviceLocation: {
|
|
58
|
-
typeOf: event.location.typeOf,
|
|
59
|
-
branchCode: event.location.branchCode,
|
|
60
|
-
name: event.location.name,
|
|
61
|
-
containedInPlace: {
|
|
62
|
-
typeOf: event.superEvent.location.typeOf,
|
|
63
|
-
id: event.superEvent.location.id,
|
|
64
|
-
branchCode: event.superEvent.location.branchCode,
|
|
65
|
-
name: event.superEvent.location.name
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
console.log(
|
|
70
|
-
'updating seller...', event.project.id, event.id, event.startDate, newAvailableChannel.serviceLocation.branchCode, i);
|
|
71
|
-
await eventRepo.updatePartiallyById({
|
|
72
|
-
id: event.id,
|
|
73
|
-
attributes: <any>{
|
|
74
|
-
typeOf: event.typeOf,
|
|
75
|
-
'offers.itemOffered.availableChannel': newAvailableChannel
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
updateCount += 1;
|
|
79
|
-
console.log(
|
|
80
|
-
'updated...', event.project.id, event.id, event.startDate, i);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
console.log(i, 'events checked');
|
|
85
|
-
console.log(updateCount, 'events updated');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
main()
|
|
89
|
-
.then()
|
|
90
|
-
.catch(console.error);
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
13
|
-
|
|
14
|
-
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = eventRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
// 'project.id': { $eq: project.id },
|
|
19
|
-
'project.id': { $ne: EXCLUDED_PROJECT_ID },
|
|
20
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
21
|
-
startDate: {
|
|
22
|
-
$gte: moment()
|
|
23
|
-
.add(-1, 'month')
|
|
24
|
-
.toDate()
|
|
25
|
-
}
|
|
26
|
-
// _id: { $eq: 'al6aff83w' }
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
// _id: 1,
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
console.log('events found');
|
|
33
|
-
|
|
34
|
-
let i = 0;
|
|
35
|
-
let updateCount = 0;
|
|
36
|
-
await cursor.eachAsync(async (doc) => {
|
|
37
|
-
i += 1;
|
|
38
|
-
const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
|
|
39
|
-
|
|
40
|
-
// IAMメンバー検索
|
|
41
|
-
const eventOffers = <chevre.factory.event.screeningEvent.IOffer | undefined>event.offers;
|
|
42
|
-
if (eventOffers === undefined) {
|
|
43
|
-
throw new Error('event.offers undefined');
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const itemOfferedTypeOf = eventOffers.itemOffered.typeOf;
|
|
47
|
-
|
|
48
|
-
const alreadyMigrated = itemOfferedTypeOf === chevre.factory.product.ProductType.EventService;
|
|
49
|
-
|
|
50
|
-
if (alreadyMigrated) {
|
|
51
|
-
console.log(
|
|
52
|
-
'already exist...', event.project.id, event.id, event.startDate, itemOfferedTypeOf, i);
|
|
53
|
-
} else {
|
|
54
|
-
console.log(
|
|
55
|
-
'updating seller...', event.project.id, event.id, event.startDate, i);
|
|
56
|
-
await eventRepo.updatePartiallyById({
|
|
57
|
-
id: event.id,
|
|
58
|
-
attributes: <any>{
|
|
59
|
-
typeOf: event.typeOf,
|
|
60
|
-
'offers.itemOffered.typeOf': chevre.factory.product.ProductType.EventService
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
updateCount += 1;
|
|
64
|
-
console.log(
|
|
65
|
-
'updated...', event.project.id, event.id, event.startDate, i);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
console.log(i, 'events checked');
|
|
70
|
-
console.log(updateCount, 'events updated');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
main()
|
|
74
|
-
.then()
|
|
75
|
-
.catch(console.error);
|
|
@@ -1,64 +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
|
-
const DELETING_PROPERTY_NAME: string = 'COA_ENDPOINT';
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
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.ScreeningEventSeries }
|
|
18
|
-
// typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
19
|
-
// startDate: { $gte: new Date() }
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
// _id: 1,
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
console.log('events found');
|
|
26
|
-
|
|
27
|
-
let i = 0;
|
|
28
|
-
let updateCount = 0;
|
|
29
|
-
await cursor.eachAsync(async (doc) => {
|
|
30
|
-
i += 1;
|
|
31
|
-
const event: chevre.factory.event.IEvent<chevre.factory.eventType> = doc.toObject();
|
|
32
|
-
|
|
33
|
-
const coaEndpointPropert = event.additionalProperty?.find((p) => p.name === DELETING_PROPERTY_NAME);
|
|
34
|
-
|
|
35
|
-
if (coaEndpointPropert !== undefined) {
|
|
36
|
-
const newAdditionalProperty: chevre.factory.propertyValue.IPropertyValue<string>[] =
|
|
37
|
-
(Array.isArray(event.additionalProperty))
|
|
38
|
-
? event.additionalProperty.filter((p) => {
|
|
39
|
-
return p.name !== DELETING_PROPERTY_NAME;
|
|
40
|
-
})
|
|
41
|
-
: [];
|
|
42
|
-
console.log(
|
|
43
|
-
'updating event...', event.project.id, event.id, event.startDate, coaEndpointPropert.value, newAdditionalProperty, i);
|
|
44
|
-
await eventRepo.updatePartiallyById({
|
|
45
|
-
id: event.id,
|
|
46
|
-
attributes: <any>{
|
|
47
|
-
typeOf: event.typeOf,
|
|
48
|
-
additionalProperty: newAdditionalProperty
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
updateCount += 1;
|
|
52
|
-
console.log('event updated', event.project.id, event.id, event.startDate, i);
|
|
53
|
-
} else {
|
|
54
|
-
console.log('no property...', event.project.id, event.id, event.startDate, i);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
console.log(i, 'events checked');
|
|
59
|
-
console.log(updateCount, 'events updated');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
main()
|
|
63
|
-
.then()
|
|
64
|
-
.catch(console.error);
|
|
@@ -1,79 +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 = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
|
|
8
|
-
|
|
9
|
-
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
10
|
-
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = eventRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
'project.id': {
|
|
19
|
-
// $eq: project.id,
|
|
20
|
-
$ne: EXCLUDED_PROJECT_ID
|
|
21
|
-
},
|
|
22
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries },
|
|
23
|
-
'workPerformed.version': { $exists: false }
|
|
24
|
-
// _id: { $eq: 'bl7ed6sq9' }
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
_id: 1,
|
|
28
|
-
workPerformed: 1,
|
|
29
|
-
project: 1,
|
|
30
|
-
location: 1,
|
|
31
|
-
startDate: 1,
|
|
32
|
-
typeOf: 1
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
console.log('events found');
|
|
36
|
-
|
|
37
|
-
let i = 0;
|
|
38
|
-
let updateCount = 0;
|
|
39
|
-
await cursor.eachAsync(async (doc) => {
|
|
40
|
-
i += 1;
|
|
41
|
-
const event: chevre.factory.event.screeningEventSeries.IEvent = doc.toObject();
|
|
42
|
-
const version = event.workPerformed.version;
|
|
43
|
-
|
|
44
|
-
const alreadyMigrated = typeof version === 'string' && version.length > 0;
|
|
45
|
-
|
|
46
|
-
if (alreadyMigrated) {
|
|
47
|
-
console.log('alreadyMigrated.', event.project.id, event.id, event.startDate, version, i);
|
|
48
|
-
} else {
|
|
49
|
-
// 既存施設コンテンツバージョンを検索
|
|
50
|
-
const { maxVersion } = await eventRepo.aggregateScreeningEventMaxVersion({
|
|
51
|
-
project: { id: { $eq: event.project.id } },
|
|
52
|
-
workPerformed: { identifier: { $eq: event.workPerformed.identifier } },
|
|
53
|
-
location: { branchCode: { $in: [event.location.branchCode] } }
|
|
54
|
-
});
|
|
55
|
-
console.log('maxVersion:', maxVersion);
|
|
56
|
-
|
|
57
|
-
const newVersion: string = `${Number(maxVersion) + 1}`;
|
|
58
|
-
console.log('updating event...', event.project.id, event.id, event.startDate, newVersion, i);
|
|
59
|
-
await eventRepo.updatePartiallyById({
|
|
60
|
-
id: event.id,
|
|
61
|
-
attributes: <any>{
|
|
62
|
-
typeOf: event.typeOf,
|
|
63
|
-
'workPerformed.version': newVersion
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
updateCount += 1;
|
|
67
|
-
console.log('updated.', event.project.id, event.id, event.startDate, newVersion, i);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
console.log(i, 'events checked');
|
|
72
|
-
console.log(updateCount, 'events updated');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
main()
|
|
76
|
-
.then(() => {
|
|
77
|
-
console.log('success!');
|
|
78
|
-
})
|
|
79
|
-
.catch(console.error);
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
// import * as redis from 'redis';
|
|
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
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: true });
|
|
10
|
-
const client = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
|
|
11
|
-
socket: {
|
|
12
|
-
host: process.env.REDIS_HOST,
|
|
13
|
-
port: Number(process.env.REDIS_PORT)
|
|
14
|
-
},
|
|
15
|
-
password: process.env.REDIS_KEY
|
|
16
|
-
});
|
|
17
|
-
await client.connect();
|
|
18
|
-
|
|
19
|
-
const stockHolderRepo = new chevre.repository.StockHolder(client, mongoose.connection);
|
|
20
|
-
|
|
21
|
-
const holdReservations = await stockHolderRepo.search({
|
|
22
|
-
limit: 2,
|
|
23
|
-
page: 2,
|
|
24
|
-
sort: { 'reservationFor.startDate': chevre.factory.sortType.Ascending }
|
|
25
|
-
});
|
|
26
|
-
console.log(holdReservations);
|
|
27
|
-
console.log(holdReservations.length);
|
|
28
|
-
|
|
29
|
-
// const aggregations = await stockHolderRepo.aggregateByReservationFor({
|
|
30
|
-
// limit: 100,
|
|
31
|
-
// page: 1
|
|
32
|
-
// });
|
|
33
|
-
// console.log(aggregations);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
main()
|
|
37
|
-
.then(console.log)
|
|
38
|
-
.catch(console.error);
|
|
@@ -1,33 +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
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
const placeRepo = new chevre.repository.Place(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
const rooms = await placeRepo.searchScreeningRooms(
|
|
14
|
-
{
|
|
15
|
-
limit: 10,
|
|
16
|
-
page: 1,
|
|
17
|
-
$projection: { sectionCount: 1 }
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
console.log('place found', rooms);
|
|
21
|
-
const filteredRooms = rooms.filter((room) => typeof room.sectionCount === 'number' && room.sectionCount > 1);
|
|
22
|
-
console.log(filteredRooms.length, 'filteredRooms found');
|
|
23
|
-
|
|
24
|
-
const screeningRoom = await placeRepo.findScreeningRoomsByBranchCode({
|
|
25
|
-
branchCode: { $eq: rooms[0].branchCode },
|
|
26
|
-
containedInPlace: { id: { $eq: String(rooms[0].containedInPlace?.id) } }
|
|
27
|
-
});
|
|
28
|
-
console.log('screeningRoom found', screeningRoom);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
main()
|
|
32
|
-
.then(console.log)
|
|
33
|
-
.catch(console.error);
|
|
@@ -1,21 +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
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
const placeRepo = new chevre.repository.Place(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
await placeRepo.syncScreeningRooms({
|
|
14
|
-
id: '60409176f60a46000a7a3787'
|
|
15
|
-
});
|
|
16
|
-
console.log('synced');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
main()
|
|
20
|
-
.then(console.log)
|
|
21
|
-
.catch(console.error);
|
|
@@ -1,41 +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
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
const placeRepo = new chevre.repository.Place(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
const cursor = placeRepo.getCursor(
|
|
14
|
-
{
|
|
15
|
-
typeOf: { $eq: chevre.factory.placeType.MovieTheater }
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
_id: 1,
|
|
19
|
-
name: 1,
|
|
20
|
-
project: 1,
|
|
21
|
-
typeOf: 1
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
console.log('places found');
|
|
25
|
-
|
|
26
|
-
let i = 0;
|
|
27
|
-
await cursor.eachAsync(async (doc) => {
|
|
28
|
-
i += 1;
|
|
29
|
-
const { id, name, project, typeOf } = <Pick<chevre.factory.place.movieTheater.IPlace, 'id' | 'name' | 'project' | 'typeOf'>>
|
|
30
|
-
doc.toObject();
|
|
31
|
-
|
|
32
|
-
console.log('syncing...', project.id, typeOf, id, name.ja, i);
|
|
33
|
-
await placeRepo.syncScreeningRooms({ id });
|
|
34
|
-
console.log('synced.', project.id, typeOf, id, name.ja, i);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
main()
|
|
40
|
-
.then(console.log)
|
|
41
|
-
.catch(console.error);
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
-
/// <reference types="mongoose/types/callback" />
|
|
3
|
-
/// <reference types="mongoose/types/collection" />
|
|
4
|
-
/// <reference types="mongoose/types/connection" />
|
|
5
|
-
/// <reference types="mongoose/types/cursor" />
|
|
6
|
-
/// <reference types="mongoose/types/document" />
|
|
7
|
-
/// <reference types="mongoose/types/error" />
|
|
8
|
-
/// <reference types="mongoose/types/expressions" />
|
|
9
|
-
/// <reference types="mongoose/types/helpers" />
|
|
10
|
-
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
-
/// <reference types="mongoose/types/indexes" />
|
|
12
|
-
/// <reference types="mongoose/types/models" />
|
|
13
|
-
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
-
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
-
/// <reference types="mongoose/types/populate" />
|
|
16
|
-
/// <reference types="mongoose/types/query" />
|
|
17
|
-
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
-
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
-
/// <reference types="mongoose/types/session" />
|
|
20
|
-
/// <reference types="mongoose/types/types" />
|
|
21
|
-
/// <reference types="mongoose/types/utility" />
|
|
22
|
-
/// <reference types="mongoose/types/validation" />
|
|
23
|
-
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
-
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import { Schema } from 'mongoose';
|
|
26
|
-
declare const modelName = "HoldReservation";
|
|
27
|
-
/**
|
|
28
|
-
* 保留予約スキーマ
|
|
29
|
-
*/
|
|
30
|
-
declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
31
|
-
collection: string;
|
|
32
|
-
id: true;
|
|
33
|
-
read: string;
|
|
34
|
-
writeConcern: import("mongodb").WriteConcern;
|
|
35
|
-
strict: true;
|
|
36
|
-
strictQuery: false;
|
|
37
|
-
useNestedStrict: boolean;
|
|
38
|
-
timestamps: {
|
|
39
|
-
createdAt: string;
|
|
40
|
-
updatedAt: string;
|
|
41
|
-
};
|
|
42
|
-
toJSON: {
|
|
43
|
-
getters: false;
|
|
44
|
-
virtuals: false;
|
|
45
|
-
minimize: false;
|
|
46
|
-
versionKey: false;
|
|
47
|
-
};
|
|
48
|
-
toObject: {
|
|
49
|
-
getters: false;
|
|
50
|
-
virtuals: true;
|
|
51
|
-
minimize: false;
|
|
52
|
-
versionKey: false;
|
|
53
|
-
};
|
|
54
|
-
}, {
|
|
55
|
-
typeOf: string;
|
|
56
|
-
project: any;
|
|
57
|
-
reservationFor: any;
|
|
58
|
-
reservations: any[];
|
|
59
|
-
reservationCount: number;
|
|
60
|
-
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
61
|
-
typeOf: string;
|
|
62
|
-
project: any;
|
|
63
|
-
reservationFor: any;
|
|
64
|
-
reservations: any[];
|
|
65
|
-
reservationCount: number;
|
|
66
|
-
}>> & Omit<import("mongoose").FlatRecord<{
|
|
67
|
-
typeOf: string;
|
|
68
|
-
project: any;
|
|
69
|
-
reservationFor: any;
|
|
70
|
-
reservations: any[];
|
|
71
|
-
reservationCount: number;
|
|
72
|
-
}> & {
|
|
73
|
-
_id: import("mongoose").Types.ObjectId;
|
|
74
|
-
}, never>>;
|
|
75
|
-
export { modelName, schema };
|