@chevre/domain 23.2.0-alpha.5 → 23.2.0-alpha.7
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/eventSeries/migrateEventSeriesOffers.ts +75 -0
- package/example/src/chevre/place/migrateSectionIdentifier.ts +92 -0
- package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminSeatReadPermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminSeatWritePermissionIfNotExists.ts +33 -0
- package/lib/chevre/repo/creativeWork.js +8 -4
- package/lib/chevre/repo/place/screeningRoom.d.ts +22 -1
- package/lib/chevre/repo/place/screeningRoom.js +5 -0
- package/lib/chevre/repo/place/section.d.ts +32 -1
- package/lib/chevre/repo/place/section.js +77 -6
- package/package.json +2 -2
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
// tslint:disable-next-line:max-func-body-length
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
+
|
|
11
|
+
const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const cursor = eventSeriesRepo.getCursor(
|
|
14
|
+
{
|
|
15
|
+
// _id: { $eq: 'bmd7x21f2' },
|
|
16
|
+
// 'project.id': { $eq: 'xxx' },
|
|
17
|
+
'offers.typeOf': {
|
|
18
|
+
$exists: true,
|
|
19
|
+
$eq: chevre.factory.offerType.AggregateOffer
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
// _id: 1,
|
|
24
|
+
// offers: 1,
|
|
25
|
+
// startDate: 1,
|
|
26
|
+
// project: 1,
|
|
27
|
+
// typeOf: 1
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
console.log('docs found');
|
|
31
|
+
|
|
32
|
+
let i = 0;
|
|
33
|
+
let updateCount = 0;
|
|
34
|
+
await cursor.eachAsync(async (doc) => {
|
|
35
|
+
i += 1;
|
|
36
|
+
const eventSeries: Pick<
|
|
37
|
+
chevre.factory.eventSeries.IEvent,
|
|
38
|
+
'id' | 'offers' | 'startDate' | 'project' | 'typeOf'
|
|
39
|
+
> = doc.toObject();
|
|
40
|
+
|
|
41
|
+
console.log(
|
|
42
|
+
'alreadyMigrated?', eventSeries.project.id, eventSeries.typeOf, eventSeries.id, eventSeries.startDate, i);
|
|
43
|
+
const alreadyMigrated = eventSeries.offers?.typeOf === chevre.factory.offerType.Offer;
|
|
44
|
+
|
|
45
|
+
if (alreadyMigrated) {
|
|
46
|
+
console.log(
|
|
47
|
+
'already migrated.', eventSeries.project.id, eventSeries.typeOf, eventSeries.id, eventSeries.startDate, i);
|
|
48
|
+
} else {
|
|
49
|
+
console.log(
|
|
50
|
+
'updating...',
|
|
51
|
+
eventSeries.project.id, eventSeries.typeOf, eventSeries.id, eventSeries.startDate, i);
|
|
52
|
+
await eventSeriesRepo.saveEventSeries({
|
|
53
|
+
id: eventSeries.id,
|
|
54
|
+
attributes: <any>{
|
|
55
|
+
...{
|
|
56
|
+
typeOf: eventSeries.typeOf,
|
|
57
|
+
'offers.typeOf': chevre.factory.offerType.Offer
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
updateCount += 1;
|
|
62
|
+
console.log(
|
|
63
|
+
'updated.',
|
|
64
|
+
eventSeries.project.id, eventSeries.typeOf, eventSeries.id, eventSeries.startDate, i);
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
console.log(i, 'docs checked');
|
|
70
|
+
console.log(updateCount, 'docs updated');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
main()
|
|
74
|
+
.then()
|
|
75
|
+
.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,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,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.seats.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.seats.*'
|
|
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);
|
|
@@ -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,6 +90,10 @@ 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~)
|
|
@@ -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: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Connection } from 'mongoose';
|
|
1
|
+
import type { Connection, FilterQuery } from 'mongoose';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
3
|
export type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace' | 'seatCount' | 'parentOrganization'>;
|
|
4
4
|
/**
|
|
@@ -114,5 +114,26 @@ export declare class ScreeningRoomRepo {
|
|
|
114
114
|
id: string;
|
|
115
115
|
};
|
|
116
116
|
}): Promise<void>;
|
|
117
|
+
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, import("@chevre/factory/lib/place/screeningRoom").IPlace & {
|
|
118
|
+
description?: any;
|
|
119
|
+
openingHoursSpecification?: any;
|
|
120
|
+
smokingAllowed?: boolean;
|
|
121
|
+
}> & import("@chevre/factory/lib/place/screeningRoom").IPlace & {
|
|
122
|
+
description?: any;
|
|
123
|
+
openingHoursSpecification?: any;
|
|
124
|
+
smokingAllowed?: boolean;
|
|
125
|
+
} & {
|
|
126
|
+
_id: import("mongoose").Types.ObjectId;
|
|
127
|
+
}, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, import("@chevre/factory/lib/place/screeningRoom").IPlace & {
|
|
128
|
+
description?: any;
|
|
129
|
+
openingHoursSpecification?: any;
|
|
130
|
+
smokingAllowed?: boolean;
|
|
131
|
+
}> & import("@chevre/factory/lib/place/screeningRoom").IPlace & {
|
|
132
|
+
description?: any;
|
|
133
|
+
openingHoursSpecification?: any;
|
|
134
|
+
smokingAllowed?: boolean;
|
|
135
|
+
} & {
|
|
136
|
+
_id: import("mongoose").Types.ObjectId;
|
|
137
|
+
}>>;
|
|
117
138
|
}
|
|
118
139
|
export {};
|
|
@@ -430,5 +430,10 @@ class ScreeningRoomRepo {
|
|
|
430
430
|
.exec();
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
|
+
getCursor(conditions, projection) {
|
|
434
|
+
return this.placeModel.find(conditions, projection)
|
|
435
|
+
.sort({ branchCode: factory.sortType.Ascending })
|
|
436
|
+
.cursor();
|
|
437
|
+
}
|
|
433
438
|
}
|
|
434
439
|
exports.ScreeningRoomRepo = ScreeningRoomRepo;
|
|
@@ -25,17 +25,48 @@ export declare class SectionRepo {
|
|
|
25
25
|
id?: string;
|
|
26
26
|
};
|
|
27
27
|
}): Promise<IUpdateSectionResult>;
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* セクションの名称と追加特性を編集する
|
|
30
|
+
*/
|
|
31
|
+
updateSectionByBranchCode(screeningRoomSection: Omit<factory.place.screeningRoomSection.IPlace, 'containedInPlace' | 'containsPlace'> & {
|
|
29
32
|
containedInPlace: {
|
|
30
33
|
branchCode: string;
|
|
31
34
|
containedInPlace: {
|
|
32
35
|
branchCode: string;
|
|
33
36
|
};
|
|
34
37
|
};
|
|
38
|
+
containsPlace?: never;
|
|
35
39
|
parentOrganization?: {
|
|
36
40
|
id?: string;
|
|
37
41
|
};
|
|
38
42
|
}, $unset: any): Promise<IUpdateSectionResult>;
|
|
43
|
+
/**
|
|
44
|
+
* セクションの座席を上書きする
|
|
45
|
+
*/
|
|
46
|
+
overwriteSeats(screeningRoomSection: Pick<factory.place.screeningRoomSection.IPlace, 'branchCode' | 'containsPlace' | 'project'> & {
|
|
47
|
+
containedInPlace: {
|
|
48
|
+
branchCode: string;
|
|
49
|
+
containedInPlace: {
|
|
50
|
+
branchCode: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
parentOrganization?: {
|
|
54
|
+
id?: string;
|
|
55
|
+
};
|
|
56
|
+
}): Promise<IUpdateSectionResult>;
|
|
57
|
+
migrateSectionIdentifier(screeningRoomSection: {
|
|
58
|
+
project: {
|
|
59
|
+
id: string;
|
|
60
|
+
};
|
|
61
|
+
identifier: string;
|
|
62
|
+
branchCode: string;
|
|
63
|
+
containedInPlace: {
|
|
64
|
+
branchCode: string;
|
|
65
|
+
containedInPlace: {
|
|
66
|
+
branchCode: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
}): Promise<IUpdateSectionResult>;
|
|
39
70
|
searchScreeningRoomSections(searchConditions: factory.place.screeningRoomSection.ISearchConditions): Promise<IScreeningRoomSectionWithoutContainsPlace[]>;
|
|
40
71
|
/**
|
|
41
72
|
* ルーム指定のセクション検索として再定義(2025-12-07~)
|
|
@@ -68,8 +68,11 @@ class SectionRepo {
|
|
|
68
68
|
return doc.toObject();
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* セクションの名称と追加特性を編集する
|
|
73
|
+
*/
|
|
71
74
|
// tslint:disable-next-line:max-func-body-length
|
|
72
|
-
|
|
75
|
+
updateSectionByBranchCode(screeningRoomSection, $unset) {
|
|
73
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
77
|
var _a;
|
|
75
78
|
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
@@ -82,7 +85,7 @@ class SectionRepo {
|
|
|
82
85
|
}
|
|
83
86
|
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: screeningRoomSection.project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode }, branchCode: { $eq: screeningRoom.branchCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode } }, (typeof ((_a = screeningRoomSection.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
84
87
|
? { 'parentOrganization.id': { $exists: true, $eq: screeningRoomSection.parentOrganization.id } }
|
|
85
|
-
: undefined), Object.assign(Object.assign(Object.assign(
|
|
88
|
+
: undefined), Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].branchCode': screeningRoomSection.branchCode }, (screeningRoomSection.name !== undefined && screeningRoomSection !== null)
|
|
86
89
|
? {
|
|
87
90
|
'containsPlace.$[screeningRoomSection].name': screeningRoomSection.name
|
|
88
91
|
}
|
|
@@ -90,13 +93,81 @@ class SectionRepo {
|
|
|
90
93
|
? {
|
|
91
94
|
'containsPlace.$[screeningRoomSection].additionalProperty': screeningRoomSection.additionalProperty
|
|
92
95
|
}
|
|
93
|
-
: undefined), (
|
|
96
|
+
: undefined), ($unset !== undefined && $unset !== null) ? { $unset } : undefined), {
|
|
97
|
+
new: true,
|
|
98
|
+
arrayFilters: [
|
|
99
|
+
{ 'screeningRoomSection.branchCode': screeningRoomSection.branchCode }
|
|
100
|
+
],
|
|
101
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
102
|
+
})
|
|
103
|
+
.exec();
|
|
104
|
+
if (doc === null) {
|
|
105
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoomSection);
|
|
106
|
+
}
|
|
107
|
+
return doc.toObject();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* セクションの座席を上書きする
|
|
112
|
+
*/
|
|
113
|
+
// tslint:disable-next-line:max-func-body-length
|
|
114
|
+
overwriteSeats(screeningRoomSection) {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
var _a;
|
|
117
|
+
const { containedInPlace, containsPlace } = screeningRoomSection;
|
|
118
|
+
const screeningRoom = containedInPlace;
|
|
119
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
120
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
121
|
+
}
|
|
122
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
123
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
124
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
125
|
+
}
|
|
126
|
+
if (!Array.isArray(containsPlace)) {
|
|
127
|
+
throw new factory.errors.ArgumentNull('containsPlace');
|
|
128
|
+
}
|
|
129
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: screeningRoomSection.project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode }, branchCode: { $eq: screeningRoom.branchCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode } }, (typeof ((_a = screeningRoomSection.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
130
|
+
? { 'parentOrganization.id': { $exists: true, $eq: screeningRoomSection.parentOrganization.id } }
|
|
131
|
+
: undefined), Object.assign({}, (containsPlace.length > 0)
|
|
94
132
|
? {
|
|
95
|
-
'containsPlace.$[screeningRoomSection].containsPlace':
|
|
133
|
+
'containsPlace.$[screeningRoomSection].containsPlace': containsPlace.map((p) => {
|
|
96
134
|
return Object.assign(Object.assign(Object.assign({ typeOf: p.typeOf, branchCode: p.branchCode }, (p.name !== undefined && p.name !== null) ? { name: p.name } : undefined), (Array.isArray(p.seatingType)) ? { seatingType: p.seatingType } : undefined), (Array.isArray(p.additionalProperty)) ? { additionalProperty: p.additionalProperty } : undefined);
|
|
97
135
|
})
|
|
98
136
|
}
|
|
99
|
-
: undefined),
|
|
137
|
+
: undefined), {
|
|
138
|
+
new: true,
|
|
139
|
+
arrayFilters: [
|
|
140
|
+
{ 'screeningRoomSection.branchCode': screeningRoomSection.branchCode }
|
|
141
|
+
],
|
|
142
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
143
|
+
})
|
|
144
|
+
.exec();
|
|
145
|
+
if (doc === null) {
|
|
146
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoomSection);
|
|
147
|
+
}
|
|
148
|
+
return doc.toObject();
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
// tslint:disable-next-line:max-func-body-length
|
|
152
|
+
migrateSectionIdentifier(screeningRoomSection) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
155
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
156
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
157
|
+
}
|
|
158
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
159
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
160
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
161
|
+
}
|
|
162
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
163
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
164
|
+
'project.id': { $eq: screeningRoomSection.project.id },
|
|
165
|
+
'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode },
|
|
166
|
+
branchCode: { $eq: screeningRoom.branchCode },
|
|
167
|
+
'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }
|
|
168
|
+
}, {
|
|
169
|
+
'containsPlace.$[screeningRoomSection].identifier': screeningRoomSection.identifier
|
|
170
|
+
}, {
|
|
100
171
|
new: true,
|
|
101
172
|
arrayFilters: [
|
|
102
173
|
{ 'screeningRoomSection.branchCode': screeningRoomSection.branchCode }
|
|
@@ -209,7 +280,7 @@ class SectionRepo {
|
|
|
209
280
|
{ $unwind: '$containsPlace' },
|
|
210
281
|
...matchStages,
|
|
211
282
|
{
|
|
212
|
-
$project: Object.assign(Object.assign({ _id: 0, typeOf: '$containsPlace.typeOf', branchCode: '$containsPlace.branchCode', name: '$containsPlace.name', additionalProperty: '$containsPlace.additionalProperty' }, (((_p = searchConditions.$projection) === null || _p === void 0 ? void 0 : _p.containedInPlace) === 1)
|
|
283
|
+
$project: Object.assign(Object.assign({ _id: 0, typeOf: '$containsPlace.typeOf', branchCode: '$containsPlace.branchCode', identifier: '$containsPlace.identifier', name: '$containsPlace.name', additionalProperty: '$containsPlace.additionalProperty' }, (((_p = searchConditions.$projection) === null || _p === void 0 ? void 0 : _p.containedInPlace) === 1)
|
|
213
284
|
? {
|
|
214
285
|
containedInPlace: {
|
|
215
286
|
typeOf: '$typeOf',
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "5.4.0-alpha.
|
|
14
|
+
"@chevre/factory": "5.4.0-alpha.9",
|
|
15
15
|
"@cinerino/sdk": "12.12.1",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "23.2.0-alpha.
|
|
118
|
+
"version": "23.2.0-alpha.7"
|
|
119
119
|
}
|