@chevre/domain 23.2.0-alpha.2 → 23.2.0-alpha.20
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/actions/checkAuthorizePaymentActions.ts +55 -0
- 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/place/adminEntranceGates.ts +68 -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/upsertSeatsByBranchCode.ts +72 -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/lib/chevre/repo/acceptedPaymentMethod.js +14 -10
- 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/eventSeries.js +16 -12
- 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/place/entranceGate.d.ts +58 -0
- package/lib/chevre/repo/place/entranceGate.js +159 -0
- package/lib/chevre/repo/place/movieTheater.d.ts +5 -2
- package/lib/chevre/repo/place/movieTheater.js +3 -1
- package/lib/chevre/repo/place/screeningRoom.d.ts +38 -31
- package/lib/chevre/repo/place/screeningRoom.js +166 -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 +36 -30
- package/lib/chevre/repo/place/section.js +214 -130
- package/lib/chevre/repository.d.ts +8 -0
- package/lib/chevre/repository.js +16 -0
- package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.d.ts +6 -1
- package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.js +26 -4
- package/lib/chevre/service/assetTransaction/pay.d.ts +3 -0
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
- package/lib/chevre/service/event/processUpdateMovieTheater.js +1 -1
- package/lib/chevre/service/event/saveScreeningEvents.d.ts +1 -1
- package/lib/chevre/service/event/saveScreeningEvents.js +1 -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/onEventChanged.js +7 -5
- package/lib/chevre/service/payment/any/factory.d.ts +5 -0
- package/lib/chevre/service/payment/any/factory.js +11 -2
- package/lib/chevre/service/payment/any.d.ts +8 -0
- package/lib/chevre/service/payment/any.js +3 -2
- package/lib/chevre/service/task/authorizePayment.js +3 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +2 -2
- package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +2 -2
- package/lib/chevre/service/task/publishPaymentUrl.js +3 -1
- package/lib/chevre/service/task/syncResourcesFromCOA.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +3 -1
- package/lib/chevre/service/transaction/placeOrder/confirm.js +3 -1
- package/package.json +3 -2
- package/lib/chevre/service/eventOld.d.ts +0 -60
- package/lib/chevre/service/eventOld.js +0 -864
|
@@ -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);
|
|
@@ -31,45 +31,49 @@ class AcceptedPaymentMethodRepo {
|
|
|
31
31
|
this.acceptedPaymentMethodModel = connection.model(acceptedPaymentMethod_1.modelName, (0, acceptedPaymentMethod_1.createSchema)());
|
|
32
32
|
}
|
|
33
33
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
34
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
35
35
|
const andConditions = [];
|
|
36
36
|
const idEq = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq;
|
|
37
37
|
if (typeof idEq === 'string') {
|
|
38
38
|
andConditions.push({ _id: { $eq: idEq } });
|
|
39
39
|
}
|
|
40
|
-
const
|
|
40
|
+
const idIn = (_b = params.id) === null || _b === void 0 ? void 0 : _b.$in;
|
|
41
|
+
if (Array.isArray(idIn)) {
|
|
42
|
+
andConditions.push({ _id: { $in: idIn } });
|
|
43
|
+
}
|
|
44
|
+
const projectIdEq = (_d = (_c = params.project) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
41
45
|
if (typeof projectIdEq === 'string') {
|
|
42
46
|
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
43
47
|
}
|
|
44
|
-
const identifierEq = (
|
|
48
|
+
const identifierEq = (_e = params.identifier) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
45
49
|
if (typeof identifierEq === 'string') {
|
|
46
50
|
andConditions.push({ identifier: { $eq: identifierEq } });
|
|
47
51
|
}
|
|
48
|
-
const identifierIn = (
|
|
52
|
+
const identifierIn = (_f = params.identifier) === null || _f === void 0 ? void 0 : _f.$in;
|
|
49
53
|
if (Array.isArray(identifierIn)) {
|
|
50
54
|
andConditions.push({ identifier: { $in: identifierIn } });
|
|
51
55
|
}
|
|
52
|
-
const itemOfferedIdEq = (
|
|
56
|
+
const itemOfferedIdEq = (_h = (_g = params.itemOffered) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
53
57
|
if (typeof itemOfferedIdEq === 'string') {
|
|
54
58
|
andConditions.push({ 'itemOffered.id': { $eq: itemOfferedIdEq } });
|
|
55
59
|
}
|
|
56
|
-
const itemOfferedIdIn = (
|
|
60
|
+
const itemOfferedIdIn = (_k = (_j = params.itemOffered) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$in;
|
|
57
61
|
if (Array.isArray(itemOfferedIdIn)) {
|
|
58
62
|
andConditions.push({ 'itemOffered.id': { $in: itemOfferedIdIn } });
|
|
59
63
|
}
|
|
60
|
-
const acceptedPaymentMethodIdEq = (
|
|
64
|
+
const acceptedPaymentMethodIdEq = (_m = (_l = params.acceptedPaymentMethod) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$eq;
|
|
61
65
|
if (typeof acceptedPaymentMethodIdEq === 'string') {
|
|
62
66
|
andConditions.push({ 'acceptedPaymentMethod.id': { $eq: acceptedPaymentMethodIdEq } });
|
|
63
67
|
}
|
|
64
|
-
const sellerByIdEq = (
|
|
68
|
+
const sellerByIdEq = (_p = (_o = params.seller) === null || _o === void 0 ? void 0 : _o.id) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
65
69
|
if (typeof sellerByIdEq === 'string') {
|
|
66
70
|
andConditions.push({ 'seller.id': { $eq: sellerByIdEq } });
|
|
67
71
|
}
|
|
68
|
-
const validFromLte = (
|
|
72
|
+
const validFromLte = (_q = params.validFrom) === null || _q === void 0 ? void 0 : _q.$lte;
|
|
69
73
|
if (validFromLte instanceof Date) {
|
|
70
74
|
andConditions.push({ validFrom: { $lte: validFromLte } });
|
|
71
75
|
}
|
|
72
|
-
const validThroughGte = (
|
|
76
|
+
const validThroughGte = (_r = params.validThrough) === null || _r === void 0 ? void 0 : _r.$gte;
|
|
73
77
|
if (validThroughGte instanceof Date) {
|
|
74
78
|
andConditions.push({ validThrough: { $gte: validThroughGte } });
|
|
75
79
|
}
|
|
@@ -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'> & {
|
|
@@ -82,7 +82,6 @@ class AggregateReservationRepo {
|
|
|
82
82
|
projectStage = {
|
|
83
83
|
_id: 0,
|
|
84
84
|
id: '$reservationFor.id',
|
|
85
|
-
// aggregateEntranceGate: 1, // discontinue(2024-12-23~)
|
|
86
85
|
aggregateOffer: 1
|
|
87
86
|
};
|
|
88
87
|
}
|
|
@@ -97,7 +96,6 @@ class AggregateReservationRepo {
|
|
|
97
96
|
$group: {
|
|
98
97
|
_id: '$reservationFor.id',
|
|
99
98
|
reservationFor: { $first: '$reservationFor' },
|
|
100
|
-
aggregateEntranceGate: { $first: '$aggregateEntranceGate' },
|
|
101
99
|
aggregateOffer: { $first: '$aggregateOffer' }
|
|
102
100
|
}
|
|
103
101
|
},
|
|
@@ -50,7 +50,7 @@ class CreativeWorkRepo {
|
|
|
50
50
|
}
|
|
51
51
|
// tslint:disable-next-line:max-func-body-length
|
|
52
52
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
53
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
54
54
|
const andConditions = [
|
|
55
55
|
{ typeOf: { $eq: factory.creativeWorkType.Movie } }
|
|
56
56
|
];
|
|
@@ -90,12 +90,16 @@ class CreativeWorkRepo {
|
|
|
90
90
|
if (Array.isArray(identifierIn)) {
|
|
91
91
|
andConditions.push({ identifier: { $in: identifierIn } });
|
|
92
92
|
}
|
|
93
|
+
const identifierRegex = (_k = params.identifier) === null || _k === void 0 ? void 0 : _k.$regex;
|
|
94
|
+
if (typeof identifierRegex === 'string' && identifierRegex !== '') {
|
|
95
|
+
andConditions.push({ identifier: { $regex: new RegExp(identifierRegex) } });
|
|
96
|
+
}
|
|
93
97
|
}
|
|
94
98
|
if (typeof params.name === 'string' && params.name.length > 0) {
|
|
95
99
|
// 多言語名称対応(2022-07-11~)
|
|
96
100
|
andConditions.push({
|
|
97
101
|
$or: [
|
|
98
|
-
{ name: { $exists: true, $regex: new RegExp(params.name) } },
|
|
102
|
+
// { name: { $exists: true, $regex: new RegExp(params.name) } }, // string型への互換性維持を廃止(2025-12-20~)
|
|
99
103
|
{ 'name.ja': { $exists: true, $regex: new RegExp(params.name) } },
|
|
100
104
|
{ 'name.en': { $exists: true, $regex: new RegExp(params.name) } }
|
|
101
105
|
]
|
|
@@ -111,15 +115,15 @@ class CreativeWorkRepo {
|
|
|
111
115
|
if (params.datePublishedThrough !== undefined) {
|
|
112
116
|
andConditions.push({ datePublished: { $exists: true, $lte: params.datePublishedThrough } });
|
|
113
117
|
}
|
|
114
|
-
const offersAvailableFrom = (
|
|
118
|
+
const offersAvailableFrom = (_l = params.offers) === null || _l === void 0 ? void 0 : _l.availableFrom;
|
|
115
119
|
if (offersAvailableFrom instanceof Date) {
|
|
116
120
|
andConditions.push({ 'offers.availabilityEnds': { $exists: true, $gte: offersAvailableFrom } });
|
|
117
121
|
}
|
|
118
|
-
const offersAvailableThrough = (
|
|
122
|
+
const offersAvailableThrough = (_m = params.offers) === null || _m === void 0 ? void 0 : _m.availableThrough;
|
|
119
123
|
if (offersAvailableThrough instanceof Date) {
|
|
120
124
|
andConditions.push({ 'offers.availabilityStarts': { $exists: true, $lte: offersAvailableThrough } });
|
|
121
125
|
}
|
|
122
|
-
const additionalPropertyElemMatch = (
|
|
126
|
+
const additionalPropertyElemMatch = (_o = params.additionalProperty) === null || _o === void 0 ? void 0 : _o.$elemMatch;
|
|
123
127
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
124
128
|
andConditions.push({
|
|
125
129
|
additionalProperty: {
|
|
@@ -184,21 +184,25 @@ class EventSeriesRepo {
|
|
|
184
184
|
}
|
|
185
185
|
const videoFormatTypeOfEq = (_t = (_s = conditions.videoFormat) === null || _s === void 0 ? void 0 : _s.typeOf) === null || _t === void 0 ? void 0 : _t.$eq;
|
|
186
186
|
if (typeof videoFormatTypeOfEq === 'string') {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
187
|
+
// 新しい参照先へ変更(2025-12-31~)
|
|
188
|
+
// andConditions.push({
|
|
189
|
+
// 'videoFormat.typeOf': {
|
|
190
|
+
// $exists: true,
|
|
191
|
+
// $eq: videoFormatTypeOfEq
|
|
192
|
+
// }
|
|
193
|
+
// });
|
|
194
|
+
andConditions.push({ 'subEvent.videoFormat': { $exists: true, $eq: videoFormatTypeOfEq } });
|
|
193
195
|
}
|
|
194
196
|
const videoFormatTypeOfIn = (_v = (_u = conditions.videoFormat) === null || _u === void 0 ? void 0 : _u.typeOf) === null || _v === void 0 ? void 0 : _v.$in;
|
|
195
197
|
if (Array.isArray(videoFormatTypeOfIn)) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
198
|
+
// 新しい参照先へ変更(2025-12-31~)
|
|
199
|
+
// andConditions.push({
|
|
200
|
+
// 'videoFormat.typeOf': {
|
|
201
|
+
// $exists: true,
|
|
202
|
+
// $in: videoFormatTypeOfIn
|
|
203
|
+
// }
|
|
204
|
+
// });
|
|
205
|
+
andConditions.push({ 'subEvent.videoFormat': { $exists: true, $in: videoFormatTypeOfIn } });
|
|
202
206
|
}
|
|
203
207
|
const soundFormatTypeOfEq = (_x = (_w = conditions.soundFormat) === null || _w === void 0 ? void 0 : _w.typeOf) === null || _x === void 0 ? void 0 : _x.$eq;
|
|
204
208
|
if (typeof soundFormatTypeOfEq === 'string') {
|
|
@@ -11,7 +11,6 @@ const schemaDefinition = {
|
|
|
11
11
|
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
12
12
|
typeOf: { type: String, required: true },
|
|
13
13
|
reservationFor: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
14
|
-
// aggregateEntranceGate: SchemaTypes.Mixed, // discontinue(2024-12-23~)
|
|
15
14
|
aggregateOffer: mongoose_1.SchemaTypes.Mixed
|
|
16
15
|
};
|
|
17
16
|
const schemaOptions = {
|
|
@@ -67,15 +67,16 @@ const indexes = [
|
|
|
67
67
|
name: 'searchByProjectId-v20220721'
|
|
68
68
|
}
|
|
69
69
|
],
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
// string型への互換性維持を廃止(2025-12-20~
|
|
71
|
+
// [
|
|
72
|
+
// { name: 1, identifier: 1 },
|
|
73
|
+
// {
|
|
74
|
+
// name: 'searchByName2',
|
|
75
|
+
// partialFilterExpression: {
|
|
76
|
+
// name: { $exists: true }
|
|
77
|
+
// }
|
|
78
|
+
// }
|
|
79
|
+
// ],
|
|
79
80
|
[
|
|
80
81
|
{ 'name.ja': 1, identifier: 1 },
|
|
81
82
|
{
|
|
@@ -24,6 +24,7 @@ const schemaDefinition = {
|
|
|
24
24
|
headline: mongoose_1.SchemaTypes.Mixed,
|
|
25
25
|
location: mongoose_1.SchemaTypes.Mixed,
|
|
26
26
|
startDate: { type: Date, required: true }, // required(2025-10-08~)
|
|
27
|
+
subEvent: mongoose_1.SchemaTypes.Mixed, // support(2025-12-31~)
|
|
27
28
|
workPerformed: mongoose_1.SchemaTypes.Mixed,
|
|
28
29
|
videoFormat: mongoose_1.SchemaTypes.Mixed,
|
|
29
30
|
soundFormat: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -146,6 +147,15 @@ const indexes = [
|
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
],
|
|
150
|
+
[
|
|
151
|
+
{ 'subEvent.videoFormat': 1, startDate: 1 },
|
|
152
|
+
{
|
|
153
|
+
name: 'subEventVideoFormat',
|
|
154
|
+
partialFilterExpression: {
|
|
155
|
+
'subEvent.videoFormat': { $exists: true }
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
],
|
|
149
159
|
[
|
|
150
160
|
{ 'soundFormat.typeOf': 1, startDate: 1 },
|
|
151
161
|
{
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { BulkWriteResult } from 'mongodb';
|
|
2
|
+
import { Connection } from 'mongoose';
|
|
3
|
+
import * as factory from '../../factory';
|
|
4
|
+
/**
|
|
5
|
+
* ゲートを操作する組織
|
|
6
|
+
*/
|
|
7
|
+
interface IOperator {
|
|
8
|
+
/**
|
|
9
|
+
* 施設ID
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
}
|
|
13
|
+
type IEntranceGate = Pick<factory.place.movieTheater.IEntranceGate, 'identifier' | 'name'>;
|
|
14
|
+
type ICreatingEntranceGate = Pick<factory.place.movieTheater.IEntranceGate, 'identifier' | 'name'>;
|
|
15
|
+
interface IUpdateOptions {
|
|
16
|
+
project: {
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 施設の入場ゲートリポジトリ
|
|
22
|
+
*/
|
|
23
|
+
export declare class EntranceGateRepo {
|
|
24
|
+
private readonly operator;
|
|
25
|
+
private readonly civicStructureModel;
|
|
26
|
+
constructor(connection: Connection, operater: IOperator);
|
|
27
|
+
findEntranceGates(params: {
|
|
28
|
+
limit: number;
|
|
29
|
+
page: number;
|
|
30
|
+
project?: {
|
|
31
|
+
id?: {
|
|
32
|
+
$eq?: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
identifier?: {
|
|
36
|
+
$eq?: string;
|
|
37
|
+
};
|
|
38
|
+
}): Promise<IEntranceGate[]>;
|
|
39
|
+
addEntranceGatesByIdentifierIfNotExist(params: {
|
|
40
|
+
$set: ICreatingEntranceGate;
|
|
41
|
+
}[], options: IUpdateOptions): Promise<{
|
|
42
|
+
bulkWriteResult?: BulkWriteResult;
|
|
43
|
+
}>;
|
|
44
|
+
updateEntranceGatesByIdentifier(params: {
|
|
45
|
+
$set: ICreatingEntranceGate;
|
|
46
|
+
}[], options: IUpdateOptions): Promise<{
|
|
47
|
+
bulkWriteResult?: BulkWriteResult;
|
|
48
|
+
}>;
|
|
49
|
+
deleteEntranceGatesByIdentifier(params: {
|
|
50
|
+
/**
|
|
51
|
+
* ゲートコード
|
|
52
|
+
*/
|
|
53
|
+
identifier: string;
|
|
54
|
+
}[], options: IUpdateOptions): Promise<{
|
|
55
|
+
bulkWriteResult?: BulkWriteResult;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
export {};
|