@chevre/domain 23.2.0-alpha.4 → 23.2.0-alpha.41
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/event/importEventsFromCOAByTitle.ts +1 -1
- package/example/src/chevre/eventSeries/migrateEventSeriesOffers.ts +75 -0
- package/example/src/chevre/eventSeries/migrateEventSeriesVideoFormat.ts +80 -0
- package/example/src/chevre/{upsertScreeningEventSeriesByVersion.ts → eventSeries/upsertScreeningEventSeriesByVersion.ts} +47 -42
- package/example/src/chevre/{upsertOfferCatalogItemsByIdentifier.ts → offerCatalog/upsertOfferCatalogItemsByIdentifier.ts} +6 -3
- package/example/src/chevre/{upsertOfferCatalogsByIdentifier.ts → offerCatalog/upsertOfferCatalogsByIdentifier.ts} +7 -3
- package/example/src/chevre/{upsertOffersByIdentifier.ts → offers/upsertOffersByIdentifier.ts} +5 -3
- 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/addAdminEventSeriesReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminMovieTheaterReadPermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminMovieTheaterWritePermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +34 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +8 -4
- package/lib/chevre/factory/event.js +5 -5
- 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/creativeWork.js +9 -5
- package/lib/chevre/repo/event.d.ts +2 -2
- package/lib/chevre/repo/event.js +20 -8
- package/lib/chevre/repo/eventOffer.d.ts +8 -0
- package/lib/chevre/repo/eventOffer.js +11 -0
- package/lib/chevre/repo/eventSeries.d.ts +10 -4
- package/lib/chevre/repo/eventSeries.js +56 -28
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +10 -9
- package/lib/chevre/repo/mongoose/schemas/eventSeries.js +10 -0
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -2
- package/lib/chevre/repo/offerCatalog.d.ts +10 -1
- package/lib/chevre/repo/offerCatalog.js +34 -19
- package/lib/chevre/repo/offerCatalogItem.d.ts +10 -1
- package/lib/chevre/repo/offerCatalogItem.js +32 -17
- 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/task.d.ts +1 -1
- package/lib/chevre/repository.d.ts +8 -0
- package/lib/chevre/repository.js +16 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +6 -3
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
- package/lib/chevre/service/event/processUpdateMovieTheater.js +13 -11
- package/lib/chevre/service/event/saveScreeningEvents.d.ts +1 -1
- package/lib/chevre/service/event/saveScreeningEvents.js +6 -5
- package/lib/chevre/service/offer/event/authorize/factory.js +4 -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 +4 -13
- package/lib/chevre/service/offer/onEventChanged.js +7 -5
- 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/createEvent/createEventBySchedule/factory.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +5 -3
- package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +1 -1
- package/lib/chevre/service/task/onResourceDeleted.d.ts +6 -0
- package/lib/chevre/service/task/onResourceDeleted.js +60 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +3 -7
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +19 -7
- package/lib/chevre/service/task/onResourceUpdated.js +206 -42
- package/lib/chevre/service/task/syncResourcesFromCOA.js +1 -1
- package/lib/chevre/service/taskHandler.js +1 -0
- package/package.json +4 -3
- package/example/src/chevre/event/upsertManyScreeningEventByIdentifier.ts +0 -191
- package/example/src/chevre/offers/createSampleOffers.ts +0 -154
- package/lib/chevre/service/eventOld.d.ts +0 -60
- package/lib/chevre/service/eventOld.js +0 -864
|
@@ -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.EventSeries.createInstance(mongoose.connection);
|
|
15
15
|
console.log('success!');
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -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.sellers.eventSeries.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,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.entranceGates.read',
|
|
19
|
+
'admin.sellers.movieTheaters.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.entranceGates.*',
|
|
19
|
+
'admin.sellers.movieTheaters.*'
|
|
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.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);
|
|
@@ -9,16 +9,20 @@ import { chevre } from '../../../lib/index';
|
|
|
9
9
|
async function main() {
|
|
10
10
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const movieTheaterRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
|
|
13
13
|
|
|
14
14
|
let updateResult: any;
|
|
15
15
|
|
|
16
|
-
updateResult = await
|
|
16
|
+
updateResult = await movieTheaterRepo.unsetUnnecessaryFields({
|
|
17
17
|
filter: {
|
|
18
|
-
|
|
18
|
+
$or: [
|
|
19
|
+
{ 'offers.availabilityStartsGraceTimeOnPOS': { $exists: true } },
|
|
20
|
+
{ 'offers.availabilityEndsGraceTimeOnPOS': { $exists: true } }
|
|
21
|
+
]
|
|
19
22
|
},
|
|
20
23
|
$unset: {
|
|
21
|
-
'
|
|
24
|
+
'offers.availabilityStartsGraceTimeOnPOS': 1,
|
|
25
|
+
'offers.availabilityEndsGraceTimeOnPOS': 1
|
|
22
26
|
}
|
|
23
27
|
});
|
|
24
28
|
console.log(updateResult);
|
|
@@ -23,10 +23,7 @@ function minimizeSuperEvent(params) {
|
|
|
23
23
|
// ? { kanaName: params.superEventFromDB.location.kanaName }
|
|
24
24
|
// : undefined
|
|
25
25
|
);
|
|
26
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: factory.eventType.ScreeningEventSeries,
|
|
27
|
-
// 不要なので廃止(2023-06-09~)
|
|
28
|
-
// project: { typeOf: chevre.factory.organizationType.Project, id: params.project.id },
|
|
29
|
-
id: params.superEventFromDB.id, videoFormat: params.superEventFromDB.videoFormat, soundFormat: params.superEventFromDB.soundFormat, workPerformed,
|
|
26
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: factory.eventType.ScreeningEventSeries, id: params.superEventFromDB.id, soundFormat: params.superEventFromDB.soundFormat, workPerformed,
|
|
30
27
|
location, kanaName: params.superEventFromDB.kanaName, name: Object.assign(Object.assign({}, (typeof params.superEventFromDB.name.en === 'string') ? { en: params.superEventFromDB.name.en } : undefined), (typeof params.superEventFromDB.name.ja === 'string') ? { ja: params.superEventFromDB.name.ja } : undefined) }, (Array.isArray(params.superEventFromDB.additionalProperty))
|
|
31
28
|
? { additionalProperty: params.superEventFromDB.additionalProperty }
|
|
32
29
|
: undefined), (params.superEventFromDB.startDate instanceof Date)
|
|
@@ -41,5 +38,8 @@ function minimizeSuperEvent(params) {
|
|
|
41
38
|
? { dubLanguage: params.superEventFromDB.dubLanguage }
|
|
42
39
|
: undefined), (params.superEventFromDB.subtitleLanguage !== undefined)
|
|
43
40
|
? { subtitleLanguage: params.superEventFromDB.subtitleLanguage }
|
|
44
|
-
: undefined)
|
|
41
|
+
: undefined), {
|
|
42
|
+
// 現時点で型廃止済だがデータとしては互換性維持(2026-01-15~)
|
|
43
|
+
videoFormat: params.superEventFromDB.videoFormat
|
|
44
|
+
});
|
|
45
45
|
}
|
|
@@ -74,7 +74,12 @@ export declare class AggregateOfferRepo {
|
|
|
74
74
|
/**
|
|
75
75
|
* コードをキーにして冪等置換(2023-12-13~)
|
|
76
76
|
*/
|
|
77
|
-
upsertByIdentifier(params: Omit<factory.unitPriceOffer.IUnitPriceOffer, 'id'>[]
|
|
77
|
+
upsertByIdentifier(params: Omit<factory.unitPriceOffer.IUnitPriceOffer, 'id'>[], options: {
|
|
78
|
+
/**
|
|
79
|
+
* プロダクトタイプでfilter(2026-01-30~)
|
|
80
|
+
*/
|
|
81
|
+
productType: factory.product.ProductType;
|
|
82
|
+
}): Promise<{
|
|
78
83
|
bulkWriteResult: BulkWriteResult;
|
|
79
84
|
modifiedOffers: {
|
|
80
85
|
id: string;
|
|
@@ -648,22 +648,30 @@ class AggregateOfferRepo {
|
|
|
648
648
|
/**
|
|
649
649
|
* コードをキーにして冪等置換(2023-12-13~)
|
|
650
650
|
*/
|
|
651
|
-
upsertByIdentifier(params) {
|
|
651
|
+
upsertByIdentifier(params, options) {
|
|
652
652
|
return __awaiter(this, void 0, void 0, function* () {
|
|
653
|
+
const { productType } = options;
|
|
653
654
|
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
654
655
|
const insertBulkWriteOps = [];
|
|
655
656
|
// const updateBulkWriteOps: AnyBulkWriteOperation<factory.aggregateOffer.IAggregateOffer>[] = [];
|
|
656
657
|
const queryFilters = [];
|
|
657
658
|
if (Array.isArray(params)) {
|
|
658
659
|
params.forEach((p) => {
|
|
660
|
+
var _a;
|
|
661
|
+
// 指定されたproductTypeを強制する
|
|
662
|
+
if (((_a = p.itemOffered) === null || _a === void 0 ? void 0 : _a.typeOf) !== productType) {
|
|
663
|
+
throw new factory.errors.Argument('itemOffered.typeOf', `not matched with productType: ${productType}`);
|
|
664
|
+
}
|
|
659
665
|
// リソースのユニークネスを保証するfilter
|
|
660
666
|
const filter = {
|
|
661
667
|
'project.id': { $eq: p.project.id },
|
|
662
|
-
'offers.identifier': { $exists: true, $eq: p.identifier }
|
|
668
|
+
'offers.identifier': { $exists: true, $eq: p.identifier },
|
|
669
|
+
'offers.itemOffered.typeOf': { $eq: productType } // プロダクトタイプを変更させないためにフィルター追加(2026-01-30~)
|
|
663
670
|
};
|
|
664
671
|
queryFilters.push({
|
|
665
672
|
'project.id': { $eq: p.project.id },
|
|
666
|
-
'offers.identifier': { $exists: true, $eq: p.identifier }
|
|
673
|
+
'offers.identifier': { $exists: true, $eq: p.identifier },
|
|
674
|
+
'offers.itemOffered.typeOf': { $eq: productType } // プロダクトタイプを変更させないためにフィルター追加(2026-01-30~)
|
|
667
675
|
});
|
|
668
676
|
const newOfferId = uniqid(); // setOnInsert時のみに利用する新ID
|
|
669
677
|
// サブオファー最適化(2023-12-22~)
|
|
@@ -20,99 +20,6 @@ class AggregateOrderRepo {
|
|
|
20
20
|
constructor(connection) {
|
|
21
21
|
this.aggregateOrderModel = connection.model(aggregateOrder_1.modelName, (0, aggregateOrder_1.createSchema)());
|
|
22
22
|
}
|
|
23
|
-
// public static CREATE_MONGO_CONDITIONS(
|
|
24
|
-
// conditions: ISearchConditions
|
|
25
|
-
// ): IMatchStage[] {
|
|
26
|
-
// const matchStages: IMatchStage[] = [];
|
|
27
|
-
// const projectIdEq = conditions.project?.id?.$eq;
|
|
28
|
-
// if (typeof projectIdEq === 'string') {
|
|
29
|
-
// matchStages.push({
|
|
30
|
-
// $match: { 'project.id': { $eq: projectIdEq } }
|
|
31
|
-
// });
|
|
32
|
-
// }
|
|
33
|
-
// const typeOfEq = conditions.reservationFor?.typeOf;
|
|
34
|
-
// if (typeof typeOfEq === 'string') {
|
|
35
|
-
// matchStages.push({
|
|
36
|
-
// $match: { 'reservationFor.typeOf': { $eq: typeOfEq } }
|
|
37
|
-
// });
|
|
38
|
-
// }
|
|
39
|
-
// const idEq = conditions.reservationFor?.id?.$eq;
|
|
40
|
-
// if (typeof idEq === 'string') {
|
|
41
|
-
// matchStages.push({
|
|
42
|
-
// $match: { 'reservationFor.id': { $eq: idEq } }
|
|
43
|
-
// });
|
|
44
|
-
// }
|
|
45
|
-
// const idIn = conditions.reservationFor?.id?.$in;
|
|
46
|
-
// if (Array.isArray(idIn)) {
|
|
47
|
-
// matchStages.push({
|
|
48
|
-
// $match: { 'reservationFor.id': { $in: idIn } }
|
|
49
|
-
// });
|
|
50
|
-
// }
|
|
51
|
-
// const reservationForStartDateGte = conditions.reservationFor?.startFrom;
|
|
52
|
-
// if (reservationForStartDateGte instanceof Date) {
|
|
53
|
-
// matchStages.push({
|
|
54
|
-
// $match: { 'reservationFor.startDate': { $gte: reservationForStartDateGte } }
|
|
55
|
-
// });
|
|
56
|
-
// }
|
|
57
|
-
// const reservationForStartDateLte = conditions.reservationFor?.startThrough;
|
|
58
|
-
// if (reservationForStartDateLte instanceof Date) {
|
|
59
|
-
// matchStages.push({
|
|
60
|
-
// $match: { 'reservationFor.startDate': { $lte: reservationForStartDateLte } }
|
|
61
|
-
// });
|
|
62
|
-
// }
|
|
63
|
-
// return matchStages;
|
|
64
|
-
// }
|
|
65
|
-
// /**
|
|
66
|
-
// * 予約集計を検索する
|
|
67
|
-
// */
|
|
68
|
-
// public async searchWithReservationForId(
|
|
69
|
-
// params: ISearchConditions,
|
|
70
|
-
// inclusion: ('aggregateOffer')[]
|
|
71
|
-
// ): Promise<ISearchWithReservationForIdResult[]> {
|
|
72
|
-
// const matchStages = AggregateReservationRepo.CREATE_MONGO_CONDITIONS(params);
|
|
73
|
-
// let projectStage: { [field in IKeyOfProjection]?: AnyExpression } = {
|
|
74
|
-
// _id: 0,
|
|
75
|
-
// id: '$reservationFor.id'
|
|
76
|
-
// };
|
|
77
|
-
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
78
|
-
// inclusion.forEach((field) => {
|
|
79
|
-
// projectStage[field] = { $ifNull: [`$${field}`, '$false'] };
|
|
80
|
-
// // projectStage[field] = 1;
|
|
81
|
-
// });
|
|
82
|
-
// } else {
|
|
83
|
-
// projectStage = {
|
|
84
|
-
// _id: 0,
|
|
85
|
-
// id: '$reservationFor.id',
|
|
86
|
-
// // aggregateEntranceGate: 1, // discontinue(2024-12-23~)
|
|
87
|
-
// aggregateOffer: 1
|
|
88
|
-
// };
|
|
89
|
-
// }
|
|
90
|
-
// const sortByStartDate = params.sort?.['reservationFor.startDate'];
|
|
91
|
-
// const aggregate = this.aggregateReservationModel.aggregate<ISearchWithReservationForIdResult>([
|
|
92
|
-
// ...matchStages,
|
|
93
|
-
// ...(typeof sortByStartDate === 'number')
|
|
94
|
-
// ? [{ $sort: { 'reservationFor.startDate': sortByStartDate } }]
|
|
95
|
-
// : [],
|
|
96
|
-
// // 現時点でreservationFor.idへのunique indexがないので、重複ドキュメント対応として、$group
|
|
97
|
-
// {
|
|
98
|
-
// $group: {
|
|
99
|
-
// _id: '$reservationFor.id',
|
|
100
|
-
// reservationFor: { $first: '$reservationFor' },
|
|
101
|
-
// aggregateEntranceGate: { $first: '$aggregateEntranceGate' },
|
|
102
|
-
// aggregateOffer: { $first: '$aggregateOffer' }
|
|
103
|
-
// }
|
|
104
|
-
// },
|
|
105
|
-
// { $project: projectStage }
|
|
106
|
-
// ]);
|
|
107
|
-
// if (typeof params.limit === 'number' && params.limit > 0) {
|
|
108
|
-
// const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
109
|
-
// aggregate.limit(params.limit * page)
|
|
110
|
-
// .skip(params.limit * (page - 1));
|
|
111
|
-
// }
|
|
112
|
-
// return aggregate
|
|
113
|
-
// .option({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
114
|
-
// .exec();
|
|
115
|
-
// }
|
|
116
23
|
save(filter, update) {
|
|
117
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
118
25
|
const { $set } = update;
|
|
@@ -5,7 +5,6 @@ type IMatchStage = PipelineStage.Match;
|
|
|
5
5
|
export interface IUpdateAggregateReservationParams {
|
|
6
6
|
$set: {
|
|
7
7
|
aggregateOffer?: factory.event.screeningEvent.IAggregateOffer;
|
|
8
|
-
aggregateEntranceGate?: factory.event.screeningEvent.IAggregateEntranceGate;
|
|
9
8
|
};
|
|
10
9
|
}
|
|
11
10
|
type ISearchWithReservationForIdResult = Pick<IAggregateReservation, 'aggregateOffer'> & {
|