@chevre/domain 23.2.0-alpha.4 → 23.2.0-alpha.40
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} +3 -3
- package/example/src/chevre/{upsertOfferCatalogsByIdentifier.ts → offerCatalog/upsertOfferCatalogsByIdentifier.ts} +4 -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/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 +6 -1
- package/lib/chevre/repo/offerCatalog.js +26 -17
- package/lib/chevre/repo/offerCatalogItem.d.ts +6 -1
- package/lib/chevre/repo/offerCatalogItem.js +24 -15
- 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,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EntranceGateRepo = void 0;
|
|
13
|
+
const mongoose_1 = require("mongoose");
|
|
14
|
+
const factory = require("../../factory");
|
|
15
|
+
const settings_1 = require("../../settings");
|
|
16
|
+
const civicStructure_1 = require("../mongoose/schemas/civicStructure");
|
|
17
|
+
/**
|
|
18
|
+
* 施設の入場ゲートリポジトリ
|
|
19
|
+
*/
|
|
20
|
+
class EntranceGateRepo {
|
|
21
|
+
constructor(connection, operater) {
|
|
22
|
+
this.civicStructureModel = connection.model(civicStructure_1.modelName, (0, civicStructure_1.createSchema)());
|
|
23
|
+
this.operator = operater;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* リポジトリの施設をセットする
|
|
27
|
+
*/
|
|
28
|
+
setOperatorId(params) {
|
|
29
|
+
this.operator.id = params.id;
|
|
30
|
+
}
|
|
31
|
+
findEntranceGates(params) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const aggregate = this.civicStructureModel.aggregate([
|
|
34
|
+
{
|
|
35
|
+
$unwind: {
|
|
36
|
+
path: '$hasEntranceGate'
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
...this.createMatchStages(params),
|
|
40
|
+
{ $sort: { 'hasEntranceGate.identifier': factory.sortType.Ascending } },
|
|
41
|
+
{
|
|
42
|
+
$project: {
|
|
43
|
+
_id: 0,
|
|
44
|
+
identifier: '$hasEntranceGate.identifier',
|
|
45
|
+
name: '$hasEntranceGate.name'
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]);
|
|
49
|
+
const { limit, page } = params;
|
|
50
|
+
if (typeof limit === 'number' && limit > 0) {
|
|
51
|
+
const pageMustBePositive = (typeof page === 'number' && page > 0) ? page : 1;
|
|
52
|
+
aggregate.skip(limit * (pageMustBePositive - 1))
|
|
53
|
+
.limit(limit);
|
|
54
|
+
}
|
|
55
|
+
return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
56
|
+
.exec();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
addEntranceGatesByIdentifierIfNotExist(params, options) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const { project } = options;
|
|
62
|
+
const movieTheaterId = new mongoose_1.Types.ObjectId(this.operator.id);
|
|
63
|
+
const bulkWriteOps = [];
|
|
64
|
+
if (Array.isArray(params)) {
|
|
65
|
+
params.forEach(({ $set }) => {
|
|
66
|
+
const { identifier, name } = $set;
|
|
67
|
+
// ゲートを含まない施設があれば
|
|
68
|
+
const filter = {
|
|
69
|
+
'project.id': { $eq: project.id },
|
|
70
|
+
_id: { $eq: movieTheaterId },
|
|
71
|
+
'hasEntranceGate.identifier': { $ne: identifier }
|
|
72
|
+
};
|
|
73
|
+
const creatingEntranceGate = Object.assign({ identifier, typeOf: factory.placeType.Place }, (typeof (name === null || name === void 0 ? void 0 : name.ja) === 'string' || typeof (name === null || name === void 0 ? void 0 : name.en) === 'string') ? { name } : undefined);
|
|
74
|
+
// ゲートをpush
|
|
75
|
+
const update = {
|
|
76
|
+
$push: { hasEntranceGate: creatingEntranceGate }
|
|
77
|
+
};
|
|
78
|
+
const updateOne = { filter, update };
|
|
79
|
+
bulkWriteOps.push({ updateOne });
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (bulkWriteOps.length > 0) {
|
|
83
|
+
const bulkWriteResult = yield this.civicStructureModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
84
|
+
return { bulkWriteResult };
|
|
85
|
+
}
|
|
86
|
+
return {};
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
updateEntranceGatesByIdentifier(params, options) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const { project } = options;
|
|
92
|
+
const movieTheaterId = new mongoose_1.Types.ObjectId(this.operator.id);
|
|
93
|
+
const bulkWriteOps = [];
|
|
94
|
+
if (Array.isArray(params)) {
|
|
95
|
+
params.forEach(({ $set }) => {
|
|
96
|
+
const { identifier, name } = $set;
|
|
97
|
+
// ゲートを含む施設があれば
|
|
98
|
+
const filter = {
|
|
99
|
+
'project.id': { $eq: project.id },
|
|
100
|
+
_id: { $eq: movieTheaterId },
|
|
101
|
+
'hasEntranceGate.identifier': { $eq: identifier }
|
|
102
|
+
};
|
|
103
|
+
const updatingEntranceGate = Object.assign({ identifier, typeOf: factory.placeType.Place }, (typeof (name === null || name === void 0 ? void 0 : name.ja) === 'string' || typeof (name === null || name === void 0 ? void 0 : name.en) === 'string') ? { name } : undefined);
|
|
104
|
+
const update = {
|
|
105
|
+
$set: {
|
|
106
|
+
'hasEntranceGate.$[entranceGate]': updatingEntranceGate
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
// ゲートコードで$set
|
|
110
|
+
const arrayFilters = [
|
|
111
|
+
{ 'entranceGate.identifier': { $eq: identifier } }
|
|
112
|
+
];
|
|
113
|
+
const updateOne = { filter, update, arrayFilters };
|
|
114
|
+
bulkWriteOps.push({ updateOne });
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (bulkWriteOps.length > 0) {
|
|
118
|
+
const bulkWriteResult = yield this.civicStructureModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
119
|
+
return { bulkWriteResult };
|
|
120
|
+
}
|
|
121
|
+
return {};
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
deleteEntranceGatesByIdentifier(params, options) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
const { project } = options;
|
|
127
|
+
const movieTheaterId = new mongoose_1.Types.ObjectId(this.operator.id);
|
|
128
|
+
const bulkWriteOps = [];
|
|
129
|
+
if (Array.isArray(params)) {
|
|
130
|
+
params.forEach(({ identifier }) => {
|
|
131
|
+
// ゲートを含む施設があれば
|
|
132
|
+
const filter = {
|
|
133
|
+
'project.id': { $eq: project.id },
|
|
134
|
+
_id: { $eq: movieTheaterId },
|
|
135
|
+
'hasEntranceGate.identifier': { $eq: identifier }
|
|
136
|
+
};
|
|
137
|
+
// ゲートをpull
|
|
138
|
+
const update = {
|
|
139
|
+
$pull: { hasEntranceGate: { identifier: { $eq: identifier } } }
|
|
140
|
+
};
|
|
141
|
+
const updateOne = { filter, update };
|
|
142
|
+
bulkWriteOps.push({ updateOne });
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (bulkWriteOps.length > 0) {
|
|
146
|
+
const bulkWriteResult = yield this.civicStructureModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
147
|
+
return { bulkWriteResult };
|
|
148
|
+
}
|
|
149
|
+
return {};
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
createMatchStages(params) {
|
|
153
|
+
var _a, _b, _c, _d;
|
|
154
|
+
const matchStages = [
|
|
155
|
+
{ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(this.operator.id) } } }
|
|
156
|
+
];
|
|
157
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
158
|
+
if (typeof projectIdEq === 'string') {
|
|
159
|
+
matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
|
|
160
|
+
}
|
|
161
|
+
const identifierEq = (_c = params.identifier) === null || _c === void 0 ? void 0 : _c.$eq;
|
|
162
|
+
if (typeof identifierEq === 'string') {
|
|
163
|
+
matchStages.push({ $match: { 'hasEntranceGate.identifier': { $eq: identifierEq } } });
|
|
164
|
+
}
|
|
165
|
+
const identifierIn = (_d = params.identifier) === null || _d === void 0 ? void 0 : _d.$in;
|
|
166
|
+
if (Array.isArray(identifierIn)) {
|
|
167
|
+
matchStages.push({ $match: { 'hasEntranceGate.identifier': { $in: identifierIn } } });
|
|
168
|
+
}
|
|
169
|
+
return matchStages;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
exports.EntranceGateRepo = EntranceGateRepo;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BulkWriteResult } from 'mongodb';
|
|
1
2
|
import type { Connection, FilterQuery } from 'mongoose';
|
|
2
3
|
import * as factory from '../../factory';
|
|
3
4
|
import { IDocType } from '../mongoose/schemas/civicStructure';
|
|
@@ -5,7 +6,23 @@ export type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.I
|
|
|
5
6
|
export type IMovieTheaterIncludingScreeningRooms = Pick<factory.place.movieTheater.IPlace, 'additionalProperty' | 'branchCode' | 'kanaName' | 'name' | 'offers' | 'parentOrganization' | 'project' | 'telephone' | 'typeOf'> & {
|
|
6
7
|
containsPlace: factory.place.screeningRoom.IPlace[];
|
|
7
8
|
};
|
|
8
|
-
type IKeyOfProjection = keyof factory.place.movieTheater.IPlace;
|
|
9
|
+
type IKeyOfProjection = keyof factory.place.movieTheater.IPlace | 'offers.typeOf' | 'offers.eligibleQuantity' | 'offers.availabilityStartsGraceTime' | 'offers.availabilityEndsGraceTime';
|
|
10
|
+
type IMovieTheaterPublicAttributes = Pick<factory.place.movieTheater.IPlace, 'additionalProperty' | 'branchCode' | 'id' | 'kanaName' | 'name' | 'parentOrganization' | 'project' | 'telephone' | 'typeOf' | 'url'> & {
|
|
11
|
+
offers?: Pick<factory.place.movieTheater.IOffer, 'availabilityEndsGraceTime' | 'availabilityStartsGraceTime'>;
|
|
12
|
+
};
|
|
13
|
+
type IUpsertingMovieTheater = Pick<factory.place.movieTheater.IPlace, 'additionalProperty' | 'branchCode' | 'kanaName' | 'name' | 'offers' | 'telephone' | 'url'> & {
|
|
14
|
+
hasEntranceGate?: never;
|
|
15
|
+
hasPOS?: never;
|
|
16
|
+
};
|
|
17
|
+
interface IUpsertOptions {
|
|
18
|
+
project: {
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* 施設の所属販売者ID
|
|
23
|
+
*/
|
|
24
|
+
sellerId: string;
|
|
25
|
+
}
|
|
9
26
|
/**
|
|
10
27
|
* 施設リポジトリ
|
|
11
28
|
*/
|
|
@@ -16,15 +33,35 @@ export declare class MovieTheaterRepo {
|
|
|
16
33
|
/**
|
|
17
34
|
* 施設を保管する
|
|
18
35
|
*/
|
|
19
|
-
saveMovieTheater(params: factory.place.movieTheater.IPlace
|
|
36
|
+
saveMovieTheater(params: Pick<factory.place.movieTheater.IPlace, 'additionalProperty' | 'branchCode' | 'hasEntranceGate' | 'id' | 'kanaName' | 'name' | 'offers' | 'parentOrganization' | 'project' | 'typeOf' | 'url'> & {
|
|
37
|
+
hasEntranceGate?: never;
|
|
38
|
+
}): Promise<{
|
|
20
39
|
id: string;
|
|
21
40
|
}>;
|
|
22
41
|
saveMovieTheaterByBranchCode4coa(params: IMovieTheaterIncludingScreeningRooms): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* コードをキーにして冪等作成
|
|
44
|
+
* 2026-01-13~
|
|
45
|
+
*/
|
|
46
|
+
upsertMovieTheatersByBranchCode(params: {
|
|
47
|
+
$set: IUpsertingMovieTheater;
|
|
48
|
+
$unset?: {
|
|
49
|
+
[key in keyof IUpsertingMovieTheater]?: 1;
|
|
50
|
+
};
|
|
51
|
+
}[], options: IUpsertOptions): Promise<{
|
|
52
|
+
bulkWriteResult?: BulkWriteResult;
|
|
53
|
+
/**
|
|
54
|
+
* 追加あるいは編集された施設
|
|
55
|
+
*/
|
|
56
|
+
modifiedMovieTheaters: {
|
|
57
|
+
id: string;
|
|
58
|
+
}[];
|
|
59
|
+
}>;
|
|
23
60
|
/**
|
|
24
61
|
* 施設のpublic属性検索
|
|
25
62
|
* 2024-09-18~
|
|
26
63
|
*/
|
|
27
|
-
projectPublicFields(params: factory.place.movieTheater.ISearchConditions): Promise<
|
|
64
|
+
projectPublicFields(params: factory.place.movieTheater.ISearchConditions): Promise<IMovieTheaterPublicAttributes[]>;
|
|
28
65
|
/**
|
|
29
66
|
* 施設検索
|
|
30
67
|
* redefine(2024-09-18~)
|
|
@@ -26,7 +26,11 @@ const settings_1 = require("../../settings");
|
|
|
26
26
|
const civicStructure_1 = require("../mongoose/schemas/civicStructure");
|
|
27
27
|
const AVAILABLE_PROJECT_FIELDS = [
|
|
28
28
|
'additionalProperty', 'branchCode', 'hasEntranceGate', 'kanaName', 'name',
|
|
29
|
-
'offers', 'parentOrganization', 'project', 'telephone', 'typeOf', 'url'
|
|
29
|
+
'offers', 'parentOrganization', 'project', 'telephone', 'typeOf', 'url',
|
|
30
|
+
'offers.typeOf',
|
|
31
|
+
'offers.eligibleQuantity',
|
|
32
|
+
'offers.availabilityStartsGraceTime',
|
|
33
|
+
'offers.availabilityEndsGraceTime'
|
|
30
34
|
];
|
|
31
35
|
/**
|
|
32
36
|
* 施設リポジトリ
|
|
@@ -37,7 +41,7 @@ class MovieTheaterRepo {
|
|
|
37
41
|
}
|
|
38
42
|
// tslint:disable-next-line:max-func-body-length
|
|
39
43
|
static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params) {
|
|
40
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
44
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
41
45
|
const andConditions = [{ typeOf: { $eq: factory.placeType.MovieTheater } }];
|
|
42
46
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
43
47
|
if (typeof projectIdEq === 'string') {
|
|
@@ -71,11 +75,15 @@ class MovieTheaterRepo {
|
|
|
71
75
|
]
|
|
72
76
|
});
|
|
73
77
|
}
|
|
74
|
-
const
|
|
78
|
+
const sellerIdEq = (_h = (_g = params.seller) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
79
|
+
if (typeof sellerIdEq === 'string') {
|
|
80
|
+
andConditions.push({ 'parentOrganization.id': { $exists: true, $eq: sellerIdEq } });
|
|
81
|
+
}
|
|
82
|
+
const parentOrganizationIdEq = (_k = (_j = params.parentOrganization) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
75
83
|
if (typeof parentOrganizationIdEq === 'string') {
|
|
76
84
|
andConditions.push({ 'parentOrganization.id': { $exists: true, $eq: parentOrganizationIdEq } });
|
|
77
85
|
}
|
|
78
|
-
const additionalPropertyElemMatch = (
|
|
86
|
+
const additionalPropertyElemMatch = (_l = params.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
|
|
79
87
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
80
88
|
andConditions.push({
|
|
81
89
|
additionalProperty: {
|
|
@@ -94,13 +102,15 @@ class MovieTheaterRepo {
|
|
|
94
102
|
let savedId;
|
|
95
103
|
let doc;
|
|
96
104
|
if (params.id === '') {
|
|
97
|
-
const { id } = params,
|
|
105
|
+
const { id, hasEntranceGate } = params, // 入場ゲートを保管しない(2026-01-11~)
|
|
106
|
+
creatingParams = __rest(params, ["id", "hasEntranceGate"]); // omit id(2024-09-12~)
|
|
98
107
|
doc = yield this.civicStructureModel.create(creatingParams);
|
|
99
108
|
savedId = doc.id;
|
|
100
109
|
}
|
|
101
110
|
else {
|
|
102
111
|
// 上書き禁止属性を除外(2022-08-24~)
|
|
103
|
-
const { id, branchCode, project, typeOf } = params,
|
|
112
|
+
const { id, branchCode, project, typeOf, hasEntranceGate } = params, // 入場ゲートを保管しない(2026-01-11~)
|
|
113
|
+
updateFields = __rest(params, ["id", "branchCode", "project", "typeOf", "hasEntranceGate"]);
|
|
104
114
|
doc = yield this.civicStructureModel.findOneAndUpdate({ _id: { $eq: params.id } }, updateFields, { upsert: false, new: true, projection: { _id: 1 } })
|
|
105
115
|
.exec();
|
|
106
116
|
savedId = params.id;
|
|
@@ -128,6 +138,67 @@ class MovieTheaterRepo {
|
|
|
128
138
|
}
|
|
129
139
|
});
|
|
130
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* コードをキーにして冪等作成
|
|
143
|
+
* 2026-01-13~
|
|
144
|
+
*/
|
|
145
|
+
upsertMovieTheatersByBranchCode(params, options) {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
const { project, sellerId } = options;
|
|
148
|
+
const bulkWriteOps = [];
|
|
149
|
+
const queryFilters = [];
|
|
150
|
+
if (Array.isArray(params)) {
|
|
151
|
+
params.forEach(({ $set, $unset }) => {
|
|
152
|
+
const { branchCode, hasEntranceGate, hasPOS } = $set, // 入場ゲート,POSを決して編集しないように
|
|
153
|
+
setFields = __rest($set, ["branchCode", "hasEntranceGate", "hasPOS"]);
|
|
154
|
+
if (typeof branchCode !== 'string' || branchCode === '') {
|
|
155
|
+
throw new factory.errors.ArgumentNull('branchCode');
|
|
156
|
+
}
|
|
157
|
+
// リソースのユニークネスを保証するfilter
|
|
158
|
+
const filter = {
|
|
159
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
160
|
+
'project.id': { $eq: project.id },
|
|
161
|
+
branchCode: { $eq: branchCode },
|
|
162
|
+
// プロジェクトとコードでユニークな仕様だが、販売者も指定する -> 異なる販売者でコードが重複すればDuplicateErrorとなる
|
|
163
|
+
'parentOrganization.id': { $exists: true, $eq: sellerId }
|
|
164
|
+
};
|
|
165
|
+
const initialMovieTheater = {
|
|
166
|
+
typeOf: factory.placeType.MovieTheater,
|
|
167
|
+
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
168
|
+
branchCode,
|
|
169
|
+
parentOrganization: { id: sellerId, typeOf: factory.organizationType.Corporation }
|
|
170
|
+
};
|
|
171
|
+
const setOnInsert = initialMovieTheater;
|
|
172
|
+
const update = Object.assign({ $setOnInsert: setOnInsert, $set: setFields }, ($unset !== undefined) ? { $unset } : undefined);
|
|
173
|
+
const updateOne = {
|
|
174
|
+
filter,
|
|
175
|
+
update,
|
|
176
|
+
upsert: true
|
|
177
|
+
};
|
|
178
|
+
bulkWriteOps.push({ updateOne });
|
|
179
|
+
queryFilters.push({
|
|
180
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
181
|
+
'project.id': { $eq: project.id },
|
|
182
|
+
branchCode: { $eq: branchCode },
|
|
183
|
+
// プロジェクトとコードでユニークな仕様だが、販売者も指定する -> 異なる販売者でコードが重複すればDuplicateErrorとなる
|
|
184
|
+
'parentOrganization.id': { $exists: true, $eq: sellerId }
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
if (bulkWriteOps.length > 0) {
|
|
189
|
+
const bulkWriteResult = yield this.civicStructureModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
190
|
+
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
191
|
+
const modifiedMovieTheaters = yield this.civicStructureModel.find({ $or: queryFilters }, {
|
|
192
|
+
_id: 0,
|
|
193
|
+
id: { $toString: '$_id' }
|
|
194
|
+
})
|
|
195
|
+
.lean()
|
|
196
|
+
.exec();
|
|
197
|
+
return { bulkWriteResult, modifiedMovieTheaters };
|
|
198
|
+
}
|
|
199
|
+
return { modifiedMovieTheaters: [] };
|
|
200
|
+
});
|
|
201
|
+
}
|
|
131
202
|
/**
|
|
132
203
|
* 施設のpublic属性検索
|
|
133
204
|
* 2024-09-18~
|
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BulkWriteResult } from 'mongodb';
|
|
2
|
+
import { Connection, FilterQuery, PipelineStage } from 'mongoose';
|
|
2
3
|
import * as factory from '../../factory';
|
|
4
|
+
import { IDocType } from '../mongoose/schemas/place';
|
|
3
5
|
export type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace' | 'seatCount' | 'parentOrganization'>;
|
|
6
|
+
type IMatchStage = PipelineStage.Match;
|
|
7
|
+
type IUpsertingRoom = Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'name' | 'openSeatingAllowed'>;
|
|
8
|
+
interface IUpdateOptions {
|
|
9
|
+
project: {
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
parentOrganization?: {
|
|
13
|
+
id?: string;
|
|
14
|
+
};
|
|
15
|
+
movieTheaterCode: string;
|
|
16
|
+
}
|
|
17
|
+
interface IUpsertOptions {
|
|
18
|
+
project: {
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
parentOrganization?: {
|
|
22
|
+
id?: string;
|
|
23
|
+
};
|
|
24
|
+
movieTheaterId: string;
|
|
25
|
+
}
|
|
4
26
|
/**
|
|
5
27
|
* ルーム編集時レスポンス
|
|
6
28
|
*/
|
|
@@ -23,47 +45,34 @@ export declare class ScreeningRoomRepo {
|
|
|
23
45
|
private readonly civicStructureModel;
|
|
24
46
|
private readonly placeModel;
|
|
25
47
|
constructor(connection: Connection);
|
|
48
|
+
static CREATE_ROOM_MONGO_CONDITIONS(searchConditions: Omit<factory.place.screeningRoom.ISearchConditions, '$projection' | 'limit' | 'page'>): IMatchStage[];
|
|
26
49
|
saveScreeningRooms4coa(params: IMovieTheaterIncludingScreeningRooms): Promise<void>;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
branchCode: string;
|
|
30
|
-
};
|
|
31
|
-
parentOrganization?: {
|
|
32
|
-
id?: string;
|
|
33
|
-
};
|
|
34
|
-
}): Promise<IUpdateScreeningRoomResult>;
|
|
35
|
-
updateScreeningRoom(screeningRoom: Omit<factory.place.screeningRoom.IPlace, 'containedInPlace' | 'containsPlace' | 'parentOrganization'> & {
|
|
36
|
-
containedInPlace: {
|
|
37
|
-
branchCode: string;
|
|
38
|
-
};
|
|
39
|
-
parentOrganization?: {
|
|
40
|
-
id?: string;
|
|
41
|
-
};
|
|
42
|
-
}, $unset: any): Promise<IUpdateScreeningRoomResult>;
|
|
50
|
+
createRoom(screeningRoom: Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'name' | 'openSeatingAllowed'>, options: IUpdateOptions): Promise<IUpdateScreeningRoomResult>;
|
|
51
|
+
updateRoomByBranchCode(screeningRoom: Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'name' | 'openSeatingAllowed'>, $unset: any, options: IUpdateOptions): Promise<IUpdateScreeningRoomResult>;
|
|
43
52
|
updateScreeningRoomsByContainedInPlaceId(screeningRoom: {
|
|
44
53
|
project: {
|
|
45
54
|
id: string;
|
|
46
55
|
};
|
|
47
56
|
containedInPlace: Pick<factory.place.screeningRoom.IContainedInPlace, 'id' | 'name'>;
|
|
48
57
|
}): Promise<void>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
/**
|
|
59
|
+
* コードをキーにして冪等作成
|
|
60
|
+
* 2026-01-12~
|
|
61
|
+
*/
|
|
62
|
+
upsertRoomsByBranchCode(params: {
|
|
63
|
+
$set: IUpsertingRoom;
|
|
64
|
+
$unset?: {
|
|
65
|
+
[key in keyof IUpsertingRoom]?: 1;
|
|
66
|
+
};
|
|
67
|
+
}[], options: IUpsertOptions): Promise<{
|
|
68
|
+
bulkWriteResult?: BulkWriteResult;
|
|
69
|
+
}>;
|
|
70
|
+
deleteRoomByBranchCode(screeningRoom: {
|
|
56
71
|
/**
|
|
57
72
|
* ルームコード
|
|
58
73
|
*/
|
|
59
74
|
branchCode: string;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 施設コード
|
|
63
|
-
*/
|
|
64
|
-
branchCode: string;
|
|
65
|
-
};
|
|
66
|
-
}): Promise<IUpdateScreeningRoomResult>;
|
|
75
|
+
}, options: IUpdateOptions): Promise<IUpdateScreeningRoomResult>;
|
|
67
76
|
deleteScreeningRoomsByMovieTheaterId(params: {
|
|
68
77
|
project: {
|
|
69
78
|
id: string;
|
|
@@ -76,6 +85,7 @@ export declare class ScreeningRoomRepo {
|
|
|
76
85
|
};
|
|
77
86
|
}): Promise<import("mongodb").DeleteResult>;
|
|
78
87
|
searchScreeningRooms(searchConditions: factory.place.screeningRoom.ISearchConditions): Promise<Omit<factory.place.screeningRoom.IPlace, 'containsPlace' | 'parentOrganization'>[]>;
|
|
88
|
+
findRooms(params: Omit<factory.place.screeningRoom.ISearchConditions, '$projection'>): Promise<Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'name' | 'openSeatingAllowed' | 'maximumAttendeeCapacity'>[]>;
|
|
79
89
|
/**
|
|
80
90
|
* セクションと座席も含めたひとつのルームを取得する
|
|
81
91
|
*/
|
|
@@ -114,5 +124,24 @@ export declare class ScreeningRoomRepo {
|
|
|
114
124
|
id: string;
|
|
115
125
|
};
|
|
116
126
|
}): Promise<void>;
|
|
127
|
+
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, IDocType> & Omit<import("@chevre/factory/lib/place/screeningRoom").IPlace, "containsPlace"> & {
|
|
128
|
+
description?: any;
|
|
129
|
+
openingHoursSpecification?: any;
|
|
130
|
+
smokingAllowed?: boolean;
|
|
131
|
+
containsPlace: (Pick<import("@chevre/factory/lib/place/screeningRoomSection").IPlace, "name" | "typeOf" | "additionalProperty" | "branchCode"> & {
|
|
132
|
+
containsPlace?: factory.place.seat.IPlace[];
|
|
133
|
+
})[];
|
|
134
|
+
} & {
|
|
135
|
+
_id: import("mongoose").Types.ObjectId;
|
|
136
|
+
}, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, IDocType> & Omit<import("@chevre/factory/lib/place/screeningRoom").IPlace, "containsPlace"> & {
|
|
137
|
+
description?: any;
|
|
138
|
+
openingHoursSpecification?: any;
|
|
139
|
+
smokingAllowed?: boolean;
|
|
140
|
+
containsPlace: (Pick<import("@chevre/factory/lib/place/screeningRoomSection").IPlace, "name" | "typeOf" | "additionalProperty" | "branchCode"> & {
|
|
141
|
+
containsPlace?: factory.place.seat.IPlace[];
|
|
142
|
+
})[];
|
|
143
|
+
} & {
|
|
144
|
+
_id: import("mongoose").Types.ObjectId;
|
|
145
|
+
}>>;
|
|
117
146
|
}
|
|
118
147
|
export {};
|