@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
|
@@ -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: {
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -344,15 +344,27 @@ class EventRepo {
|
|
|
344
344
|
}
|
|
345
345
|
if (bulkWriteOps.length > 0) {
|
|
346
346
|
const bulkWriteResult = yield this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
347
|
-
//
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
347
|
+
// update:falseの場合、upsertedIdsのみmodifiedEventsとして返せばよい(2026-01-16~)
|
|
348
|
+
if (!update) {
|
|
349
|
+
// BulkWriteResult -> upsertedIds: { '0': '7iri6p4m54k0r3g' }
|
|
350
|
+
return {
|
|
351
|
+
bulkWriteResult,
|
|
352
|
+
modifiedEvents: Object.values(bulkWriteResult.upsertedIds)
|
|
353
|
+
.map((id) => ({ id: String(id) }))
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
358
|
+
const modifiedEvents = yield this.eventModel.find({ $or: queryFilters }, {
|
|
359
|
+
_id: 0,
|
|
360
|
+
id: { $toString: '$_id' }
|
|
361
|
+
})
|
|
362
|
+
.lean()
|
|
363
|
+
.exec();
|
|
364
|
+
return { bulkWriteResult, modifiedEvents };
|
|
365
|
+
}
|
|
355
366
|
}
|
|
367
|
+
return { modifiedEvents: [] };
|
|
356
368
|
});
|
|
357
369
|
}
|
|
358
370
|
/**
|
|
@@ -48,5 +48,13 @@ export declare class EventOfferRepo {
|
|
|
48
48
|
id: string;
|
|
49
49
|
};
|
|
50
50
|
}): Promise<DeleteResult>;
|
|
51
|
+
/**
|
|
52
|
+
* 有効期間を過ぎたイベントオファーを削除する
|
|
53
|
+
*/
|
|
54
|
+
deleteEventOffersExpired(params: {
|
|
55
|
+
validThrough: {
|
|
56
|
+
$lte: Date;
|
|
57
|
+
};
|
|
58
|
+
}): Promise<DeleteResult>;
|
|
51
59
|
}
|
|
52
60
|
export {};
|
|
@@ -187,5 +187,16 @@ class EventOfferRepo {
|
|
|
187
187
|
.exec();
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* 有効期間を過ぎたイベントオファーを削除する
|
|
192
|
+
*/
|
|
193
|
+
deleteEventOffersExpired(params) {
|
|
194
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
return this.eventOfferModel.deleteMany({
|
|
196
|
+
validThrough: { $lte: params.validThrough.$lte }
|
|
197
|
+
})
|
|
198
|
+
.exec();
|
|
199
|
+
});
|
|
200
|
+
}
|
|
190
201
|
}
|
|
191
202
|
exports.EventOfferRepo = EventOfferRepo;
|
|
@@ -27,17 +27,23 @@ export declare class EventSeriesRepo {
|
|
|
27
27
|
attributes: factory.eventSeries.IAttributes;
|
|
28
28
|
}[]): Promise<BulkWriteResult | void>;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* 施設+コンテンツ+バージョンをキーにして冪等置換
|
|
31
31
|
*/
|
|
32
32
|
upsertByVersion(params: {
|
|
33
33
|
$set: factory.eventSeries.IAttributes;
|
|
34
34
|
$unset?: IUnset;
|
|
35
|
-
}[]
|
|
36
|
-
|
|
35
|
+
}[], options: {
|
|
36
|
+
/**
|
|
37
|
+
* falseの場合setOnInsertのみ
|
|
38
|
+
* trueの場合setOnInsert+setのみ
|
|
39
|
+
*/
|
|
40
|
+
upsert: boolean;
|
|
41
|
+
}): Promise<{
|
|
42
|
+
bulkWriteResult?: BulkWriteResult;
|
|
37
43
|
modifiedEvents: {
|
|
38
44
|
id: string;
|
|
39
45
|
}[];
|
|
40
|
-
}
|
|
46
|
+
}>;
|
|
41
47
|
saveEventSeries(params: {
|
|
42
48
|
id?: string;
|
|
43
49
|
attributes: factory.eventSeries.IAttributes;
|
|
@@ -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') {
|
|
@@ -294,13 +298,13 @@ class EventSeriesRepo {
|
|
|
294
298
|
});
|
|
295
299
|
}
|
|
296
300
|
/**
|
|
297
|
-
*
|
|
301
|
+
* 施設+コンテンツ+バージョンをキーにして冪等置換
|
|
298
302
|
*/
|
|
299
|
-
|
|
300
|
-
upsertByVersion(params) {
|
|
303
|
+
upsertByVersion(params, options) {
|
|
301
304
|
return __awaiter(this, void 0, void 0, function* () {
|
|
305
|
+
const { upsert } = options;
|
|
302
306
|
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
303
|
-
const
|
|
307
|
+
const bulkWriteOps = [];
|
|
304
308
|
const queryFilters = [];
|
|
305
309
|
if (Array.isArray(params)) {
|
|
306
310
|
params.forEach(({ $set, $unset }) => {
|
|
@@ -329,21 +333,45 @@ class EventSeriesRepo {
|
|
|
329
333
|
typeOf,
|
|
330
334
|
_id: uniqid()
|
|
331
335
|
};
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
let updateOne;
|
|
337
|
+
if (upsert === true) {
|
|
338
|
+
updateOne = {
|
|
339
|
+
filter,
|
|
340
|
+
update: Object.assign({ $setOnInsert: setOnInsert, $set: setFields }, ($unset !== undefined) ? { $unset } : undefined),
|
|
341
|
+
upsert: true
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
updateOne = {
|
|
346
|
+
filter,
|
|
347
|
+
update: {
|
|
348
|
+
$setOnInsert: Object.assign(Object.assign({}, setOnInsert), setFields)
|
|
349
|
+
},
|
|
350
|
+
upsert: true
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
bulkWriteOps.push({ updateOne });
|
|
338
354
|
});
|
|
339
355
|
}
|
|
340
|
-
if (
|
|
341
|
-
const
|
|
342
|
-
//
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
356
|
+
if (bulkWriteOps.length > 0) {
|
|
357
|
+
const bulkWriteResult = yield this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
358
|
+
// upsert:falseの場合、upsertedIdsのみmodifiedEventsとして返せばよい(2026-01-27~)
|
|
359
|
+
if (!upsert) {
|
|
360
|
+
// BulkWriteResult -> upsertedIds: { '0': '7iri6p4m54k0r3g' }
|
|
361
|
+
return {
|
|
362
|
+
bulkWriteResult,
|
|
363
|
+
modifiedEvents: Object.values(bulkWriteResult.upsertedIds)
|
|
364
|
+
.map((id) => ({ id: String(id) }))
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
369
|
+
const modifiedEvents = yield this.eventSeriesModel.find({ $or: queryFilters }, { _id: 1 })
|
|
370
|
+
.exec();
|
|
371
|
+
return { bulkWriteResult, modifiedEvents };
|
|
372
|
+
}
|
|
346
373
|
}
|
|
374
|
+
return { modifiedEvents: [] };
|
|
347
375
|
});
|
|
348
376
|
}
|
|
349
377
|
saveEventSeries(params) {
|
|
@@ -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
|
{
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
|
-
type
|
|
3
|
+
type ISeatSection = Pick<factory.place.screeningRoomSection.IPlace, 'additionalProperty' | 'branchCode' | 'name' | 'typeOf'> & {
|
|
4
|
+
containsPlace?: factory.place.seat.IPlace[];
|
|
5
|
+
};
|
|
6
|
+
type IDocType = Omit<factory.place.screeningRoom.IPlace, 'containsPlace'> & {
|
|
4
7
|
description?: any;
|
|
5
8
|
openingHoursSpecification?: any;
|
|
6
9
|
smokingAllowed?: boolean;
|
|
10
|
+
containsPlace: ISeatSection[];
|
|
7
11
|
};
|
|
8
12
|
type IModel = Model<IDocType>;
|
|
9
13
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
@@ -11,4 +15,4 @@ type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocT
|
|
|
11
15
|
declare const modelName = "Place";
|
|
12
16
|
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
13
17
|
declare function createSchema(): ISchema;
|
|
14
|
-
export { createSchema, IModel, indexes, modelName };
|
|
18
|
+
export { createSchema, IDocType, IModel, indexes, modelName };
|
|
@@ -35,7 +35,16 @@ export declare class OfferCatalogRepo {
|
|
|
35
35
|
$unset?: {
|
|
36
36
|
[key in keyof factory.offerCatalog.IOfferCatalog]?: 1;
|
|
37
37
|
};
|
|
38
|
-
}[]
|
|
38
|
+
}[], options: {
|
|
39
|
+
/**
|
|
40
|
+
* support only update(2026-01-30~)
|
|
41
|
+
*/
|
|
42
|
+
update: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* プロダクトタイプでfilter(2026-01-30~)
|
|
45
|
+
*/
|
|
46
|
+
productType: factory.product.ProductType;
|
|
47
|
+
}): Promise<{
|
|
39
48
|
bulkWriteResult: BulkWriteResult;
|
|
40
49
|
modifiedCatalogs: {
|
|
41
50
|
id: string;
|
|
@@ -195,11 +195,9 @@ class OfferCatalogRepo {
|
|
|
195
195
|
/**
|
|
196
196
|
* コードをキーにして冪等置換(2023-12-14~)
|
|
197
197
|
*/
|
|
198
|
-
upsertManyByIdentifier(params
|
|
199
|
-
// options?: {
|
|
200
|
-
// }
|
|
201
|
-
) {
|
|
198
|
+
upsertManyByIdentifier(params, options) {
|
|
202
199
|
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
const { productType, update } = options;
|
|
203
201
|
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
204
202
|
const bulkWriteOps = [];
|
|
205
203
|
const queryFilters = [];
|
|
@@ -209,28 +207,45 @@ class OfferCatalogRepo {
|
|
|
209
207
|
if (typeof identifier !== 'string' || identifier.length === 0) {
|
|
210
208
|
throw new factory.errors.ArgumentNull('identifier');
|
|
211
209
|
}
|
|
210
|
+
// 指定されたproductTypeを強制する
|
|
211
|
+
if (setFields.itemOffered.typeOf !== productType) {
|
|
212
|
+
throw new factory.errors.Argument('itemOffered.typeOf', `not matched with productType: ${productType}`);
|
|
213
|
+
}
|
|
212
214
|
// リソースのユニークネスを保証するfilter
|
|
213
215
|
const filter = {
|
|
214
216
|
'project.id': { $eq: project.id },
|
|
215
|
-
identifier: { $eq: identifier }
|
|
217
|
+
identifier: { $eq: identifier },
|
|
218
|
+
'itemOffered.typeOf': { $exists: true, $eq: productType } // プロダクトタイプを変更させないためにフィルター追加(2026-01-30~)
|
|
216
219
|
};
|
|
217
220
|
queryFilters.push({
|
|
218
221
|
'project.id': { $eq: project.id },
|
|
219
|
-
identifier: { $eq: identifier }
|
|
222
|
+
identifier: { $eq: identifier },
|
|
223
|
+
'itemOffered.typeOf': { $exists: true, $eq: productType } // プロダクトタイプを変更させないためにフィルター追加(2026-01-30~)
|
|
220
224
|
});
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
225
|
+
if (update === true) {
|
|
226
|
+
const updateOne = {
|
|
227
|
+
filter,
|
|
228
|
+
update: Object.assign({ $set: setFields }, ($unset !== undefined) ? { $unset } : undefined),
|
|
229
|
+
upsert: false
|
|
230
|
+
};
|
|
231
|
+
bulkWriteOps.push({ updateOne });
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
// デフォルトはupsert操作
|
|
235
|
+
const newId = uniqid();
|
|
236
|
+
const setOnInsert = {
|
|
237
|
+
identifier,
|
|
238
|
+
project,
|
|
239
|
+
typeOf,
|
|
240
|
+
_id: newId
|
|
241
|
+
};
|
|
242
|
+
const updateOne = {
|
|
243
|
+
filter,
|
|
244
|
+
update: Object.assign({ $setOnInsert: setOnInsert, $set: setFields }, ($unset !== undefined) ? { $unset } : undefined),
|
|
245
|
+
upsert: true
|
|
246
|
+
};
|
|
247
|
+
bulkWriteOps.push({ updateOne });
|
|
248
|
+
}
|
|
234
249
|
});
|
|
235
250
|
}
|
|
236
251
|
if (bulkWriteOps.length > 0) {
|
|
@@ -32,7 +32,16 @@ export declare class OfferCatalogItemRepo {
|
|
|
32
32
|
$unset?: {
|
|
33
33
|
[key in keyof factory.offerCatalog.IOfferCatalog]?: 1;
|
|
34
34
|
};
|
|
35
|
-
}[]
|
|
35
|
+
}[], options: {
|
|
36
|
+
/**
|
|
37
|
+
* support only update(2026-01-30~)
|
|
38
|
+
*/
|
|
39
|
+
update: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* プロダクトタイプでfilter(2026-01-30~)
|
|
42
|
+
*/
|
|
43
|
+
productType: factory.product.ProductType;
|
|
44
|
+
}): Promise<{
|
|
36
45
|
bulkWriteResult: BulkWriteResult;
|
|
37
46
|
modifiedCatalogs: {
|
|
38
47
|
id: string;
|
|
@@ -159,11 +159,9 @@ class OfferCatalogItemRepo {
|
|
|
159
159
|
/**
|
|
160
160
|
* コードをキーにして冪等置換(2023-12-14~)
|
|
161
161
|
*/
|
|
162
|
-
upsertManyByIdentifier(params
|
|
163
|
-
// options?: {
|
|
164
|
-
// }
|
|
165
|
-
) {
|
|
162
|
+
upsertManyByIdentifier(params, options) {
|
|
166
163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
const { productType, update } = options;
|
|
167
165
|
const bulkWriteOps = [];
|
|
168
166
|
const queryFilters = [];
|
|
169
167
|
if (Array.isArray(params)) {
|
|
@@ -172,26 +170,43 @@ class OfferCatalogItemRepo {
|
|
|
172
170
|
if (typeof identifier !== 'string' || identifier.length === 0) {
|
|
173
171
|
throw new factory.errors.ArgumentNull('identifier');
|
|
174
172
|
}
|
|
173
|
+
// 指定されたproductTypeを強制する
|
|
174
|
+
if (setFields.itemOffered.typeOf !== productType) {
|
|
175
|
+
throw new factory.errors.Argument('itemOffered.typeOf', `not matched with productType: ${productType}`);
|
|
176
|
+
}
|
|
175
177
|
// リソースのユニークネスを保証するfilter
|
|
176
178
|
const filter = {
|
|
177
179
|
'project.id': { $eq: project.id },
|
|
178
|
-
identifier: { $eq: identifier }
|
|
180
|
+
identifier: { $eq: identifier },
|
|
181
|
+
'itemOffered.typeOf': { $exists: true, $eq: productType } // プロダクトタイプを変更させないためにフィルター追加(2026-01-30~)
|
|
179
182
|
};
|
|
180
183
|
queryFilters.push({
|
|
181
184
|
'project.id': { $eq: project.id },
|
|
182
|
-
identifier: { $eq: identifier }
|
|
185
|
+
identifier: { $eq: identifier },
|
|
186
|
+
'itemOffered.typeOf': { $exists: true, $eq: productType } // プロダクトタイプを変更させないためにフィルター追加(2026-01-30~)
|
|
183
187
|
});
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
188
|
+
if (update === true) {
|
|
189
|
+
const updateOne = {
|
|
190
|
+
filter,
|
|
191
|
+
update: Object.assign({ $set: setFields }, ($unset !== undefined) ? { $unset } : undefined),
|
|
192
|
+
upsert: false
|
|
193
|
+
};
|
|
194
|
+
bulkWriteOps.push({ updateOne });
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
// デフォルトはupsert操作
|
|
198
|
+
const setOnInsert = {
|
|
199
|
+
identifier,
|
|
200
|
+
project,
|
|
201
|
+
typeOf
|
|
202
|
+
};
|
|
203
|
+
const updateOne = {
|
|
204
|
+
filter,
|
|
205
|
+
update: Object.assign({ $setOnInsert: setOnInsert, $set: setFields }, ($unset !== undefined) ? { $unset } : undefined),
|
|
206
|
+
upsert: true
|
|
207
|
+
};
|
|
208
|
+
bulkWriteOps.push({ updateOne });
|
|
209
|
+
}
|
|
195
210
|
});
|
|
196
211
|
}
|
|
197
212
|
if (bulkWriteOps.length > 0) {
|
|
@@ -0,0 +1,57 @@
|
|
|
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.entranceGate.IEntranceGate, 'identifier' | 'name'>;
|
|
14
|
+
type ICreatingEntranceGate = Pick<factory.place.entranceGate.IEntranceGate, 'identifier' | 'name'>;
|
|
15
|
+
interface IUpdateOptions {
|
|
16
|
+
project: {
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 施設の入場ゲートリポジトリ
|
|
22
|
+
*/
|
|
23
|
+
export declare class EntranceGateRepo {
|
|
24
|
+
/**
|
|
25
|
+
* 施設
|
|
26
|
+
*/
|
|
27
|
+
private readonly operator;
|
|
28
|
+
private readonly civicStructureModel;
|
|
29
|
+
constructor(connection: Connection, operater: IOperator);
|
|
30
|
+
/**
|
|
31
|
+
* リポジトリの施設をセットする
|
|
32
|
+
*/
|
|
33
|
+
setOperatorId(params: {
|
|
34
|
+
id: string;
|
|
35
|
+
}): void;
|
|
36
|
+
findEntranceGates(params: factory.place.entranceGate.ISearchConditions): Promise<IEntranceGate[]>;
|
|
37
|
+
addEntranceGatesByIdentifierIfNotExist(params: {
|
|
38
|
+
$set: ICreatingEntranceGate;
|
|
39
|
+
}[], options: IUpdateOptions): Promise<{
|
|
40
|
+
bulkWriteResult?: BulkWriteResult;
|
|
41
|
+
}>;
|
|
42
|
+
updateEntranceGatesByIdentifier(params: {
|
|
43
|
+
$set: ICreatingEntranceGate;
|
|
44
|
+
}[], options: IUpdateOptions): Promise<{
|
|
45
|
+
bulkWriteResult?: BulkWriteResult;
|
|
46
|
+
}>;
|
|
47
|
+
deleteEntranceGatesByIdentifier(params: {
|
|
48
|
+
/**
|
|
49
|
+
* ゲートコード
|
|
50
|
+
*/
|
|
51
|
+
identifier: string;
|
|
52
|
+
}[], options: IUpdateOptions): Promise<{
|
|
53
|
+
bulkWriteResult?: BulkWriteResult;
|
|
54
|
+
}>;
|
|
55
|
+
private createMatchStages;
|
|
56
|
+
}
|
|
57
|
+
export {};
|