@chevre/domain 23.2.0-alpha.6 → 23.2.0-alpha.61
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/acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts +25 -17
- package/example/src/chevre/confirmationNumber/testRandomness.ts +49 -0
- package/example/src/chevre/emailMessage/createEmailMessageText.ts +63 -0
- package/example/src/chevre/event/importEventsFromCOAByTitle.ts +2 -2
- package/example/src/chevre/event/unsetSuperEventVideoFormat.ts +30 -0
- package/example/src/chevre/eventSeries/unsetVideoFormat.ts +31 -0
- package/example/src/chevre/{upsertScreeningEventSeriesByVersion.ts → eventSeries/upsertScreeningEventSeriesByVersion.ts} +47 -43
- package/example/src/chevre/{upsertOfferCatalogItemsByIdentifier.ts → offerCatalog/upsertOfferCatalogItemsByIdentifier.ts} +6 -3
- package/example/src/chevre/{upsertOfferCatalogsByIdentifier.ts → offerCatalog/upsertOfferCatalogsByIdentifier.ts} +8 -3
- package/example/src/chevre/{upsertOffersByIdentifier.ts → offers/upsertOffersByIdentifier.ts} +5 -3
- package/example/src/chevre/orderNumber/testRandomness.ts +54 -0
- package/example/src/chevre/place/adminEntranceGates.ts +69 -0
- package/example/src/chevre/place/checkEntranceGatesCount.ts +82 -0
- package/example/src/chevre/place/findRooms.ts +24 -0
- package/example/src/chevre/place/findSections.ts +28 -0
- package/example/src/chevre/place/migrateSectionIdentifier.ts +92 -0
- package/example/src/chevre/place/seatsJson2csv.ts +63 -0
- package/example/src/chevre/place/upsertMovieTheatersByBranchCode.ts +41 -0
- package/example/src/chevre/place/upsertRoomsByBranchCode.ts +40 -0
- package/example/src/chevre/place/upsertSeatSectionsByBranchCode.ts +56 -0
- package/example/src/chevre/reIndex.ts +1 -1
- package/example/src/chevre/roles/addAdminAcceptedPaymentMethodReadPermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminAcceptedPaymentMethodWritePermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +34 -0
- package/example/src/chevre/settings/addOrderNumberSetting.ts +44 -0
- package/example/src/chevre/settings/addTransactionNumberSetting.ts +40 -0
- package/example/src/chevre/transactionNumber/publishByTimestamp.ts +23 -0
- package/example/src/chevre/transactionNumber/testRandomness.ts +42 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +8 -4
- package/lib/chevre/emailMessageBuilder.js +1 -0
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/factory/event.js +11 -5
- package/lib/chevre/factory/transactionNumber.d.ts +19 -0
- package/lib/chevre/factory/transactionNumber.js +54 -0
- package/lib/chevre/repo/acceptedPaymentMethod.d.ts +41 -8
- package/lib/chevre/repo/acceptedPaymentMethod.js +72 -27
- package/lib/chevre/repo/aggregateOffer.d.ts +6 -1
- package/lib/chevre/repo/aggregateOffer.js +11 -3
- package/lib/chevre/repo/aggregateOrder.js +0 -93
- package/lib/chevre/repo/aggregateReservation.d.ts +0 -1
- package/lib/chevre/repo/aggregateReservation.js +0 -2
- package/lib/chevre/repo/confirmationNumber.d.ts +1 -0
- package/lib/chevre/repo/confirmationNumber.js +32 -25
- package/lib/chevre/repo/event.d.ts +3 -18
- package/lib/chevre/repo/event.js +94 -83
- package/lib/chevre/repo/eventOffer.d.ts +8 -0
- package/lib/chevre/repo/eventOffer.js +11 -0
- package/lib/chevre/repo/eventSeries.d.ts +17 -30
- package/lib/chevre/repo/eventSeries.js +204 -146
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -1
- package/lib/chevre/repo/mongoose/schemas/eventSeries.js +20 -5
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +2 -8
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +28 -2
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -2
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +40 -0
- package/lib/chevre/repo/mongoose/schemas/setting.js +3 -0
- package/lib/chevre/repo/offerCatalog.d.ts +14 -1
- package/lib/chevre/repo/offerCatalog.js +41 -19
- package/lib/chevre/repo/offerCatalogItem.d.ts +10 -1
- package/lib/chevre/repo/offerCatalogItem.js +32 -17
- package/lib/chevre/repo/orderNumber.d.ts +6 -0
- package/lib/chevre/repo/orderNumber.js +110 -35
- package/lib/chevre/repo/place/entranceGate.d.ts +57 -0
- package/lib/chevre/repo/place/entranceGate.js +172 -0
- package/lib/chevre/repo/place/movieTheater.d.ts +40 -3
- package/lib/chevre/repo/place/movieTheater.js +77 -6
- package/lib/chevre/repo/place/screeningRoom.d.ts +60 -31
- package/lib/chevre/repo/place/screeningRoom.js +227 -135
- package/lib/chevre/repo/place/seat.d.ts +47 -45
- package/lib/chevre/repo/place/seat.js +175 -45
- package/lib/chevre/repo/place/section.d.ts +60 -30
- package/lib/chevre/repo/place/section.js +337 -127
- package/lib/chevre/repo/serviceOutputIdentifier.d.ts +3 -1
- package/lib/chevre/repo/serviceOutputIdentifier.js +42 -27
- package/lib/chevre/repo/setting.d.ts +1 -1
- package/lib/chevre/repo/setting.js +2 -2
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/repo/transactionNumber.d.ts +5 -0
- package/lib/chevre/repo/transactionNumber.js +63 -27
- package/lib/chevre/repository.d.ts +8 -0
- package/lib/chevre/repository.js +16 -0
- package/lib/chevre/service/assetTransaction/fixInformAction.d.ts +3 -0
- package/lib/chevre/service/assetTransaction/fixInformAction.js +3 -0
- package/lib/chevre/service/assetTransaction/pay/cancel.d.ts +12 -0
- package/lib/chevre/service/assetTransaction/pay/cancel.js +25 -0
- package/lib/chevre/service/assetTransaction/pay/check.d.ts +23 -0
- package/lib/chevre/service/assetTransaction/pay/check.js +37 -0
- package/lib/chevre/service/assetTransaction/pay/confirm.d.ts +24 -0
- package/lib/chevre/service/assetTransaction/pay/confirm.js +72 -0
- package/lib/chevre/service/assetTransaction/pay/exportTasksById.d.ts +18 -0
- package/lib/chevre/service/assetTransaction/pay/exportTasksById.js +111 -0
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.d.ts +48 -0
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +164 -0
- package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.d.ts +20 -0
- package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.js +59 -0
- package/lib/chevre/service/assetTransaction/pay/{account → start/account}/validation.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/pay/{account → start/account}/validation.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/{factory.d.ts → start/factory.d.ts} +1 -1
- package/lib/chevre/service/assetTransaction/pay/{factory.js → start/factory.js} +1 -1
- package/lib/chevre/service/assetTransaction/pay/{validateAcceptedPaymentMethodIfNeeded.d.ts → start/preStart/validateAcceptedPaymentMethodIfNeeded.d.ts} +4 -4
- package/lib/chevre/service/assetTransaction/pay/{validateAcceptedPaymentMethodIfNeeded.js → start/preStart/validateAcceptedPaymentMethodIfNeeded.js} +1 -4
- package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.d.ts +8 -0
- package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.js +54 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeAccount.d.ts +13 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeAccount.js +49 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeCreditCard.d.ts +29 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeCreditCard.js +37 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +42 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.js +31 -0
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +60 -0
- package/lib/chevre/service/assetTransaction/pay/start.js +145 -0
- package/lib/chevre/service/assetTransaction/pay.d.ts +8 -170
- package/lib/chevre/service/assetTransaction/pay.js +16 -623
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +10 -2
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
- package/lib/chevre/service/event/processUpdateMovieTheater.js +13 -11
- package/lib/chevre/service/event/saveScreeningEventSeries.js +4 -5
- package/lib/chevre/service/event/saveScreeningEvents.d.ts +2 -2
- package/lib/chevre/service/event/saveScreeningEvents.js +16 -12
- package/lib/chevre/service/offer/event/authorize/factory.js +9 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +7 -4
- package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +9 -6
- package/lib/chevre/service/offer/event/searchOffersByIds.js +7 -4
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +7 -1
- package/lib/chevre/service/offer/onEventChanged.js +10 -6
- package/lib/chevre/service/offer/product.js +1 -1
- package/lib/chevre/service/offer.d.ts +5 -0
- package/lib/chevre/service/offer.js +34 -9
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +13 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +53 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +13 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +56 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +15 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +58 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +17 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +75 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +19 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +60 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +20 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +51 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +27 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +100 -0
- package/lib/chevre/service/task/onResourceDeleted.d.ts +6 -0
- package/lib/chevre/service/task/onResourceDeleted.js +168 -0
- package/lib/chevre/service/task/onResourceUpdated.js +205 -42
- package/lib/chevre/service/task/syncResourcesFromCOA.js +4 -2
- package/lib/chevre/service/taskHandler.js +1 -0
- package/package.json +9 -9
- package/example/src/chevre/event/upsertManyScreeningEventByIdentifier.ts +0 -191
- package/example/src/chevre/eventSeries/migrateEventSeriesUnacceptedPaymentMethod.ts +0 -93
- package/example/src/chevre/offers/createSampleOffers.ts +0 -154
- package/example/src/chevre/settings/addSettings.ts +0 -46
- package/lib/chevre/service/eventOld.d.ts +0 -60
- package/lib/chevre/service/eventOld.js +0 -864
- package/lib/chevre/service/task/createEvent/createEvent.d.ts +0 -25
- package/lib/chevre/service/task/createEvent/createEvent.js +0 -45
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +0 -22
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +0 -188
- package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.d.ts +0 -15
- package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +0 -116
- package/lib/chevre/service/task/createEvent/createEventBySchedule.d.ts +0 -25
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +0 -107
- package/lib/chevre/service/task/createEvent/createEventSeries.d.ts +0 -13
- package/lib/chevre/service/task/createEvent/createEventSeries.js +0 -118
- package/lib/chevre/service/task/createEvent.d.ts +0 -6
- package/lib/chevre/service/task/createEvent.js +0 -46
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +0 -45
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +0 -447
|
@@ -0,0 +1,24 @@
|
|
|
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 roomRepo = await chevre.repository.place.ScreeningRoom.createInstance(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const rooms = await roomRepo.findRooms({
|
|
14
|
+
limit: 20,
|
|
15
|
+
page: 1,
|
|
16
|
+
project: { id: { $eq: project.id } }
|
|
17
|
+
});
|
|
18
|
+
console.log(rooms);
|
|
19
|
+
console.log(rooms.length);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
main()
|
|
23
|
+
.then(console.log)
|
|
24
|
+
.catch(console.error);
|
|
@@ -0,0 +1,28 @@
|
|
|
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 sectionRepo = await chevre.repository.place.Section.createInstance(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const sections = await sectionRepo.findSections({
|
|
14
|
+
limit: 10,
|
|
15
|
+
page: 1,
|
|
16
|
+
project: { id: { $eq: project.id } },
|
|
17
|
+
containedInPlace: {
|
|
18
|
+
branchCode: { $eq: '10' },
|
|
19
|
+
containedInPlace: { id: { $eq: '5bfb841d5a78d7948369979a' } }
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
console.log(sections);
|
|
23
|
+
console.log(sections.length);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
main()
|
|
27
|
+
.then(console.log)
|
|
28
|
+
.catch(console.error);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment-timezone';
|
|
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 excludedProject = { id: String(process.env.EXCLUDED_PROJECT_ID) };
|
|
9
|
+
|
|
10
|
+
// tslint:disable-next-line:max-func-body-length
|
|
11
|
+
async function main() {
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
+
|
|
14
|
+
const roomRepo = await chevre.repository.place.ScreeningRoom.createInstance(mongoose.connection);
|
|
15
|
+
const sectionRepo = await chevre.repository.place.Section.createInstance(mongoose.connection);
|
|
16
|
+
|
|
17
|
+
const cursor = roomRepo.getCursor(
|
|
18
|
+
{
|
|
19
|
+
'project.id': {
|
|
20
|
+
$ne: 'sskts-development',
|
|
21
|
+
$eq: 'ttts-development'
|
|
22
|
+
}
|
|
23
|
+
// _id: { $eq: '67de46777ec0510590b68922' }
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
// _id: 1,
|
|
27
|
+
// about: 1,
|
|
28
|
+
// project: 1,
|
|
29
|
+
// typeOf: 1,
|
|
30
|
+
// issuedBy: 1
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
console.log('docs found');
|
|
34
|
+
|
|
35
|
+
const timestamp = moment()
|
|
36
|
+
.tz('Asia/Tokyo')
|
|
37
|
+
.format('YYYYMMDDHHmmss');
|
|
38
|
+
|
|
39
|
+
let i = 0;
|
|
40
|
+
let updateCount = 0;
|
|
41
|
+
await cursor.eachAsync(async (doc) => {
|
|
42
|
+
const room: chevre.factory.place.screeningRoom.IPlace = doc.toObject();
|
|
43
|
+
|
|
44
|
+
const sections = room.containsPlace;
|
|
45
|
+
if (Array.isArray(sections)) {
|
|
46
|
+
for (const section of sections) {
|
|
47
|
+
i += 1;
|
|
48
|
+
const movieTheaterCode = room.containedInPlace?.branchCode;
|
|
49
|
+
if (typeof movieTheaterCode !== 'string') {
|
|
50
|
+
throw new Error('movieTheaterCode undefined');
|
|
51
|
+
}
|
|
52
|
+
const alreadyMigrated = typeof (<any>section).identifier === 'string';
|
|
53
|
+
|
|
54
|
+
if (alreadyMigrated) {
|
|
55
|
+
console.log(
|
|
56
|
+
'already migrated.', room.project.id, movieTheaterCode, room.branchCode, section.branchCode, i);
|
|
57
|
+
} else {
|
|
58
|
+
// if (typeof identity.id !== 'string') {
|
|
59
|
+
// throw new Error(`id undefined ${identity.id}`);
|
|
60
|
+
// }
|
|
61
|
+
const identifier = `${movieTheaterCode}:${room.branchCode}:${section.branchCode}:${timestamp}`;
|
|
62
|
+
|
|
63
|
+
console.log(
|
|
64
|
+
'updating...',
|
|
65
|
+
identifier,
|
|
66
|
+
room.project.id, movieTheaterCode, room.branchCode, section.branchCode, i);
|
|
67
|
+
await sectionRepo.migrateSectionIdentifier({
|
|
68
|
+
project: { id: room.project.id },
|
|
69
|
+
identifier,
|
|
70
|
+
branchCode: section.branchCode,
|
|
71
|
+
containedInPlace: {
|
|
72
|
+
branchCode: room.branchCode,
|
|
73
|
+
containedInPlace: {
|
|
74
|
+
branchCode: movieTheaterCode
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
updateCount += 1;
|
|
79
|
+
console.log(
|
|
80
|
+
'updated.', room.project.id, movieTheaterCode, room.branchCode, section.branchCode, i);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
console.log(i, 'docs checked');
|
|
87
|
+
console.log(updateCount, 'docs updated');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
main()
|
|
91
|
+
.then()
|
|
92
|
+
.catch(console.error);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
// tslint:disable-next-line:no-implicit-dependencies
|
|
3
|
+
import { Parser } from '@json2csv/plainjs';
|
|
4
|
+
import * as mongoose from 'mongoose';
|
|
5
|
+
import { chevre } from '../../../../lib/index';
|
|
6
|
+
|
|
7
|
+
const project = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
+
|
|
12
|
+
const seatRepo = await chevre.repository.place.Seat.createInstance(mongoose.connection);
|
|
13
|
+
|
|
14
|
+
const seats = await seatRepo.searchSeats(
|
|
15
|
+
{
|
|
16
|
+
project: { id: { $eq: project.id } },
|
|
17
|
+
containedInPlace: {
|
|
18
|
+
// branchCode: { $eq: 'Default02' },
|
|
19
|
+
branchCode: { $eq: 'Default' },
|
|
20
|
+
containedInPlace: {
|
|
21
|
+
branchCode: { $eq: '10' },
|
|
22
|
+
containedInPlace: { branchCode: { $eq: '118' } }
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
console.log(seats);
|
|
28
|
+
console.log(seats.length, 'seats found');
|
|
29
|
+
try {
|
|
30
|
+
const opts = {
|
|
31
|
+
// formatters: {
|
|
32
|
+
// // Define how strings are formatted
|
|
33
|
+
// string: (value) => {
|
|
34
|
+
// // if (value.includes(',') || value.includes('"') || value.includes('\n')) {
|
|
35
|
+
// // return `"${value.replace(/"/g, '""')}"`; // Standard CSV escaping
|
|
36
|
+
// // }
|
|
37
|
+
// // if (value === '') {
|
|
38
|
+
// // return `""`; // Standard CSV escaping
|
|
39
|
+
// // }
|
|
40
|
+
|
|
41
|
+
// return value; // No quotes if safe
|
|
42
|
+
// }
|
|
43
|
+
// }
|
|
44
|
+
};
|
|
45
|
+
const parser = new Parser(opts);
|
|
46
|
+
const csv = parser.parse(seats.map((seat) => {
|
|
47
|
+
// branchCode,seatingType,name.ja,name.en
|
|
48
|
+
return {
|
|
49
|
+
branchCode: seat.branchCode,
|
|
50
|
+
...(Array.isArray(seat.seatingType) && seat.seatingType.length > 0) ? { seatingType: seat.seatingType[0] } : undefined,
|
|
51
|
+
'name.ja': (typeof seat.name?.ja === 'string') ? seat.name.ja : '',
|
|
52
|
+
'name.en': (typeof seat.name?.en === 'string') ? seat.name.en : ''
|
|
53
|
+
};
|
|
54
|
+
}));
|
|
55
|
+
console.log(csv);
|
|
56
|
+
} catch (err) {
|
|
57
|
+
console.error(err);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
main()
|
|
62
|
+
.then(console.log)
|
|
63
|
+
.catch(console.error);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
import { chevre } from '../../../../lib/index';
|
|
4
|
+
|
|
5
|
+
const project = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
|
+
|
|
10
|
+
const movieTheaterRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
|
|
11
|
+
|
|
12
|
+
const result = await movieTheaterRepo.upsertMovieTheatersByBranchCode(
|
|
13
|
+
[
|
|
14
|
+
{
|
|
15
|
+
$set: {
|
|
16
|
+
branchCode: 'SAMPLE',
|
|
17
|
+
name: { ja: 'sampleNameJa', en: 'from samples' },
|
|
18
|
+
additionalProperty: [],
|
|
19
|
+
kanaName: '',
|
|
20
|
+
telephone: '',
|
|
21
|
+
offers: {
|
|
22
|
+
typeOf: chevre.factory.offerType.Offer,
|
|
23
|
+
eligibleQuantity: { maxValue: 6, unitCode: chevre.factory.unitCode.C62, typeOf: 'QuantitativeValue' },
|
|
24
|
+
availabilityEndsGraceTime: { value: 6, unitCode: chevre.factory.unitCode.Sec, typeOf: 'QuantitativeValue' },
|
|
25
|
+
availabilityStartsGraceTime: { value: 6, unitCode: chevre.factory.unitCode.Day, typeOf: 'QuantitativeValue' }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
{
|
|
32
|
+
project: { id: project.id },
|
|
33
|
+
sellerId: '59d20831e53ebc2b4e774466'
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
console.log(result);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
main()
|
|
40
|
+
.then(console.log)
|
|
41
|
+
.catch(console.error);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
import { chevre } from '../../../../lib/index';
|
|
4
|
+
|
|
5
|
+
const project = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
|
+
|
|
10
|
+
const roomRepo = await chevre.repository.place.ScreeningRoom.createInstance(mongoose.connection);
|
|
11
|
+
|
|
12
|
+
const result = await roomRepo.upsertRoomsByBranchCode(
|
|
13
|
+
[
|
|
14
|
+
{
|
|
15
|
+
$set: {
|
|
16
|
+
branchCode: 'SAMPLE',
|
|
17
|
+
name: { ja: 'sampleNameJa', en: 'from samples' },
|
|
18
|
+
additionalProperty: []
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
$set: {
|
|
23
|
+
branchCode: 'SAMPLE2',
|
|
24
|
+
name: { ja: 'from samples2', en: 'from samples' },
|
|
25
|
+
additionalProperty: []
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
{
|
|
30
|
+
project: { id: project.id },
|
|
31
|
+
movieTheaterId: '5bfb841d5a78d7948369979a',
|
|
32
|
+
parentOrganization: { id: '59d20831e53ebc2b4e774466' }
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
console.log(result);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
main()
|
|
39
|
+
.then(console.log)
|
|
40
|
+
.catch(console.error);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
import { chevre } from '../../../../lib/index';
|
|
4
|
+
|
|
5
|
+
const project = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
|
|
6
|
+
const movieTheaterId = '5bfb841d5a78d7948369979a';
|
|
7
|
+
const sellerId = '59d20831e53ebc2b4e774466';
|
|
8
|
+
const roomCode = '10';
|
|
9
|
+
|
|
10
|
+
async function main() {
|
|
11
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
|
+
|
|
13
|
+
const sectionRepo = await chevre.repository.place.Section.createInstance(mongoose.connection);
|
|
14
|
+
|
|
15
|
+
let result = await sectionRepo.addSeatSectionsByBranchCodeIfNotExist(
|
|
16
|
+
[
|
|
17
|
+
{
|
|
18
|
+
$set: {
|
|
19
|
+
branchCode: 'SAMPLE',
|
|
20
|
+
name: { ja: 'sampleNameJa', en: 'from samples' },
|
|
21
|
+
additionalProperty: []
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
{
|
|
26
|
+
project: { id: project.id },
|
|
27
|
+
movieTheaterId,
|
|
28
|
+
parentOrganization: { id: sellerId },
|
|
29
|
+
roomCode
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
console.log(result);
|
|
33
|
+
|
|
34
|
+
result = await sectionRepo.updateSeatSectionsByBranchCode(
|
|
35
|
+
[
|
|
36
|
+
{
|
|
37
|
+
$set: {
|
|
38
|
+
branchCode: 'SAMPLE',
|
|
39
|
+
name: { ja: 'sampleNameJaxxx', en: 'from samples' },
|
|
40
|
+
additionalProperty: []
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
{
|
|
45
|
+
project: { id: project.id },
|
|
46
|
+
movieTheaterId,
|
|
47
|
+
parentOrganization: { id: sellerId },
|
|
48
|
+
roomCode
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
console.log(result);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
main()
|
|
55
|
+
.then(console.log)
|
|
56
|
+
.catch(console.error);
|
|
@@ -11,7 +11,7 @@ mongoose.Model.on('index', (...args) => {
|
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
13
|
|
|
14
|
-
await chevre.repository.
|
|
14
|
+
await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
|
|
15
15
|
console.log('success!');
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -0,0 +1,33 @@
|
|
|
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, { autoIndex: false });
|
|
8
|
+
|
|
9
|
+
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
|
+
|
|
11
|
+
const roleNames = [
|
|
12
|
+
// chevre.factory.role.organizationRole.RoleName.InventoryManager,
|
|
13
|
+
// chevre.factory.role.organizationRole.RoleName.SellersOwner,
|
|
14
|
+
// chevre.factory.role.organizationRole.RoleName.SellersInventoryManager,
|
|
15
|
+
chevre.factory.role.organizationRole.RoleName.TicketClerk
|
|
16
|
+
];
|
|
17
|
+
const permissions = [
|
|
18
|
+
'admin.sellers.acceptedPaymentMethods.read'
|
|
19
|
+
];
|
|
20
|
+
for (const roleName of roleNames) {
|
|
21
|
+
for (const permission of permissions) {
|
|
22
|
+
const result = await roleRepo.addPermissionIfNotExists({
|
|
23
|
+
roleName: { $eq: roleName },
|
|
24
|
+
permission
|
|
25
|
+
});
|
|
26
|
+
console.log('permission added.', result, roleName);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
main()
|
|
32
|
+
.then()
|
|
33
|
+
.catch(console.error);
|
|
@@ -0,0 +1,33 @@
|
|
|
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, { autoIndex: false });
|
|
8
|
+
|
|
9
|
+
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
|
+
|
|
11
|
+
const roleNames = [
|
|
12
|
+
chevre.factory.role.organizationRole.RoleName.InventoryManager,
|
|
13
|
+
chevre.factory.role.organizationRole.RoleName.SellersOwner,
|
|
14
|
+
chevre.factory.role.organizationRole.RoleName.SellersInventoryManager
|
|
15
|
+
// chevre.factory.role.organizationRole.RoleName.TicketClerk
|
|
16
|
+
];
|
|
17
|
+
const permissions = [
|
|
18
|
+
'admin.sellers.acceptedPaymentMethods.*'
|
|
19
|
+
];
|
|
20
|
+
for (const roleName of roleNames) {
|
|
21
|
+
for (const permission of permissions) {
|
|
22
|
+
const result = await roleRepo.addPermissionIfNotExists({
|
|
23
|
+
roleName: { $eq: roleName },
|
|
24
|
+
permission
|
|
25
|
+
});
|
|
26
|
+
console.log('permission added.', result, roleName);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
main()
|
|
32
|
+
.then()
|
|
33
|
+
.catch(console.error);
|
|
@@ -0,0 +1,49 @@
|
|
|
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, { autoIndex: false });
|
|
8
|
+
|
|
9
|
+
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
|
+
|
|
11
|
+
const roleNames = [
|
|
12
|
+
// chevre.factory.role.organizationRole.RoleName.InventoryManager,
|
|
13
|
+
chevre.factory.role.organizationRole.RoleName.SellersOwner,
|
|
14
|
+
chevre.factory.role.organizationRole.RoleName.SellersInventoryManager,
|
|
15
|
+
chevre.factory.role.organizationRole.RoleName.TicketClerk
|
|
16
|
+
];
|
|
17
|
+
const permissions = [
|
|
18
|
+
'admin.creativeWorks.read'
|
|
19
|
+
];
|
|
20
|
+
for (const roleName of roleNames) {
|
|
21
|
+
for (const permission of permissions) {
|
|
22
|
+
const result = await roleRepo.addPermissionIfNotExists({
|
|
23
|
+
roleName: { $eq: roleName },
|
|
24
|
+
permission
|
|
25
|
+
});
|
|
26
|
+
console.log('permission added.', result, roleName);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// roleNames = [
|
|
31
|
+
// chevre.factory.role.organizationRole.RoleName.TicketClerk
|
|
32
|
+
// ];
|
|
33
|
+
// permissions = [
|
|
34
|
+
// 'admin.sellers.productOffers.read'
|
|
35
|
+
// ];
|
|
36
|
+
// for (const roleName of roleNames) {
|
|
37
|
+
// for (const permission of permissions) {
|
|
38
|
+
// const result = await roleRepo.addPermissionIfNotExists({
|
|
39
|
+
// roleName: { $eq: roleName },
|
|
40
|
+
// permission
|
|
41
|
+
// });
|
|
42
|
+
// console.log('permission added.', result, roleName);
|
|
43
|
+
// }
|
|
44
|
+
// }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
main()
|
|
48
|
+
.then()
|
|
49
|
+
.catch(console.error);
|
|
@@ -0,0 +1,34 @@
|
|
|
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, { autoIndex: false });
|
|
8
|
+
|
|
9
|
+
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
|
+
|
|
11
|
+
const roleNames = [
|
|
12
|
+
// chevre.factory.role.organizationRole.RoleName.InventoryManager,
|
|
13
|
+
// chevre.factory.role.organizationRole.RoleName.SellersOwner,
|
|
14
|
+
// chevre.factory.role.organizationRole.RoleName.SellersInventoryManager,
|
|
15
|
+
chevre.factory.role.organizationRole.RoleName.TicketClerk
|
|
16
|
+
];
|
|
17
|
+
const permissions = [
|
|
18
|
+
'admin.sellers.rooms.read',
|
|
19
|
+
'admin.sellers.seatSections.read'
|
|
20
|
+
];
|
|
21
|
+
for (const roleName of roleNames) {
|
|
22
|
+
for (const permission of permissions) {
|
|
23
|
+
const result = await roleRepo.addPermissionIfNotExists({
|
|
24
|
+
roleName: { $eq: roleName },
|
|
25
|
+
permission
|
|
26
|
+
});
|
|
27
|
+
console.log('permission added.', result, roleName);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
main()
|
|
33
|
+
.then()
|
|
34
|
+
.catch(console.error);
|
|
@@ -0,0 +1,34 @@
|
|
|
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, { autoIndex: false });
|
|
8
|
+
|
|
9
|
+
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
|
+
|
|
11
|
+
const roleNames = [
|
|
12
|
+
chevre.factory.role.organizationRole.RoleName.InventoryManager,
|
|
13
|
+
chevre.factory.role.organizationRole.RoleName.SellersOwner,
|
|
14
|
+
chevre.factory.role.organizationRole.RoleName.SellersInventoryManager
|
|
15
|
+
// chevre.factory.role.organizationRole.RoleName.TicketClerk
|
|
16
|
+
];
|
|
17
|
+
const permissions = [
|
|
18
|
+
'admin.sellers.rooms.*',
|
|
19
|
+
'admin.sellers.seatSections.*'
|
|
20
|
+
];
|
|
21
|
+
for (const roleName of roleNames) {
|
|
22
|
+
for (const permission of permissions) {
|
|
23
|
+
const result = await roleRepo.addPermissionIfNotExists({
|
|
24
|
+
roleName: { $eq: roleName },
|
|
25
|
+
permission
|
|
26
|
+
});
|
|
27
|
+
console.log('permission added.', result, roleName);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
main()
|
|
33
|
+
.then()
|
|
34
|
+
.catch(console.error);
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { FPE_SECRET } = process.env;
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
if (typeof FPE_SECRET !== 'string') {
|
|
11
|
+
throw new Error('FPE_SECRET required');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
15
|
+
|
|
16
|
+
const settingRepo = await chevre.repository.Setting.createInstance(mongoose.connection);
|
|
17
|
+
|
|
18
|
+
const setting = await settingRepo.findOne({ project: { id: { $eq: '*' } } }, ['orderNumber']);
|
|
19
|
+
console.log(setting);
|
|
20
|
+
|
|
21
|
+
if (typeof setting?.orderNumber?.version !== 'string' || !(setting?.orderNumber?.validFrom instanceof Date)) {
|
|
22
|
+
console.log('updating orderNumber...');
|
|
23
|
+
await settingRepo.updateByProject(
|
|
24
|
+
{ project: { id: { $eq: '*' } } },
|
|
25
|
+
{
|
|
26
|
+
orderNumber: {
|
|
27
|
+
validFrom: moment('2026-02-10T05:00:00Z')
|
|
28
|
+
.toDate(),
|
|
29
|
+
fpeSecret: FPE_SECRET,
|
|
30
|
+
version: 'A',
|
|
31
|
+
versioningForceProjects: [
|
|
32
|
+
'TTT',
|
|
33
|
+
'SSK'
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
console.log('orderNumber updated.');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
main()
|
|
43
|
+
.then()
|
|
44
|
+
.catch(console.error);
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { FPE_SECRET } = process.env;
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
if (typeof FPE_SECRET !== 'string') {
|
|
11
|
+
throw new Error('FPE_SECRET required');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
15
|
+
|
|
16
|
+
const settingRepo = await chevre.repository.Setting.createInstance(mongoose.connection);
|
|
17
|
+
|
|
18
|
+
const setting = await settingRepo.findOne({ project: { id: { $eq: '*' } } }, ['transactionNumber']);
|
|
19
|
+
console.log(setting);
|
|
20
|
+
|
|
21
|
+
if (typeof setting?.transactionNumber?.version !== 'string' || !(setting?.transactionNumber?.validFrom instanceof Date)) {
|
|
22
|
+
console.log('updating transactionNumber...');
|
|
23
|
+
await settingRepo.updateByProject(
|
|
24
|
+
{ project: { id: { $eq: '*' } } },
|
|
25
|
+
{
|
|
26
|
+
transactionNumber: {
|
|
27
|
+
validFrom: moment('2026-02-05T00:00:00Z')
|
|
28
|
+
.toDate(),
|
|
29
|
+
fpeSecret: FPE_SECRET,
|
|
30
|
+
version: '1'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
console.log('transactionNumber updated.');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
main()
|
|
39
|
+
.then()
|
|
40
|
+
.catch(console.error);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// tslint:disable-next-line:max-func-body-length
|
|
7
|
+
async function main() {
|
|
8
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
|
+
|
|
10
|
+
const transactionNumberRepo = await chevre.repository.TransactionNumber.createInstance({
|
|
11
|
+
connection: mongoose.connection
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const result = await transactionNumberRepo.publishByTimestamp({ startDate: new Date() });
|
|
15
|
+
console.log(result);
|
|
16
|
+
console.log('length:', result.transactionNumber.length);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
main()
|
|
20
|
+
.then(() => {
|
|
21
|
+
console.log('success!');
|
|
22
|
+
})
|
|
23
|
+
.catch(console.error);
|