@chevre/domain 21.0.0-alpha.9 → 21.1.0-alpha.0
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/aggregation/aggregateSystem.ts +2 -2
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/repo/accountingReport.d.ts +1 -1
- package/lib/chevre/repo/action/registerServiceInProgress.js +1 -1
- package/lib/chevre/repo/action.d.ts +2 -2
- package/lib/chevre/repo/code.d.ts +2 -2
- package/lib/chevre/repo/confirmationNumber.js +1 -1
- package/lib/chevre/repo/emailMessage.d.ts +1 -1
- package/lib/chevre/repo/event.d.ts +7 -1
- package/lib/chevre/repo/event.js +99 -26
- package/lib/chevre/repo/itemAvailability/screeningEvent.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/event.js +23 -0
- package/lib/chevre/repo/orderNumber.js +1 -1
- package/lib/chevre/repo/ownershipInfo.d.ts +1 -1
- package/lib/chevre/repo/paymentMethod/creditCard.d.ts +3 -3
- package/lib/chevre/repo/person.d.ts +2 -2
- package/lib/chevre/repo/place.d.ts +2 -2
- package/lib/chevre/repo/product.d.ts +1 -1
- package/lib/chevre/repo/rateLimit/offer.js +1 -1
- package/lib/chevre/repo/reservation.d.ts +1 -1
- package/lib/chevre/repo/seller.d.ts +1 -1
- package/lib/chevre/repo/serviceOutputIdentifier.js +1 -1
- package/lib/chevre/repo/transactionNumber.js +1 -1
- package/lib/chevre/repo/trip.d.ts +1 -1
- package/lib/chevre/service/account.d.ts +1 -1
- package/lib/chevre/service/accountTransaction/deposit.d.ts +1 -1
- package/lib/chevre/service/accountTransaction/transfer.d.ts +1 -1
- package/lib/chevre/service/accountTransaction/withdraw.d.ts +1 -1
- package/lib/chevre/service/accountTransaction.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +1 -1
- package/lib/chevre/service/aggregation/project.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation.d.ts +3 -3
- package/lib/chevre/service/assetTransaction/moneyTransfer.d.ts +4 -4
- package/lib/chevre/service/assetTransaction/pay/potentialActions.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay.d.ts +7 -7
- package/lib/chevre/service/assetTransaction/refund.d.ts +4 -4
- package/lib/chevre/service/assetTransaction/registerService/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/registerService.d.ts +4 -4
- package/lib/chevre/service/assetTransaction/reserve/factory/price.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/reserve.d.ts +6 -6
- package/lib/chevre/service/code.d.ts +2 -2
- package/lib/chevre/service/code.js +6 -1
- package/lib/chevre/service/delivery/factory.d.ts +1 -1
- package/lib/chevre/service/delivery/product/factory.d.ts +1 -1
- package/lib/chevre/service/delivery/reservation/factory.d.ts +1 -1
- package/lib/chevre/service/iam.d.ts +1 -1
- package/lib/chevre/service/moneyTransfer.d.ts +1 -1
- package/lib/chevre/service/notification.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/event/factory.d.ts +5 -5
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA.d.ts +2 -2
- package/lib/chevre/service/offer/factory.d.ts +2 -2
- package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +1 -1
- package/lib/chevre/service/offer/product.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +6 -1
- package/lib/chevre/service/order/onOrderStatusChanged.d.ts +2 -2
- package/lib/chevre/service/order/placeOrder.d.ts +1 -1
- package/lib/chevre/service/order/sendOrder.d.ts +1 -1
- package/lib/chevre/service/payment/any/factory.d.ts +1 -1
- package/lib/chevre/service/payment/any/onPaymentStatusChanged/onPaid.d.ts +1 -1
- package/lib/chevre/service/payment/any/onPaymentStatusChanged/onRefunded.d.ts +1 -1
- package/lib/chevre/service/payment/any.d.ts +3 -3
- package/lib/chevre/service/payment/creditCard.js +5 -0
- package/lib/chevre/service/payment/movieTicket.d.ts +4 -4
- package/lib/chevre/service/payment/paymentCard.d.ts +1 -1
- package/lib/chevre/service/permit.d.ts +1 -1
- package/lib/chevre/service/report/telemetry.d.ts +7 -7
- package/lib/chevre/service/reserve/cancelReservation.d.ts +1 -1
- package/lib/chevre/service/reserve/factory.d.ts +5 -5
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +2 -2
- package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +1 -1
- package/lib/chevre/service/task/aggregateUseActionsOnEvent.d.ts +1 -1
- package/lib/chevre/service/task/cancelMoneyTransfer.d.ts +1 -1
- package/lib/chevre/service/task/cancelPendingReservation.d.ts +1 -1
- package/lib/chevre/service/task/cancelReservation.d.ts +1 -1
- package/lib/chevre/service/task/importEventCapacitiesFromCOA.d.ts +1 -1
- package/lib/chevre/service/task/importEventsFromCOA.d.ts +1 -1
- package/lib/chevre/service/task/importOffersFromCOA.d.ts +1 -1
- package/lib/chevre/service/task/moneyTransfer.d.ts +1 -1
- package/lib/chevre/service/task/registerService.d.ts +1 -1
- package/lib/chevre/service/task/reserve.d.ts +1 -1
- package/lib/chevre/service/task.d.ts +2 -2
- package/lib/chevre/service/task.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.d.ts +6 -6
- package/lib/chevre/service/transaction/orderProgramMembership.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +8 -8
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +7 -7
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder.d.ts +2 -2
- package/lib/chevre/service/transaction/validation.d.ts +2 -2
- package/lib/chevre/service/transaction.d.ts +2 -2
- package/lib/chevre/settings.d.ts +1 -1
- package/lib/chevre/settings.js +7 -13
- package/package.json +12 -12
|
@@ -3,10 +3,10 @@ import * as mongoose from 'mongoose';
|
|
|
3
3
|
|
|
4
4
|
import { chevre } from '../../../../lib/index';
|
|
5
5
|
|
|
6
|
-
// const project = { id: <string>process.env.PROJECT_ID };
|
|
7
6
|
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
8
7
|
const AGGREGATE_DAYS = Number(process.env.AGGREGATE_DAYS);
|
|
9
|
-
const AGGREGATE_CLIENT_IDS = (typeof process.env.AGGREGATE_CLIENT_IDS === 'string') ? process.env.AGGREGATE_CLIENT_IDS.split('
|
|
8
|
+
const AGGREGATE_CLIENT_IDS = (typeof process.env.AGGREGATE_CLIENT_IDS === 'string') ? process.env.AGGREGATE_CLIENT_IDS.split(' ') : [];
|
|
9
|
+
console.log('AGGREGATE_CLIENT_IDS:', AGGREGATE_CLIENT_IDS);
|
|
10
10
|
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
|
-
export
|
|
2
|
+
export type IMinimizedIndividualEvent<T extends factory.eventType.ScreeningEvent | factory.eventType.Event> = T extends factory.eventType.ScreeningEvent ? Pick<factory.event.IEvent<T>, 'project' | 'id' | 'typeOf' | 'additionalProperty' | 'name' | 'doorTime' | 'endDate' | 'eventStatus' | 'location' | 'startDate' | 'superEvent' | 'offers' | 'coaInfo' | 'identifier'> : T extends factory.eventType.Event ? Pick<factory.event.IEvent<T>, 'project' | 'id' | 'typeOf' | 'additionalProperty' | 'name' | 'doorTime' | 'endDate' | 'eventStatus' | 'location' | 'startDate' | 'offers'> : never;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connection, Model } from 'mongoose';
|
|
2
2
|
import * as factory from '../factory';
|
|
3
|
-
export
|
|
3
|
+
export type IOrder4report = factory.order.IOrder & {
|
|
4
4
|
numItems: number;
|
|
5
5
|
};
|
|
6
6
|
export interface IAccountingReport {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Connection } from 'mongoose';
|
|
2
2
|
import * as factory from '../factory';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
|
|
4
|
+
export type IPayAction = factory.action.trade.pay.IAction;
|
|
5
5
|
export interface IUseActionCountByOffer {
|
|
6
6
|
_id: string[];
|
|
7
7
|
useActionCount?: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Connection } from 'mongoose';
|
|
2
2
|
import * as factory from '../factory';
|
|
3
3
|
import { modelName } from './mongoose/schemas/authorization';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type IObject = factory.authorization.IObject;
|
|
5
|
+
export type ICode = string;
|
|
6
6
|
export { modelName };
|
|
7
7
|
/**
|
|
8
8
|
* 承認コードリポジトリ
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import { Connection } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
|
-
export
|
|
27
|
+
export type IEmailMessage = factory.creativeWork.message.email.ICreativeWork;
|
|
28
28
|
export interface ISearchConditions {
|
|
29
29
|
limit?: number;
|
|
30
30
|
page?: number;
|
|
@@ -55,7 +55,7 @@ export interface IUpdateAggregateUseActionsParams {
|
|
|
55
55
|
noExistingAttributeName: 1;
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
export
|
|
58
|
+
export type ISearchConditions<T extends factory.eventType> = factory.event.ISearchConditions<T>;
|
|
59
59
|
interface IAggregationByStatus {
|
|
60
60
|
eventCount: number;
|
|
61
61
|
reservationCount: number;
|
|
@@ -105,6 +105,12 @@ export declare class MongoRepository {
|
|
|
105
105
|
name: string;
|
|
106
106
|
};
|
|
107
107
|
}[]): Promise<BulkWriteOpResultObject | void>;
|
|
108
|
+
/**
|
|
109
|
+
* コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
|
|
110
|
+
*/
|
|
111
|
+
createScreeningEventSeriesIfNotExistByWorkPerformed(params: {
|
|
112
|
+
attributes: factory.event.IAttributes<factory.eventType.ScreeningEventSeries>;
|
|
113
|
+
}[]): Promise<BulkWriteOpResultObject | void>;
|
|
108
114
|
/**
|
|
109
115
|
* イベント部分更新
|
|
110
116
|
*/
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -25,6 +25,7 @@ const uniqid = require("uniqid");
|
|
|
25
25
|
const factory = require("../factory");
|
|
26
26
|
const onIndexCreated_1 = require("./mongoose/onIndexCreated");
|
|
27
27
|
const event_1 = require("./mongoose/schemas/event");
|
|
28
|
+
const errorHandler_1 = require("../errorHandler");
|
|
28
29
|
exports.PROJECTION_MINIMIZED_EVENT = {
|
|
29
30
|
project: 1,
|
|
30
31
|
_id: 1,
|
|
@@ -53,7 +54,7 @@ class MongoRepository {
|
|
|
53
54
|
}
|
|
54
55
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
55
56
|
static CREATE_MONGO_CONDITIONS(conditions) {
|
|
56
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35;
|
|
57
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37;
|
|
57
58
|
const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
|
|
58
59
|
const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
59
60
|
if (typeof projectIdEq === 'string') {
|
|
@@ -400,13 +401,16 @@ class MongoRepository {
|
|
|
400
401
|
/* istanbul ignore else */
|
|
401
402
|
if (Array.isArray(workPerformedIdentifierIn)) {
|
|
402
403
|
andConditions.push({
|
|
403
|
-
'workPerformed.identifier': {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
'workPerformed.identifier': { $exists: true, $in: workPerformedIdentifierIn }
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
const workPerformedVersionEq = (_29 = (_28 = params.workPerformed) === null || _28 === void 0 ? void 0 : _28.version) === null || _29 === void 0 ? void 0 : _29.$eq;
|
|
408
|
+
if (typeof workPerformedVersionEq === 'string') {
|
|
409
|
+
andConditions.push({
|
|
410
|
+
'workPerformed.version': { $exists: true, $eq: workPerformedVersionEq }
|
|
407
411
|
});
|
|
408
412
|
}
|
|
409
|
-
const videoFormatTypeOfEq = (
|
|
413
|
+
const videoFormatTypeOfEq = (_31 = (_30 = params.videoFormat) === null || _30 === void 0 ? void 0 : _30.typeOf) === null || _31 === void 0 ? void 0 : _31.$eq;
|
|
410
414
|
if (typeof videoFormatTypeOfEq === 'string') {
|
|
411
415
|
andConditions.push({
|
|
412
416
|
'videoFormat.typeOf': {
|
|
@@ -415,7 +419,7 @@ class MongoRepository {
|
|
|
415
419
|
}
|
|
416
420
|
});
|
|
417
421
|
}
|
|
418
|
-
const videoFormatTypeOfIn = (
|
|
422
|
+
const videoFormatTypeOfIn = (_33 = (_32 = params.videoFormat) === null || _32 === void 0 ? void 0 : _32.typeOf) === null || _33 === void 0 ? void 0 : _33.$in;
|
|
419
423
|
if (Array.isArray(videoFormatTypeOfIn)) {
|
|
420
424
|
andConditions.push({
|
|
421
425
|
'videoFormat.typeOf': {
|
|
@@ -424,7 +428,7 @@ class MongoRepository {
|
|
|
424
428
|
}
|
|
425
429
|
});
|
|
426
430
|
}
|
|
427
|
-
const soundFormatTypeOfEq = (
|
|
431
|
+
const soundFormatTypeOfEq = (_35 = (_34 = params.soundFormat) === null || _34 === void 0 ? void 0 : _34.typeOf) === null || _35 === void 0 ? void 0 : _35.$eq;
|
|
428
432
|
if (typeof soundFormatTypeOfEq === 'string') {
|
|
429
433
|
andConditions.push({
|
|
430
434
|
'soundFormat.typeOf': {
|
|
@@ -433,7 +437,7 @@ class MongoRepository {
|
|
|
433
437
|
}
|
|
434
438
|
});
|
|
435
439
|
}
|
|
436
|
-
const soundFormatTypeOfIn = (
|
|
440
|
+
const soundFormatTypeOfIn = (_37 = (_36 = params.soundFormat) === null || _36 === void 0 ? void 0 : _36.typeOf) === null || _37 === void 0 ? void 0 : _37.$in;
|
|
437
441
|
if (Array.isArray(soundFormatTypeOfIn)) {
|
|
438
442
|
andConditions.push({
|
|
439
443
|
'soundFormat.typeOf': {
|
|
@@ -452,9 +456,20 @@ class MongoRepository {
|
|
|
452
456
|
*/
|
|
453
457
|
createMany(params) {
|
|
454
458
|
return __awaiter(this, void 0, void 0, function* () {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
459
|
+
let docs;
|
|
460
|
+
try {
|
|
461
|
+
docs = yield this.eventModel.insertMany(params.attributes.map((p) => {
|
|
462
|
+
return Object.assign({ _id: uniqid() }, p);
|
|
463
|
+
}));
|
|
464
|
+
}
|
|
465
|
+
catch (error) {
|
|
466
|
+
if ((0, errorHandler_1.isMongoError)(error)) {
|
|
467
|
+
if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
|
|
468
|
+
throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEventSeries, ['workPerformed.version']);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
throw error;
|
|
472
|
+
}
|
|
458
473
|
if (params.expectsNoContent) {
|
|
459
474
|
return;
|
|
460
475
|
}
|
|
@@ -482,6 +497,8 @@ class MongoRepository {
|
|
|
482
497
|
updateOne: {
|
|
483
498
|
filter: {
|
|
484
499
|
typeOf: creatingEventParams.attributes.typeOf,
|
|
500
|
+
// 追加特性をキーにした冪等イベント作成時のfilterにproject.idを追加(2023-04-06~)
|
|
501
|
+
'project.id': { $eq: creatingEventParams.attributes.project.id },
|
|
485
502
|
// 追加特性をキーに更新
|
|
486
503
|
additionalProperty: {
|
|
487
504
|
$exists: true,
|
|
@@ -503,6 +520,52 @@ class MongoRepository {
|
|
|
503
520
|
}
|
|
504
521
|
});
|
|
505
522
|
}
|
|
523
|
+
/**
|
|
524
|
+
* コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
|
|
525
|
+
*/
|
|
526
|
+
createScreeningEventSeriesIfNotExistByWorkPerformed(params) {
|
|
527
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
528
|
+
const bulkWriteOps = [];
|
|
529
|
+
if (Array.isArray(params)) {
|
|
530
|
+
params.forEach((creatingEventParams) => {
|
|
531
|
+
const version = creatingEventParams.attributes.workPerformed.version;
|
|
532
|
+
if (typeof version !== 'string') {
|
|
533
|
+
throw new factory.errors.ArgumentNull('workPerformed.version');
|
|
534
|
+
}
|
|
535
|
+
const setOnInsertFields = creatingEventParams.attributes;
|
|
536
|
+
bulkWriteOps.push({
|
|
537
|
+
updateOne: {
|
|
538
|
+
filter: {
|
|
539
|
+
typeOf: creatingEventParams.attributes.typeOf,
|
|
540
|
+
'project.id': { $eq: creatingEventParams.attributes.project.id },
|
|
541
|
+
'location.branchCode': {
|
|
542
|
+
$exists: true,
|
|
543
|
+
$eq: creatingEventParams.attributes.location.branchCode
|
|
544
|
+
},
|
|
545
|
+
'workPerformed.identifier': {
|
|
546
|
+
$exists: true,
|
|
547
|
+
$eq: creatingEventParams.attributes.workPerformed.identifier
|
|
548
|
+
},
|
|
549
|
+
'workPerformed.version': {
|
|
550
|
+
$exists: true,
|
|
551
|
+
$eq: version
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
update: {
|
|
555
|
+
$setOnInsert: Object.assign(Object.assign({}, setOnInsertFields), { _id: uniqid() })
|
|
556
|
+
// 変更可能な属性のみ上書き
|
|
557
|
+
// $set: {}
|
|
558
|
+
},
|
|
559
|
+
upsert: true
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
if (bulkWriteOps.length > 0) {
|
|
565
|
+
return this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
}
|
|
506
569
|
/**
|
|
507
570
|
* イベント部分更新
|
|
508
571
|
*/
|
|
@@ -529,21 +592,31 @@ class MongoRepository {
|
|
|
529
592
|
save(params) {
|
|
530
593
|
return __awaiter(this, void 0, void 0, function* () {
|
|
531
594
|
let doc;
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
595
|
+
try {
|
|
596
|
+
if (params.id === undefined) {
|
|
597
|
+
const id = uniqid();
|
|
598
|
+
doc = yield this.eventModel.create(Object.assign(Object.assign({}, params.attributes), { _id: id }));
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
const upsert = params.upsert === true;
|
|
602
|
+
// 上書き禁止属性を除外(2022-08-24~)
|
|
603
|
+
const _a = params.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
|
|
604
|
+
doc = yield this.eventModel.findOneAndUpdate({
|
|
605
|
+
_id: params.id,
|
|
606
|
+
typeOf: params.attributes.typeOf
|
|
607
|
+
}, Object.assign({ $setOnInsert: Object.assign(Object.assign({ typeOf: params.attributes.typeOf }, (params.attributes.project !== undefined)
|
|
608
|
+
? { project: params.attributes.project } : undefined), (params.attributes.identifier !== undefined)
|
|
609
|
+
? { identifier: params.attributes.identifier } : undefined), $set: updateFields }, (params.$unset !== undefined) ? { $unset: params.$unset } : undefined), { upsert, new: true })
|
|
610
|
+
.exec();
|
|
611
|
+
}
|
|
535
612
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}, Object.assign({ $setOnInsert: Object.assign(Object.assign({ typeOf: params.attributes.typeOf }, (params.attributes.project !== undefined)
|
|
544
|
-
? { project: params.attributes.project } : undefined), (params.attributes.identifier !== undefined)
|
|
545
|
-
? { identifier: params.attributes.identifier } : undefined), $set: updateFields }, (params.$unset !== undefined) ? { $unset: params.$unset } : undefined), { upsert, new: true })
|
|
546
|
-
.exec();
|
|
613
|
+
catch (error) {
|
|
614
|
+
if ((0, errorHandler_1.isMongoError)(error)) {
|
|
615
|
+
if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
|
|
616
|
+
throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEventSeries, ['workPerformed.version']);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
throw error;
|
|
547
620
|
}
|
|
548
621
|
if (doc === null) {
|
|
549
622
|
throw new factory.errors.NotFound(this.eventModel.modelName);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.schema = exports.modelName = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const writeConcern_1 = require("../writeConcern");
|
|
6
|
+
const factory = require("../../../factory");
|
|
6
7
|
const modelName = 'Event';
|
|
7
8
|
exports.modelName = modelName;
|
|
8
9
|
/**
|
|
@@ -121,6 +122,28 @@ schema.index({ 'workPerformed.identifier': 1, startDate: 1 }, {
|
|
|
121
122
|
'workPerformed.identifier': { $exists: true }
|
|
122
123
|
}
|
|
123
124
|
});
|
|
125
|
+
schema.index({ 'workPerformed.version': 1, startDate: 1 }, {
|
|
126
|
+
name: 'searchByWorkPerformedVersion',
|
|
127
|
+
partialFilterExpression: {
|
|
128
|
+
'workPerformed.version': { $exists: true }
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
// コンテンツ+バージョンに対するuniqueness
|
|
132
|
+
schema.index({
|
|
133
|
+
'project.id': 1,
|
|
134
|
+
'location.branchCode': 1,
|
|
135
|
+
'workPerformed.identifier': 1,
|
|
136
|
+
'workPerformed.version': 1
|
|
137
|
+
}, {
|
|
138
|
+
unique: true,
|
|
139
|
+
name: 'uniqueScreeningEventSeries',
|
|
140
|
+
partialFilterExpression: {
|
|
141
|
+
typeOf: factory.eventType.ScreeningEventSeries,
|
|
142
|
+
'location.branchCode': { $exists: true },
|
|
143
|
+
'workPerformed.identifier': { $exists: true },
|
|
144
|
+
'workPerformed.version': { $exists: true }
|
|
145
|
+
}
|
|
146
|
+
});
|
|
124
147
|
schema.index({ startDate: 1 }, { name: 'searchByStartDate' });
|
|
125
148
|
schema.index({ endDate: 1, startDate: 1 }, { name: 'searchByEndDate' });
|
|
126
149
|
schema.index({ 'hasOfferCatalog.id': 1, startDate: 1 }, {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import { Connection } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
|
-
export
|
|
27
|
+
export type IOwnershipInfo = factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>;
|
|
28
28
|
/**
|
|
29
29
|
* 所有権リポジトリ
|
|
30
30
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as GMO from '@motionpicture/gmo-service';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type IUncheckedCardRaw = factory.paymentMethod.paymentCard.creditCard.IUncheckedCardRaw;
|
|
4
|
+
export type IUncheckedCardTokenized = factory.paymentMethod.paymentCard.creditCard.IUncheckedCardTokenized;
|
|
5
|
+
export type ISearchCardResult = GMO.factory.card.ISearchCardResult;
|
|
6
6
|
export interface IOptions {
|
|
7
7
|
/**
|
|
8
8
|
* GMOサイトID
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as AWS from 'aws-sdk';
|
|
2
2
|
import * as factory from '../factory';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type AttributeListType = AWS.CognitoIdentityServiceProvider.AttributeListType;
|
|
4
|
+
export type IPerson = factory.person.IPerson;
|
|
5
5
|
/**
|
|
6
6
|
* 会員リポジトリ
|
|
7
7
|
*/
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import { Connection } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
|
-
|
|
28
|
-
export
|
|
27
|
+
type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
|
|
28
|
+
export type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace'>;
|
|
29
29
|
/**
|
|
30
30
|
* 施設リポジトリ
|
|
31
31
|
*/
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import { Connection } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
|
-
export
|
|
27
|
+
export type IProduct = factory.product.IProduct | factory.service.paymentService.IService;
|
|
28
28
|
/**
|
|
29
29
|
* プロダクトリポジトリ
|
|
30
30
|
*/
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import { Connection } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
|
-
export
|
|
27
|
+
export type ISeller = factory.seller.ISeller;
|
|
28
28
|
/**
|
|
29
29
|
* 販売者リポジトリ
|
|
30
30
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connection } from 'mongoose';
|
|
2
2
|
import * as factory from '../factory';
|
|
3
|
-
export
|
|
3
|
+
export type ISearchConditions<T extends factory.tripType> = factory.trip.ISearchConditions<T>;
|
|
4
4
|
export interface IAttributes4patchUpdate<T extends factory.tripType> {
|
|
5
5
|
typeOf: T;
|
|
6
6
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as factory from '../factory';
|
|
6
6
|
import { MongoRepository as AccountRepo } from '../repo/account';
|
|
7
7
|
import { MongoRepository as AccountTransactionRepo } from '../repo/accountTransaction';
|
|
8
|
-
export
|
|
8
|
+
export type IOpenOperation<T> = (repos: {
|
|
9
9
|
account: AccountRepo;
|
|
10
10
|
}) => Promise<T>;
|
|
11
11
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as factory from '../../factory';
|
|
5
5
|
import { MongoRepository as AccountRepo } from '../../repo/account';
|
|
6
6
|
import { MongoRepository as AccountTransactionRepo } from '../../repo/accountTransaction';
|
|
7
|
-
export
|
|
7
|
+
export type IStartOperation<T> = (repos: {
|
|
8
8
|
account: AccountRepo;
|
|
9
9
|
accountTransaction: AccountTransactionRepo;
|
|
10
10
|
}) => Promise<T>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as factory from '../../factory';
|
|
5
5
|
import { MongoRepository as AccountRepo } from '../../repo/account';
|
|
6
6
|
import { MongoRepository as AccountTransactionRepo } from '../../repo/accountTransaction';
|
|
7
|
-
export
|
|
7
|
+
export type IStartOperation<T> = (repos: {
|
|
8
8
|
account: AccountRepo;
|
|
9
9
|
accountTransaction: AccountTransactionRepo;
|
|
10
10
|
}) => Promise<T>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as factory from '../../factory';
|
|
5
5
|
import { MongoRepository as AccountRepo } from '../../repo/account';
|
|
6
6
|
import { MongoRepository as AccountTransactionRepo } from '../../repo/accountTransaction';
|
|
7
|
-
export
|
|
7
|
+
export type IStartOperation<T> = (repos: {
|
|
8
8
|
account: AccountRepo;
|
|
9
9
|
accountTransaction: AccountTransactionRepo;
|
|
10
10
|
}) => Promise<T>;
|
|
@@ -6,7 +6,7 @@ import * as factory from '../factory';
|
|
|
6
6
|
import * as DepositTransactionService from './accountTransaction/deposit';
|
|
7
7
|
import * as TransferTransactionService from './accountTransaction/transfer';
|
|
8
8
|
import * as WithdrawTransactionService from './accountTransaction/withdraw';
|
|
9
|
-
|
|
9
|
+
type IConfirmOperation<T> = (repos: {
|
|
10
10
|
accountTransaction: AccountTransactionRepo;
|
|
11
11
|
}) => Promise<T>;
|
|
12
12
|
/**
|
|
@@ -9,7 +9,7 @@ import { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLimit/o
|
|
|
9
9
|
import { MongoRepository as ReservationRepo } from '../../../repo/reservation';
|
|
10
10
|
import { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
11
11
|
import * as factory from '../../../factory';
|
|
12
|
-
export
|
|
12
|
+
export type IAggregateScreeningEventOperation<T> = (repos: {
|
|
13
13
|
event: EventRepo;
|
|
14
14
|
eventAvailability: EventAvailabilityRepo;
|
|
15
15
|
offer: OfferRepo;
|
|
@@ -3,7 +3,7 @@ import { MongoRepository as EventRepo } from '../../../repo/event';
|
|
|
3
3
|
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
4
4
|
import { MongoRepository as PlaceRepo } from '../../../repo/place';
|
|
5
5
|
import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
6
|
-
export
|
|
6
|
+
export type IAggregateOperation<T> = (repos: {
|
|
7
7
|
action: ActionRepo;
|
|
8
8
|
event: EventRepo;
|
|
9
9
|
offer: OfferRepo;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
2
2
|
import { MongoRepository as ReservationRepo } from '../../repo/reservation';
|
|
3
3
|
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
4
|
-
export
|
|
4
|
+
export type IAggregateOperation<T> = (repos: {
|
|
5
5
|
project: ProjectRepo;
|
|
6
6
|
reservation: ReservationRepo;
|
|
7
7
|
task: TaskRepo;
|
|
@@ -3,16 +3,16 @@ import { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransac
|
|
|
3
3
|
import { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
4
4
|
import { MongoRepository as ReservationRepo } from '../../repo/reservation';
|
|
5
5
|
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
6
|
-
export
|
|
6
|
+
export type IStartOperation<T> = (repos: {
|
|
7
7
|
project: ProjectRepo;
|
|
8
8
|
reservation: ReservationRepo;
|
|
9
9
|
assetTransaction: AssetTransactionRepo;
|
|
10
10
|
}) => Promise<T>;
|
|
11
|
-
export
|
|
11
|
+
export type ITaskAndTransactionOperation<T> = (repos: {
|
|
12
12
|
task: TaskRepo;
|
|
13
13
|
assetTransaction: AssetTransactionRepo;
|
|
14
14
|
}) => Promise<T>;
|
|
15
|
-
export
|
|
15
|
+
export type ITransactionOperation<T> = (repos: {
|
|
16
16
|
assetTransaction: AssetTransactionRepo;
|
|
17
17
|
}) => Promise<T>;
|
|
18
18
|
/**
|
|
@@ -3,19 +3,19 @@ import { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransac
|
|
|
3
3
|
import { MongoRepository as ProductRepo } from '../../repo/product';
|
|
4
4
|
import { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
5
5
|
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
6
|
-
export
|
|
6
|
+
export type IStartOperation<T> = (repos: {
|
|
7
7
|
product: ProductRepo;
|
|
8
8
|
project: ProjectRepo;
|
|
9
9
|
assetTransaction: AssetTransactionRepo;
|
|
10
10
|
}) => Promise<T>;
|
|
11
|
-
export
|
|
11
|
+
export type ITaskAndTransactionOperation<T> = (repos: {
|
|
12
12
|
task: TaskRepo;
|
|
13
13
|
assetTransaction: AssetTransactionRepo;
|
|
14
14
|
}) => Promise<T>;
|
|
15
|
-
export
|
|
15
|
+
export type IConfirmOperation<T> = (repos: {
|
|
16
16
|
assetTransaction: AssetTransactionRepo;
|
|
17
17
|
}) => Promise<T>;
|
|
18
|
-
export
|
|
18
|
+
export type ICancelOperation<T> = (repos: {
|
|
19
19
|
assetTransaction: AssetTransactionRepo;
|
|
20
20
|
}) => Promise<T>;
|
|
21
21
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
|
-
export
|
|
2
|
+
export type IUnitPriceSpecification = factory.unitPriceOffer.IUnitPriceOfferPriceSpecification;
|
|
3
3
|
/**
|
|
4
4
|
* 取引のポストアクションを作成する
|
|
5
5
|
*/
|