@chevre/domain 23.2.0-alpha.6 → 23.2.0-alpha.61
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/acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts +25 -17
- package/example/src/chevre/confirmationNumber/testRandomness.ts +49 -0
- package/example/src/chevre/emailMessage/createEmailMessageText.ts +63 -0
- package/example/src/chevre/event/importEventsFromCOAByTitle.ts +2 -2
- package/example/src/chevre/event/unsetSuperEventVideoFormat.ts +30 -0
- package/example/src/chevre/eventSeries/unsetVideoFormat.ts +31 -0
- package/example/src/chevre/{upsertScreeningEventSeriesByVersion.ts → eventSeries/upsertScreeningEventSeriesByVersion.ts} +47 -43
- package/example/src/chevre/{upsertOfferCatalogItemsByIdentifier.ts → offerCatalog/upsertOfferCatalogItemsByIdentifier.ts} +6 -3
- package/example/src/chevre/{upsertOfferCatalogsByIdentifier.ts → offerCatalog/upsertOfferCatalogsByIdentifier.ts} +8 -3
- package/example/src/chevre/{upsertOffersByIdentifier.ts → offers/upsertOffersByIdentifier.ts} +5 -3
- package/example/src/chevre/orderNumber/testRandomness.ts +54 -0
- 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/addAdminAcceptedPaymentMethodReadPermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminAcceptedPaymentMethodWritePermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +34 -0
- package/example/src/chevre/settings/addOrderNumberSetting.ts +44 -0
- package/example/src/chevre/settings/addTransactionNumberSetting.ts +40 -0
- package/example/src/chevre/transactionNumber/publishByTimestamp.ts +23 -0
- package/example/src/chevre/transactionNumber/testRandomness.ts +42 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +8 -4
- package/lib/chevre/emailMessageBuilder.js +1 -0
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/factory/event.js +11 -5
- package/lib/chevre/factory/transactionNumber.d.ts +19 -0
- package/lib/chevre/factory/transactionNumber.js +54 -0
- package/lib/chevre/repo/acceptedPaymentMethod.d.ts +41 -8
- package/lib/chevre/repo/acceptedPaymentMethod.js +72 -27
- 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/confirmationNumber.d.ts +1 -0
- package/lib/chevre/repo/confirmationNumber.js +32 -25
- package/lib/chevre/repo/event.d.ts +3 -18
- package/lib/chevre/repo/event.js +94 -83
- package/lib/chevre/repo/eventOffer.d.ts +8 -0
- package/lib/chevre/repo/eventOffer.js +11 -0
- package/lib/chevre/repo/eventSeries.d.ts +17 -30
- package/lib/chevre/repo/eventSeries.js +204 -146
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -1
- package/lib/chevre/repo/mongoose/schemas/eventSeries.js +20 -5
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +2 -8
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +28 -2
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -2
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +40 -0
- package/lib/chevre/repo/mongoose/schemas/setting.js +3 -0
- package/lib/chevre/repo/offerCatalog.d.ts +14 -1
- package/lib/chevre/repo/offerCatalog.js +41 -19
- package/lib/chevre/repo/offerCatalogItem.d.ts +10 -1
- package/lib/chevre/repo/offerCatalogItem.js +32 -17
- package/lib/chevre/repo/orderNumber.d.ts +6 -0
- package/lib/chevre/repo/orderNumber.js +110 -35
- 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/serviceOutputIdentifier.d.ts +3 -1
- package/lib/chevre/repo/serviceOutputIdentifier.js +42 -27
- package/lib/chevre/repo/setting.d.ts +1 -1
- package/lib/chevre/repo/setting.js +2 -2
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/repo/transactionNumber.d.ts +5 -0
- package/lib/chevre/repo/transactionNumber.js +63 -27
- package/lib/chevre/repository.d.ts +8 -0
- package/lib/chevre/repository.js +16 -0
- package/lib/chevre/service/assetTransaction/fixInformAction.d.ts +3 -0
- package/lib/chevre/service/assetTransaction/fixInformAction.js +3 -0
- package/lib/chevre/service/assetTransaction/pay/cancel.d.ts +12 -0
- package/lib/chevre/service/assetTransaction/pay/cancel.js +25 -0
- package/lib/chevre/service/assetTransaction/pay/check.d.ts +23 -0
- package/lib/chevre/service/assetTransaction/pay/check.js +37 -0
- package/lib/chevre/service/assetTransaction/pay/confirm.d.ts +24 -0
- package/lib/chevre/service/assetTransaction/pay/confirm.js +72 -0
- package/lib/chevre/service/assetTransaction/pay/exportTasksById.d.ts +18 -0
- package/lib/chevre/service/assetTransaction/pay/exportTasksById.js +111 -0
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.d.ts +48 -0
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +164 -0
- package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.d.ts +20 -0
- package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.js +59 -0
- package/lib/chevre/service/assetTransaction/pay/{account → start/account}/validation.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/pay/{account → start/account}/validation.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/{factory.d.ts → start/factory.d.ts} +1 -1
- package/lib/chevre/service/assetTransaction/pay/{factory.js → start/factory.js} +1 -1
- package/lib/chevre/service/assetTransaction/pay/{validateAcceptedPaymentMethodIfNeeded.d.ts → start/preStart/validateAcceptedPaymentMethodIfNeeded.d.ts} +4 -4
- package/lib/chevre/service/assetTransaction/pay/{validateAcceptedPaymentMethodIfNeeded.js → start/preStart/validateAcceptedPaymentMethodIfNeeded.js} +1 -4
- package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.d.ts +8 -0
- package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.js +54 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeAccount.d.ts +13 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeAccount.js +49 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeCreditCard.d.ts +29 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeCreditCard.js +37 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +42 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.js +31 -0
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +60 -0
- package/lib/chevre/service/assetTransaction/pay/start.js +145 -0
- package/lib/chevre/service/assetTransaction/pay.d.ts +8 -170
- package/lib/chevre/service/assetTransaction/pay.js +16 -623
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +10 -2
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
- package/lib/chevre/service/event/processUpdateMovieTheater.js +13 -11
- package/lib/chevre/service/event/saveScreeningEventSeries.js +4 -5
- package/lib/chevre/service/event/saveScreeningEvents.d.ts +2 -2
- package/lib/chevre/service/event/saveScreeningEvents.js +16 -12
- package/lib/chevre/service/offer/event/authorize/factory.js +9 -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 +7 -1
- package/lib/chevre/service/offer/onEventChanged.js +10 -6
- package/lib/chevre/service/offer/product.js +1 -1
- 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/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +13 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +53 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +13 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +56 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +15 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +58 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +17 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +75 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +19 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +60 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +20 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +51 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +27 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +100 -0
- package/lib/chevre/service/task/onResourceDeleted.d.ts +6 -0
- package/lib/chevre/service/task/onResourceDeleted.js +168 -0
- package/lib/chevre/service/task/onResourceUpdated.js +205 -42
- package/lib/chevre/service/task/syncResourcesFromCOA.js +4 -2
- package/lib/chevre/service/taskHandler.js +1 -0
- package/package.json +9 -9
- package/example/src/chevre/event/upsertManyScreeningEventByIdentifier.ts +0 -191
- package/example/src/chevre/eventSeries/migrateEventSeriesUnacceptedPaymentMethod.ts +0 -93
- package/example/src/chevre/offers/createSampleOffers.ts +0 -154
- package/example/src/chevre/settings/addSettings.ts +0 -46
- package/lib/chevre/service/eventOld.d.ts +0 -60
- package/lib/chevre/service/eventOld.js +0 -864
- package/lib/chevre/service/task/createEvent/createEvent.d.ts +0 -25
- package/lib/chevre/service/task/createEvent/createEvent.js +0 -45
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +0 -22
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +0 -188
- package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.d.ts +0 -15
- package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +0 -116
- package/lib/chevre/service/task/createEvent/createEventBySchedule.d.ts +0 -25
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +0 -107
- package/lib/chevre/service/task/createEvent/createEventSeries.d.ts +0 -13
- package/lib/chevre/service/task/createEvent/createEventSeries.js +0 -118
- package/lib/chevre/service/task/createEvent.d.ts +0 -6
- package/lib/chevre/service/task/createEvent.js +0 -46
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +0 -45
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +0 -447
|
@@ -10,12 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ConfirmationNumberRepo = void 0;
|
|
13
|
-
|
|
13
|
+
// import * as cdigit from 'cdigit';
|
|
14
|
+
const crypto_1 = require("crypto");
|
|
14
15
|
const moment = require("moment-timezone");
|
|
15
|
-
|
|
16
|
+
const fpe2Module = require("node-fpe");
|
|
17
|
+
// 型定義が新しいtypescriptに適合しないので、強制的に型変更
|
|
18
|
+
const fpe2 = fpe2Module;
|
|
16
19
|
// tslint:disable-next-line:no-require-imports no-var-requires
|
|
17
|
-
const fpe = require('node-fpe');
|
|
18
|
-
// import { createSchema as createSettingSchema, modelName as settingModelName } from './mongoose/schemas/setting';
|
|
20
|
+
// const fpe = require('node-fpe-v1');
|
|
19
21
|
const transactionNumber_1 = require("./mongoose/schemas/transactionNumber");
|
|
20
22
|
const transactionNumberCounter_1 = require("./transactionNumberCounter");
|
|
21
23
|
const CONFIRMATION_NUMBER_MIN_LENGH = 4;
|
|
@@ -25,8 +27,6 @@ const TIMEZONE = 'Asia/Tokyo';
|
|
|
25
27
|
*/
|
|
26
28
|
class ConfirmationNumberRepo {
|
|
27
29
|
constructor(params) {
|
|
28
|
-
// const { connection } = params;
|
|
29
|
-
// this.settingModel = connection.model(settingModelName, createSettingSchema());
|
|
30
30
|
this.counterRepo = new transactionNumberCounter_1.TransactionNumberCounterRepo(params);
|
|
31
31
|
}
|
|
32
32
|
static alignDigits(params) {
|
|
@@ -37,32 +37,32 @@ class ConfirmationNumberRepo {
|
|
|
37
37
|
}
|
|
38
38
|
return aligndNumber;
|
|
39
39
|
}
|
|
40
|
-
// private static createKey(params: {
|
|
41
|
-
// orderDate: Date;
|
|
42
|
-
// }): string {
|
|
43
|
-
// return util.format(
|
|
44
|
-
// '%s:%s',
|
|
45
|
-
// ConfirmationNumberRepo.REDIS_KEY_PREFIX_NEW,
|
|
46
|
-
// moment(params.orderDate)
|
|
47
|
-
// .tz(TIMEZONE)
|
|
48
|
-
// .format('YYMM')
|
|
49
|
-
// );
|
|
50
|
-
// }
|
|
51
40
|
static createDataFeedIdentifier(params) {
|
|
52
41
|
return moment(params.orderDate)
|
|
53
42
|
.tz(TIMEZONE)
|
|
54
43
|
.format('YYMM');
|
|
55
44
|
}
|
|
45
|
+
// private static count2confirmationNumberUsingFPE1(params: { count: number }): string {
|
|
46
|
+
// // 桁数調整
|
|
47
|
+
// let confirmationNumber: string = ConfirmationNumberRepo.alignDigits(params.count);
|
|
48
|
+
// // checkdigit
|
|
49
|
+
// const cd = cdigit.luhn.compute(confirmationNumber);
|
|
50
|
+
// // debug('check digit:', cd);
|
|
51
|
+
// confirmationNumber = fpe({ password: cd })
|
|
52
|
+
// .encrypt(confirmationNumber);
|
|
53
|
+
// confirmationNumber = `${cd}${confirmationNumber}`;
|
|
54
|
+
// return confirmationNumber;
|
|
55
|
+
// }
|
|
56
|
+
// reimplement using fpe2(2026-02-02~)
|
|
56
57
|
static count2confirmationNumber(params) {
|
|
57
58
|
// 桁数調整
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return confirmationNumber;
|
|
59
|
+
const rawBody = ConfirmationNumberRepo.alignDigits(params.count);
|
|
60
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
61
|
+
const saltDigit = (0, crypto_1.randomInt)(0, 10);
|
|
62
|
+
const saltStr = saltDigit.toString();
|
|
63
|
+
const cipher = fpe2({ secret: `${saltStr}` });
|
|
64
|
+
const encryptedBody = cipher.encrypt(rawBody);
|
|
65
|
+
return `${saltStr}${encryptedBody}`;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* 発行する
|
|
@@ -87,5 +87,12 @@ class ConfirmationNumberRepo {
|
|
|
87
87
|
return ConfirmationNumberRepo.count2confirmationNumber({ count: incrReply });
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
+
// tslint:disable-next-line:prefer-function-over-method
|
|
91
|
+
decrypt(id) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const cipher = fpe2({ secret: id[0] });
|
|
94
|
+
return cipher.decrypt(id.slice(1));
|
|
95
|
+
});
|
|
96
|
+
}
|
|
90
97
|
}
|
|
91
98
|
exports.ConfirmationNumberRepo = ConfirmationNumberRepo;
|
|
@@ -68,13 +68,6 @@ export declare class EventRepo {
|
|
|
68
68
|
*/
|
|
69
69
|
static CREATE_ID(): string;
|
|
70
70
|
static CREATE_MONGO_CONDITIONS(conditions: ISearchConditions): FilterQuery<factory.event.screeningEvent.IEvent>[];
|
|
71
|
-
/**
|
|
72
|
-
* 複数イベントを作成する
|
|
73
|
-
*/
|
|
74
|
-
createManyEvents(params: {
|
|
75
|
-
attributes: factory.event.screeningEvent.IAttributes[];
|
|
76
|
-
expectsNoContent: boolean;
|
|
77
|
-
}): Promise<string[] | void>;
|
|
78
71
|
/**
|
|
79
72
|
* イベントコードをキーにして冪等置換
|
|
80
73
|
*/
|
|
@@ -90,11 +83,11 @@ export declare class EventRepo {
|
|
|
90
83
|
*/
|
|
91
84
|
update: boolean;
|
|
92
85
|
}): Promise<{
|
|
93
|
-
bulkWriteResult
|
|
86
|
+
bulkWriteResult?: BulkWriteResult;
|
|
94
87
|
modifiedEvents: {
|
|
95
88
|
id: string;
|
|
96
89
|
}[];
|
|
97
|
-
}
|
|
90
|
+
}>;
|
|
98
91
|
/**
|
|
99
92
|
* イベント部分更新
|
|
100
93
|
*/
|
|
@@ -127,14 +120,6 @@ export declare class EventRepo {
|
|
|
127
120
|
$unset?: IUnset;
|
|
128
121
|
upsert: boolean;
|
|
129
122
|
}[]): Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* tttsイベントを識別子によって冪等作成する
|
|
132
|
-
*/
|
|
133
|
-
saveEventByIdentifier4ttts(params: {
|
|
134
|
-
attributes: ICreatingEvent4ttts;
|
|
135
|
-
}): Promise<{
|
|
136
|
-
id: string;
|
|
137
|
-
}>;
|
|
138
123
|
/**
|
|
139
124
|
* イベントを検索する(inclusion projection)
|
|
140
125
|
*/
|
|
@@ -210,7 +195,7 @@ export declare class EventRepo {
|
|
|
210
195
|
project: {
|
|
211
196
|
id: string;
|
|
212
197
|
};
|
|
213
|
-
superEventFromDB: Pick<factory.eventSeries.IEvent, 'additionalProperty' | 'alternativeHeadline' | 'description' | 'dubLanguage' | 'endDate' | 'headline' | 'id' | 'kanaName' | 'location' | 'name' | 'soundFormat' | 'startDate' | 'subtitleLanguage' | 'typeOf' | '
|
|
198
|
+
superEventFromDB: Pick<factory.eventSeries.IEvent, 'additionalProperty' | 'alternativeHeadline' | 'description' | 'dubLanguage' | 'endDate' | 'headline' | 'id' | 'kanaName' | 'location' | 'name' | 'soundFormat' | 'startDate' | 'subtitleLanguage' | 'typeOf' | 'workPerformed'>;
|
|
214
199
|
startDate: {
|
|
215
200
|
$gte: Date;
|
|
216
201
|
};
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -264,33 +264,39 @@ class EventRepo {
|
|
|
264
264
|
}
|
|
265
265
|
return andConditions;
|
|
266
266
|
}
|
|
267
|
-
/**
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
createManyEvents(params
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
267
|
+
// /**
|
|
268
|
+
// * 複数イベントを作成する
|
|
269
|
+
// */
|
|
270
|
+
// public async createManyEvents(params: {
|
|
271
|
+
// attributes: factory.event.screeningEvent.IAttributes[];
|
|
272
|
+
// expectsNoContent: boolean;
|
|
273
|
+
// }): Promise<string[] | void> { // optimize response(only id)(2024-08-02~)
|
|
274
|
+
// const insertingDocs: (factory.event.screeningEvent.IAttributes & { _id: string })[] =
|
|
275
|
+
// params.attributes.map((p) => {
|
|
276
|
+
// return {
|
|
277
|
+
// _id: EventRepo.CREATE_ID(),
|
|
278
|
+
// ...p
|
|
279
|
+
// };
|
|
280
|
+
// });
|
|
281
|
+
// try {
|
|
282
|
+
// await this.eventModel.insertMany<factory.event.screeningEvent.IAttributes & { _id: string }>(
|
|
283
|
+
// insertingDocs,
|
|
284
|
+
// { rawResult: true } // rawResult(2024-08-02~)
|
|
285
|
+
// );
|
|
286
|
+
// // console.dir(insertResult, { depth: null });
|
|
287
|
+
// } catch (error) {
|
|
288
|
+
// if (await isMongoError(error)) {
|
|
289
|
+
// if (error.code === MongoErrorCode.DuplicateKey) {
|
|
290
|
+
// throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEvent, ['offeredBy.member.identifier']);
|
|
291
|
+
// }
|
|
292
|
+
// }
|
|
293
|
+
// throw error;
|
|
294
|
+
// }
|
|
295
|
+
// if (params.expectsNoContent) {
|
|
296
|
+
// return;
|
|
297
|
+
// }
|
|
298
|
+
// return insertingDocs.map(({ _id }) => _id);
|
|
299
|
+
// }
|
|
294
300
|
/**
|
|
295
301
|
* イベントコードをキーにして冪等置換
|
|
296
302
|
*/
|
|
@@ -344,15 +350,27 @@ class EventRepo {
|
|
|
344
350
|
}
|
|
345
351
|
if (bulkWriteOps.length > 0) {
|
|
346
352
|
const bulkWriteResult = yield this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
347
|
-
//
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
353
|
+
// update:falseの場合、upsertedIdsのみmodifiedEventsとして返せばよい(2026-01-16~)
|
|
354
|
+
if (!update) {
|
|
355
|
+
// BulkWriteResult -> upsertedIds: { '0': '7iri6p4m54k0r3g' }
|
|
356
|
+
return {
|
|
357
|
+
bulkWriteResult,
|
|
358
|
+
modifiedEvents: Object.values(bulkWriteResult.upsertedIds)
|
|
359
|
+
.map((id) => ({ id: String(id) }))
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
364
|
+
const modifiedEvents = yield this.eventModel.find({ $or: queryFilters }, {
|
|
365
|
+
_id: 0,
|
|
366
|
+
id: { $toString: '$_id' }
|
|
367
|
+
})
|
|
368
|
+
.lean()
|
|
369
|
+
.exec();
|
|
370
|
+
return { bulkWriteResult, modifiedEvents };
|
|
371
|
+
}
|
|
355
372
|
}
|
|
373
|
+
return { modifiedEvents: [] };
|
|
356
374
|
});
|
|
357
375
|
}
|
|
358
376
|
/**
|
|
@@ -465,54 +483,47 @@ class EventRepo {
|
|
|
465
483
|
}
|
|
466
484
|
});
|
|
467
485
|
}
|
|
468
|
-
/**
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
saveEventByIdentifier4ttts(params
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
.exec();
|
|
510
|
-
if (doc === null) {
|
|
511
|
-
throw new factory.errors.NotFound(this.eventModel.modelName);
|
|
512
|
-
}
|
|
513
|
-
return { id: doc._id }; // optimize(2024-07-31~)
|
|
514
|
-
});
|
|
515
|
-
}
|
|
486
|
+
// /**
|
|
487
|
+
// * tttsイベントを識別子によって冪等作成する
|
|
488
|
+
// */
|
|
489
|
+
// public async saveEventByIdentifier4ttts(params: {
|
|
490
|
+
// // oldEventId: string;
|
|
491
|
+
// attributes: ICreatingEvent4ttts;
|
|
492
|
+
// }): Promise<{ id: string }> {
|
|
493
|
+
// // const { oldEventId } = params;
|
|
494
|
+
// const { project, typeOf, eventStatus, identifier, organizer, ...updateFields } = params.attributes;
|
|
495
|
+
// // const identifier = oldEventId;
|
|
496
|
+
// if (typeof identifier !== 'string' || identifier.length === 0) {
|
|
497
|
+
// throw new factory.errors.ArgumentNull('identifier');
|
|
498
|
+
// }
|
|
499
|
+
// const id = EventRepo.CREATE_ID();
|
|
500
|
+
// const doc = await this.eventModel.findOneAndUpdate(
|
|
501
|
+
// {
|
|
502
|
+
// 'project.id': { $eq: project.id },
|
|
503
|
+
// identifier: { $exists: true, $eq: identifier }
|
|
504
|
+
// },
|
|
505
|
+
// // upsertの場合、createがありうるので属性を除外しない
|
|
506
|
+
// {
|
|
507
|
+
// $setOnInsert: {
|
|
508
|
+
// _id: id,
|
|
509
|
+
// typeOf,
|
|
510
|
+
// project,
|
|
511
|
+
// eventStatus,
|
|
512
|
+
// organizer,
|
|
513
|
+
// identifier // イベントコードを必ず追加(2025-09-03~)
|
|
514
|
+
// // ...(typeof identifier === 'string' && identifier !== '') ? { identifier } : undefined
|
|
515
|
+
// },
|
|
516
|
+
// $set: updateFields
|
|
517
|
+
// },
|
|
518
|
+
// { upsert: true, new: true, projection: { _id: 1 } }
|
|
519
|
+
// )
|
|
520
|
+
// .lean<{ _id: string }>()
|
|
521
|
+
// .exec();
|
|
522
|
+
// if (doc === null) {
|
|
523
|
+
// throw new factory.errors.NotFound(this.eventModel.modelName);
|
|
524
|
+
// }
|
|
525
|
+
// return { id: doc._id }; // optimize(2024-07-31~)
|
|
526
|
+
// }
|
|
516
527
|
/**
|
|
517
528
|
* イベントを検索する(inclusion projection)
|
|
518
529
|
*/
|
|
@@ -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;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BulkWriteResult } from 'mongodb';
|
|
2
|
-
import type { Connection,
|
|
2
|
+
import type { Connection, FilterQuery } from 'mongoose';
|
|
3
3
|
import * as factory from '../factory';
|
|
4
4
|
type ISearchConditions = factory.eventSeries.ISearchConditions;
|
|
5
|
-
type IKeyOfProjection = Exclude<keyof factory.eventSeries.IEvent, 'id'>;
|
|
5
|
+
type IKeyOfProjection = Exclude<keyof factory.eventSeries.IEvent, 'id' | 'videoFormat'>;
|
|
6
6
|
type IUnset = {
|
|
7
7
|
[key in keyof factory.eventSeries.IEvent]?: 1;
|
|
8
8
|
};
|
|
@@ -14,39 +14,22 @@ export declare class EventSeriesRepo {
|
|
|
14
14
|
constructor(connection: Connection);
|
|
15
15
|
static CREATE_MONGO_CONDITIONS(conditions: ISearchConditions): FilterQuery<factory.eventSeries.IEvent>[];
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
createManyEventSeries(params: {
|
|
20
|
-
attributes: factory.eventSeries.IAttributes[];
|
|
21
|
-
expectsNoContent: boolean;
|
|
22
|
-
}): Promise<string[] | void>;
|
|
23
|
-
/**
|
|
24
|
-
* コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
|
|
25
|
-
*/
|
|
26
|
-
createIfNotExistByWorkPerformed(params: {
|
|
27
|
-
attributes: factory.eventSeries.IAttributes;
|
|
28
|
-
}[]): Promise<BulkWriteResult | void>;
|
|
29
|
-
/**
|
|
30
|
-
* コンテンツ+バージョンをキーにして冪等置換
|
|
17
|
+
* 施設+コンテンツ+バージョンをキーにして冪等置換
|
|
31
18
|
*/
|
|
32
19
|
upsertByVersion(params: {
|
|
33
20
|
$set: factory.eventSeries.IAttributes;
|
|
34
21
|
$unset?: IUnset;
|
|
35
|
-
}[]
|
|
36
|
-
bulkWriteResult4insert: BulkWriteResult;
|
|
37
|
-
modifiedEvents: {
|
|
38
|
-
id: string;
|
|
39
|
-
}[];
|
|
40
|
-
} | void>;
|
|
41
|
-
saveEventSeries(params: {
|
|
42
|
-
id?: string;
|
|
43
|
-
attributes: factory.eventSeries.IAttributes;
|
|
22
|
+
}[], options: {
|
|
44
23
|
/**
|
|
45
|
-
*
|
|
24
|
+
* falseの場合setOnInsertのみ
|
|
25
|
+
* trueの場合setOnInsert+setのみ
|
|
46
26
|
*/
|
|
47
|
-
|
|
27
|
+
upsert: boolean;
|
|
48
28
|
}): Promise<{
|
|
49
|
-
|
|
29
|
+
bulkWriteResult?: BulkWriteResult;
|
|
30
|
+
modifiedEvents: {
|
|
31
|
+
id: string;
|
|
32
|
+
}[];
|
|
50
33
|
}>;
|
|
51
34
|
/**
|
|
52
35
|
* sskts施設コンテンツ保管
|
|
@@ -103,18 +86,22 @@ export declare class EventSeriesRepo {
|
|
|
103
86
|
}): Promise<{
|
|
104
87
|
maxVersion: string;
|
|
105
88
|
}>;
|
|
106
|
-
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<Document<unknown, {}, factory.eventSeries.IAttributes & {
|
|
89
|
+
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, factory.eventSeries.IAttributes & {
|
|
107
90
|
_id: string;
|
|
108
91
|
}> & factory.eventSeries.IAttributes & {
|
|
109
92
|
_id: string;
|
|
110
93
|
} & Required<{
|
|
111
94
|
_id: string;
|
|
112
|
-
}>, import("mongoose").QueryOptions<Document<unknown, {}, factory.eventSeries.IAttributes & {
|
|
95
|
+
}>, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, factory.eventSeries.IAttributes & {
|
|
113
96
|
_id: string;
|
|
114
97
|
}> & factory.eventSeries.IAttributes & {
|
|
115
98
|
_id: string;
|
|
116
99
|
} & Required<{
|
|
117
100
|
_id: string;
|
|
118
101
|
}>>>;
|
|
102
|
+
unsetUnnecessaryFields(params: {
|
|
103
|
+
filter: FilterQuery<factory.eventSeries.IEvent>;
|
|
104
|
+
$unset: IUnset;
|
|
105
|
+
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
119
106
|
}
|
|
120
107
|
export {};
|