@chevre/domain 22.6.0-alpha.40 → 22.6.0-alpha.42
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/aggregateAllEvents2.ts +0 -9
- package/example/src/chevre/createEventBySchedule.ts +0 -9
- package/example/src/chevre/findSetting.ts +70 -1
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +14 -0
- package/lib/chevre/repo/mongoose/schemas/setting.js +4 -1
- package/lib/chevre/repo/setting.d.ts +31 -0
- package/lib/chevre/repo/setting.js +9 -0
- package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/reserve/cancel.js +4 -2
- package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/reserve/confirm.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/reserve/start.js +6 -4
- package/lib/chevre/service/event.d.ts +3 -2
- package/lib/chevre/service/event.js +7 -7
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +2 -0
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +2 -0
- package/lib/chevre/service/offer/onEventChanged.d.ts +3 -2
- package/lib/chevre/service/offer/onEventChanged.js +22 -10
- package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
- package/lib/chevre/service/reserve/cancelReservation.js +8 -4
- package/lib/chevre/service/reserve/checkInReservation.d.ts +3 -2
- package/lib/chevre/service/reserve/checkInReservation.js +10 -6
- package/lib/chevre/service/reserve/confirmReservation.d.ts +3 -2
- package/lib/chevre/service/reserve/confirmReservation.js +4 -2
- package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.d.ts +3 -2
- package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +8 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +8 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +3 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +9 -4
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +3 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +8 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +3 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +9 -4
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.d.ts +3 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +8 -2
- package/lib/chevre/service/reserve/useReservation.d.ts +3 -2
- package/lib/chevre/service/reserve/useReservation.js +9 -5
- package/lib/chevre/service/task/cancelPendingReservation.js +12 -14
- package/lib/chevre/service/task/cancelReservation.js +12 -14
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +2 -0
- package/lib/chevre/service/task/confirmReserveTransaction.js +2 -0
- package/lib/chevre/service/task/createEvent/createEvent.d.ts +3 -2
- package/lib/chevre/service/task/createEvent/createEvent.js +5 -2
- package/lib/chevre/service/task/createEvent/createEventBySchedule.d.ts +3 -2
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +11 -4
- package/lib/chevre/service/task/createEvent.js +6 -2
- package/lib/chevre/service/task/onAuthorizationCreated.js +13 -12
- package/lib/chevre/service/task/onEventChanged.js +6 -2
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.d.ts +3 -3
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +7 -3
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +3 -2
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +8 -3
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.d.ts +4 -3
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +7 -3
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +3 -2
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +5 -2
- package/lib/chevre/service/task/onResourceUpdated.js +62 -32
- package/lib/chevre/service/task/reserve.js +6 -2
- package/lib/chevre/service/task/useReservation.js +6 -2
- package/lib/chevre/service/task/voidReserveTransaction.js +2 -0
- package/lib/chevre/settings.d.ts +0 -21
- package/lib/chevre/settings.js +9 -5
- package/package.json +1 -1
|
@@ -44,15 +44,6 @@ export async function aggregateScreeningEvent() {
|
|
|
44
44
|
sendGrid: await chevre.credentials.SendGrid.createInstance({ apiKey: 'xxx' })
|
|
45
45
|
},
|
|
46
46
|
settings: new chevre.settings.Settings({
|
|
47
|
-
onEventChanged: {
|
|
48
|
-
informEvent: []
|
|
49
|
-
},
|
|
50
|
-
onResourceUpdated: {
|
|
51
|
-
informResource: []
|
|
52
|
-
},
|
|
53
|
-
onReservationStatusChanged: {
|
|
54
|
-
informReservation: []
|
|
55
|
-
},
|
|
56
47
|
notification: {
|
|
57
48
|
timeout: 1000,
|
|
58
49
|
useFetchAPI: true,
|
|
@@ -24,15 +24,6 @@ async function main() {
|
|
|
24
24
|
sendGrid: await chevre.credentials.SendGrid.createInstance({ apiKey: 'xxx' })
|
|
25
25
|
},
|
|
26
26
|
settings: new chevre.settings.Settings({
|
|
27
|
-
onEventChanged: {
|
|
28
|
-
informEvent: []
|
|
29
|
-
},
|
|
30
|
-
onResourceUpdated: {
|
|
31
|
-
informResource: []
|
|
32
|
-
},
|
|
33
|
-
onReservationStatusChanged: {
|
|
34
|
-
informReservation: []
|
|
35
|
-
},
|
|
36
27
|
notification: {
|
|
37
28
|
timeout: 1000,
|
|
38
29
|
useFetchAPI: true,
|
|
@@ -6,12 +6,22 @@ import { chevre } from '../../../lib/index';
|
|
|
6
6
|
const informOrderUrls = (typeof process.env.INFORM_ORDER_URL === 'string')
|
|
7
7
|
? process.env.INFORM_ORDER_URL.split(' ')
|
|
8
8
|
: [];
|
|
9
|
+
const informReservationUrls = (typeof process.env.INFORM_RESERVATION_URL === 'string')
|
|
10
|
+
? process.env.INFORM_RESERVATION_URL.split(' ')
|
|
11
|
+
: [];
|
|
12
|
+
const informResourceUrls = (typeof process.env.INFORM_RESOURCE_URL === 'string')
|
|
13
|
+
? process.env.INFORM_RESOURCE_URL.split(',')
|
|
14
|
+
: [];
|
|
15
|
+
const informEvent2aggUrls = (typeof process.env.INFORM_EVENT_AGG_URL === 'string')
|
|
16
|
+
? process.env.INFORM_EVENT_AGG_URL.split(' ')
|
|
17
|
+
: [];
|
|
18
|
+
// tslint:disable-next-line:max-func-body-length
|
|
9
19
|
async function main() {
|
|
10
20
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
21
|
|
|
12
22
|
const settingRepo = await chevre.repository.Setting.createInstance(mongoose.connection);
|
|
13
23
|
|
|
14
|
-
const result = await settingRepo.findOne({}, ['
|
|
24
|
+
const result = await settingRepo.findOne({}, ['onResourceUpdated', 'onEventChanged']);
|
|
15
25
|
// tslint:disable-next-line:no-null-keyword
|
|
16
26
|
console.dir(result, { depth: null });
|
|
17
27
|
|
|
@@ -35,6 +45,65 @@ async function main() {
|
|
|
35
45
|
});
|
|
36
46
|
console.log('saved');
|
|
37
47
|
}
|
|
48
|
+
} else {
|
|
49
|
+
const updateResult = await settingRepo.updateByProject(
|
|
50
|
+
{ project: { id: { $eq: '*' } } },
|
|
51
|
+
{
|
|
52
|
+
...(informReservationUrls.length > 0)
|
|
53
|
+
? {
|
|
54
|
+
onReservationStatusChanged: {
|
|
55
|
+
informReservation: informReservationUrls
|
|
56
|
+
.filter((url) => url.length > 0)
|
|
57
|
+
.map((url) => {
|
|
58
|
+
return {
|
|
59
|
+
recipient: {
|
|
60
|
+
typeOf: chevre.factory.creativeWorkType.WebApplication,
|
|
61
|
+
name: 'Aggregation Service',
|
|
62
|
+
url
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
: undefined,
|
|
69
|
+
...(informResourceUrls.length > 0)
|
|
70
|
+
? {
|
|
71
|
+
onResourceUpdated: {
|
|
72
|
+
informResource: informResourceUrls
|
|
73
|
+
.filter((url) => url.length > 0)
|
|
74
|
+
.map((url) => {
|
|
75
|
+
return {
|
|
76
|
+
recipient: {
|
|
77
|
+
typeOf: chevre.factory.creativeWorkType.WebApplication,
|
|
78
|
+
name: 'Global HUB',
|
|
79
|
+
url
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
: undefined,
|
|
86
|
+
...(informEvent2aggUrls.length > 0)
|
|
87
|
+
? {
|
|
88
|
+
|
|
89
|
+
onEventChanged: {
|
|
90
|
+
informEvent2agg: informEvent2aggUrls
|
|
91
|
+
.filter((url) => url.length > 0)
|
|
92
|
+
.map((url) => {
|
|
93
|
+
return {
|
|
94
|
+
recipient: {
|
|
95
|
+
typeOf: chevre.factory.creativeWorkType.WebApplication,
|
|
96
|
+
name: 'Aggregation Service',
|
|
97
|
+
url
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
: undefined
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
console.log('updated', updateResult);
|
|
38
107
|
}
|
|
39
108
|
}
|
|
40
109
|
|
|
@@ -6,8 +6,22 @@ interface IOnOrderStatusChanged {
|
|
|
6
6
|
*/
|
|
7
7
|
informOrder?: factory.project.IInformParams[];
|
|
8
8
|
}
|
|
9
|
+
interface IOnReservationStatusChanged {
|
|
10
|
+
/**
|
|
11
|
+
* AggService通知先
|
|
12
|
+
*/
|
|
13
|
+
informReservation?: factory.project.IInformParams[];
|
|
14
|
+
}
|
|
15
|
+
interface IOnEventChanged {
|
|
16
|
+
informEvent2agg?: factory.project.IInformParams[];
|
|
17
|
+
}
|
|
9
18
|
export interface ISetting {
|
|
19
|
+
onEventChanged?: IOnEventChanged;
|
|
10
20
|
onOrderStatusChanged: IOnOrderStatusChanged;
|
|
21
|
+
onReservationStatusChanged?: IOnReservationStatusChanged;
|
|
22
|
+
onResourceUpdated?: {
|
|
23
|
+
informResource?: factory.project.IInformParams[];
|
|
24
|
+
};
|
|
11
25
|
project: {
|
|
12
26
|
id: string;
|
|
13
27
|
typeOf: factory.organizationType.Project;
|
|
@@ -8,7 +8,10 @@ const modelName = 'Setting';
|
|
|
8
8
|
exports.modelName = modelName;
|
|
9
9
|
const schemaDefinition = {
|
|
10
10
|
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
11
|
-
|
|
11
|
+
onEventChanged: mongoose_1.SchemaTypes.Mixed,
|
|
12
|
+
onOrderStatusChanged: mongoose_1.SchemaTypes.Mixed,
|
|
13
|
+
onReservationStatusChanged: mongoose_1.SchemaTypes.Mixed,
|
|
14
|
+
onResourceUpdated: mongoose_1.SchemaTypes.Mixed
|
|
12
15
|
};
|
|
13
16
|
const schemaOptions = {
|
|
14
17
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
1
25
|
import type { Connection } from 'mongoose';
|
|
2
26
|
import { ISetting } from './mongoose/schemas/setting';
|
|
3
27
|
type IKeyOfProjection = keyof ISetting;
|
|
@@ -16,4 +40,11 @@ export declare class SettingRepo {
|
|
|
16
40
|
};
|
|
17
41
|
};
|
|
18
42
|
}, inclusion: IKeyOfProjection[]): Promise<ISetting | null>;
|
|
43
|
+
updateByProject(filter: {
|
|
44
|
+
project: {
|
|
45
|
+
id: {
|
|
46
|
+
$eq: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}, update: Pick<ISetting, 'onEventChanged' | 'onReservationStatusChanged' | 'onResourceUpdated'>): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
19
50
|
}
|
|
@@ -47,5 +47,14 @@ class SettingRepo {
|
|
|
47
47
|
.exec();
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
+
updateByProject(filter, update) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const { onEventChanged, onReservationStatusChanged, onResourceUpdated } = update;
|
|
53
|
+
return this.settingModel.updateOne({ 'project.id': { $eq: filter.project.id.$eq } }, {
|
|
54
|
+
$set: Object.assign(Object.assign(Object.assign({}, (onEventChanged !== undefined) ? { onEventChanged } : undefined), (onReservationStatusChanged !== undefined) ? { onReservationStatusChanged } : undefined), (onResourceUpdated !== undefined) ? { onResourceUpdated } : undefined)
|
|
55
|
+
})
|
|
56
|
+
.exec();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
50
59
|
}
|
|
51
60
|
exports.SettingRepo = SettingRepo;
|
|
@@ -3,6 +3,7 @@ import type { ActionRepo } from '../../../repo/action';
|
|
|
3
3
|
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
4
4
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
5
5
|
import type { ReservationRepo } from '../../../repo/reservation';
|
|
6
|
+
import type { SettingRepo } from '../../../repo/setting';
|
|
6
7
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
7
8
|
import type { TaskRepo } from '../../../repo/task';
|
|
8
9
|
type ICancelOperation<T> = (repos: {
|
|
@@ -10,6 +11,7 @@ type ICancelOperation<T> = (repos: {
|
|
|
10
11
|
stockHolder: StockHolderRepo;
|
|
11
12
|
offerRateLimit: OfferRateLimitRepo;
|
|
12
13
|
reservation: ReservationRepo;
|
|
14
|
+
setting: SettingRepo;
|
|
13
15
|
task: TaskRepo;
|
|
14
16
|
assetTransaction: AssetTransactionRepo;
|
|
15
17
|
}, settings: Settings) => Promise<T>;
|
|
@@ -16,7 +16,9 @@ const cancelReservation_1 = require("../../reserve/cancelReservation");
|
|
|
16
16
|
* 取引中止
|
|
17
17
|
*/
|
|
18
18
|
function cancel(params) {
|
|
19
|
-
return (repos
|
|
19
|
+
return (repos
|
|
20
|
+
// settings: Settings
|
|
21
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
20
22
|
// まず取引状態変更
|
|
21
23
|
const { id } = yield repos.assetTransaction.cancel({
|
|
22
24
|
typeOf: factory.assetTransactionType.Reserve,
|
|
@@ -35,7 +37,7 @@ function cancel(params) {
|
|
|
35
37
|
id,
|
|
36
38
|
typeOf: factory.assetTransactionType.Reserve
|
|
37
39
|
}
|
|
38
|
-
})(repos
|
|
40
|
+
})(repos);
|
|
39
41
|
});
|
|
40
42
|
}
|
|
41
43
|
exports.cancel = cancel;
|
|
@@ -4,12 +4,14 @@ import type { ActionRepo } from '../../../repo/action';
|
|
|
4
4
|
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
5
5
|
import type { OrderRepo } from '../../../repo/order';
|
|
6
6
|
import type { ReservationRepo } from '../../../repo/reservation';
|
|
7
|
+
import type { SettingRepo } from '../../../repo/setting';
|
|
7
8
|
import type { TaskRepo } from '../../../repo/task';
|
|
8
9
|
interface IConfirmRepo {
|
|
9
10
|
action: ActionRepo;
|
|
10
11
|
assetTransaction: AssetTransactionRepo;
|
|
11
12
|
order: OrderRepo;
|
|
12
13
|
reservation: ReservationRepo;
|
|
14
|
+
setting: SettingRepo;
|
|
13
15
|
task: TaskRepo;
|
|
14
16
|
}
|
|
15
17
|
type IConfirmOperation<T> = (repos: IConfirmRepo, settings: Settings) => Promise<T>;
|
|
@@ -13,6 +13,7 @@ import type { ProductRepo } from '../../../repo/product';
|
|
|
13
13
|
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
14
14
|
import type { ProjectRepo } from '../../../repo/project';
|
|
15
15
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
16
|
+
import type { SettingRepo } from '../../../repo/setting';
|
|
16
17
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
17
18
|
import type { TaskRepo } from '../../../repo/task';
|
|
18
19
|
interface IStartOperationRepos {
|
|
@@ -29,6 +30,7 @@ interface IStartOperationRepos {
|
|
|
29
30
|
priceSpecification: PriceSpecificationRepo;
|
|
30
31
|
project: ProjectRepo;
|
|
31
32
|
seat: SeatRepo;
|
|
33
|
+
setting: SettingRepo;
|
|
32
34
|
task: TaskRepo;
|
|
33
35
|
assetTransaction: AssetTransactionRepo;
|
|
34
36
|
}
|
|
@@ -28,7 +28,7 @@ const ONE_MONTH_IN_DAYS = 31;
|
|
|
28
28
|
* 取引開始
|
|
29
29
|
*/
|
|
30
30
|
function start(params, options) {
|
|
31
|
-
return (repos
|
|
31
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
32
32
|
var _a, _b;
|
|
33
33
|
const now = new Date();
|
|
34
34
|
const reservationNumber = params.transactionNumber;
|
|
@@ -70,7 +70,7 @@ function start(params, options) {
|
|
|
70
70
|
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd,
|
|
71
71
|
// acceptedOffers4transactionObject,
|
|
72
72
|
objectSubReservations
|
|
73
|
-
})(repos
|
|
73
|
+
})(repos);
|
|
74
74
|
return {
|
|
75
75
|
transaction: { id },
|
|
76
76
|
objectSubReservations,
|
|
@@ -154,7 +154,9 @@ function createObjectAttributes(params, options) {
|
|
|
154
154
|
* 予約追加
|
|
155
155
|
*/
|
|
156
156
|
function addReservations(params) {
|
|
157
|
-
return (repos
|
|
157
|
+
return (repos
|
|
158
|
+
// settings: Settings
|
|
159
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
158
160
|
const reservationNumber = params.transaction.transactionNumber;
|
|
159
161
|
const { event, reservationFor, objectSubReservations } = params;
|
|
160
162
|
let lockedOfferRateLimitKeys = [];
|
|
@@ -197,7 +199,7 @@ function addReservations(params) {
|
|
|
197
199
|
transaction: {
|
|
198
200
|
transactionNumber: reservationNumber
|
|
199
201
|
}
|
|
200
|
-
})(repos
|
|
202
|
+
})(repos);
|
|
201
203
|
});
|
|
202
204
|
}
|
|
203
205
|
/**
|
|
@@ -11,9 +11,9 @@ import type { MovieTheaterRepo } from '../repo/place/movieTheater';
|
|
|
11
11
|
import type { ScreeningRoomRepo } from '../repo/place/screeningRoom';
|
|
12
12
|
import type { ProjectRepo } from '../repo/project';
|
|
13
13
|
import type { SellerRepo } from '../repo/seller';
|
|
14
|
+
import type { SettingRepo } from '../repo/setting';
|
|
14
15
|
import type { TaskRepo } from '../repo/task';
|
|
15
16
|
import * as factory from '../factory';
|
|
16
|
-
import { Settings } from '../settings';
|
|
17
17
|
interface IImportFromCOAParams {
|
|
18
18
|
project: {
|
|
19
19
|
id: string;
|
|
@@ -84,6 +84,7 @@ export declare function updateEvent4ttts(params: {
|
|
|
84
84
|
event: EventRepo;
|
|
85
85
|
eventSeries: EventSeriesRepo;
|
|
86
86
|
project: ProjectRepo;
|
|
87
|
+
setting: SettingRepo;
|
|
87
88
|
task: TaskRepo;
|
|
88
|
-
}
|
|
89
|
+
}) => Promise<void>;
|
|
89
90
|
export {};
|
|
@@ -16,6 +16,7 @@ const difference = require("lodash.difference");
|
|
|
16
16
|
// import { google } from 'googleapis';
|
|
17
17
|
const moment = require("moment-timezone");
|
|
18
18
|
const factory = require("../factory");
|
|
19
|
+
// import { Settings } from '../settings';
|
|
19
20
|
const onEventChanged_1 = require("./offer/onEventChanged");
|
|
20
21
|
const debug = createDebug('chevre-domain:service:event');
|
|
21
22
|
/**
|
|
@@ -856,7 +857,9 @@ function createScreeningRoomFromCOA(project, seller, screenFromCOA) {
|
|
|
856
857
|
};
|
|
857
858
|
}
|
|
858
859
|
function updateEvent4ttts(params) {
|
|
859
|
-
return (repos
|
|
860
|
+
return (repos
|
|
861
|
+
// settings: Settings
|
|
862
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
860
863
|
const actionAttributes = Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, typeOf: factory.actionType.UpdateAction, agent: params.agent, object: {
|
|
861
864
|
id: params.oldEventId,
|
|
862
865
|
typeOf: factory.eventType.ScreeningEvent
|
|
@@ -893,12 +896,9 @@ function updateEvent4ttts(params) {
|
|
|
893
896
|
typeOf: factory.eventType.ScreeningEvent,
|
|
894
897
|
isNew: false,
|
|
895
898
|
useInform: true
|
|
896
|
-
})(
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
project: repos.project,
|
|
900
|
-
task: repos.task
|
|
901
|
-
}, settings);
|
|
899
|
+
})(repos
|
|
900
|
+
// settings
|
|
901
|
+
);
|
|
902
902
|
});
|
|
903
903
|
}
|
|
904
904
|
exports.updateEvent4ttts = updateEvent4ttts;
|
|
@@ -16,6 +16,7 @@ import type { ProductRepo } from '../../../../repo/product';
|
|
|
16
16
|
import type { ProductOfferRepo } from '../../../../repo/productOffer';
|
|
17
17
|
import type { ProjectRepo } from '../../../../repo/project';
|
|
18
18
|
import type { OfferRateLimitRepo } from '../../../../repo/rateLimit/offer';
|
|
19
|
+
import type { SettingRepo } from '../../../../repo/setting';
|
|
19
20
|
import type { StockHolderRepo } from '../../../../repo/stockHolder';
|
|
20
21
|
import type { TaskRepo } from '../../../../repo/task';
|
|
21
22
|
import type { TicketRepo } from '../../../../repo/ticket';
|
|
@@ -55,6 +56,7 @@ declare function processStartReserve4chevre(params: {
|
|
|
55
56
|
priceSpecification: PriceSpecificationRepo;
|
|
56
57
|
project: ProjectRepo;
|
|
57
58
|
seat: SeatRepo;
|
|
59
|
+
setting: SettingRepo;
|
|
58
60
|
task: TaskRepo;
|
|
59
61
|
ticket: TicketRepo;
|
|
60
62
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -18,6 +18,7 @@ import type { ProductRepo } from '../../../repo/product';
|
|
|
18
18
|
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
19
19
|
import type { ProjectRepo } from '../../../repo/project';
|
|
20
20
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
21
|
+
import type { SettingRepo } from '../../../repo/setting';
|
|
21
22
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
22
23
|
import type { TaskRepo } from '../../../repo/task';
|
|
23
24
|
import type { TicketRepo } from '../../../repo/ticket';
|
|
@@ -42,6 +43,7 @@ interface IAuthorizeRepos {
|
|
|
42
43
|
productOffer: ProductOfferRepo;
|
|
43
44
|
project: ProjectRepo;
|
|
44
45
|
seat: SeatRepo;
|
|
46
|
+
setting: SettingRepo;
|
|
45
47
|
task: TaskRepo;
|
|
46
48
|
ticket: TicketRepo;
|
|
47
49
|
transaction: TransactionRepo;
|
|
@@ -5,6 +5,7 @@ import type { AssetTransactionRepo } from '../../../../repo/assetTransaction';
|
|
|
5
5
|
import type { OrderInTransactionRepo } from '../../../../repo/orderInTransaction';
|
|
6
6
|
import type { OfferRateLimitRepo } from '../../../../repo/rateLimit/offer';
|
|
7
7
|
import type { ReservationRepo } from '../../../../repo/reservation';
|
|
8
|
+
import type { SettingRepo } from '../../../../repo/setting';
|
|
8
9
|
import type { StockHolderRepo } from '../../../../repo/stockHolder';
|
|
9
10
|
import type { TaskRepo } from '../../../../repo/task';
|
|
10
11
|
import type { TransactionRepo } from '../../../../repo/transaction';
|
|
@@ -16,6 +17,7 @@ interface IVoidTransactionRepos {
|
|
|
16
17
|
offerRateLimit: OfferRateLimitRepo;
|
|
17
18
|
orderInTransaction: OrderInTransactionRepo;
|
|
18
19
|
reservation: ReservationRepo;
|
|
20
|
+
setting: SettingRepo;
|
|
19
21
|
task: TaskRepo;
|
|
20
22
|
transaction: TransactionRepo;
|
|
21
23
|
}
|
|
@@ -6,6 +6,7 @@ import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
|
6
6
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
7
7
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
8
8
|
import type { ReservationRepo } from '../../../repo/reservation';
|
|
9
|
+
import type { SettingRepo } from '../../../repo/setting';
|
|
9
10
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
10
11
|
import type { TaskRepo } from '../../../repo/task';
|
|
11
12
|
import type { TransactionRepo } from '../../../repo/transaction';
|
|
@@ -16,6 +17,7 @@ interface IVoidTransactionRepos {
|
|
|
16
17
|
offerRateLimit: OfferRateLimitRepo;
|
|
17
18
|
orderInTransaction: OrderInTransactionRepo;
|
|
18
19
|
reservation: ReservationRepo;
|
|
20
|
+
setting: SettingRepo;
|
|
19
21
|
task: TaskRepo;
|
|
20
22
|
transaction: TransactionRepo;
|
|
21
23
|
/**
|
|
@@ -6,6 +6,7 @@ import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
|
6
6
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
7
7
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
8
8
|
import type { ReservationRepo } from '../../../repo/reservation';
|
|
9
|
+
import type { SettingRepo } from '../../../repo/setting';
|
|
9
10
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
10
11
|
import type { TaskRepo } from '../../../repo/task';
|
|
11
12
|
import type { TransactionRepo } from '../../../repo/transaction';
|
|
@@ -16,6 +17,7 @@ interface IVoidTransactionByActionIdRepos {
|
|
|
16
17
|
offerRateLimit: OfferRateLimitRepo;
|
|
17
18
|
orderInTransaction: OrderInTransactionRepo;
|
|
18
19
|
reservation: ReservationRepo;
|
|
20
|
+
setting: SettingRepo;
|
|
19
21
|
task: TaskRepo;
|
|
20
22
|
transaction: TransactionRepo;
|
|
21
23
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { EventRepo } from '../../repo/event';
|
|
2
2
|
import type { EventSeriesRepo } from '../../repo/eventSeries';
|
|
3
3
|
import type { ProjectRepo } from '../../repo/project';
|
|
4
|
+
import type { SettingRepo } from '../../repo/setting';
|
|
4
5
|
import type { TaskRepo } from '../../repo/task';
|
|
5
6
|
import * as factory from '../../factory';
|
|
6
|
-
import { Settings } from '../../settings';
|
|
7
7
|
/**
|
|
8
8
|
* イベント変更時処理
|
|
9
9
|
*/
|
|
@@ -11,6 +11,7 @@ declare function onEventChanged(params: factory.task.onEventChanged.IData): (rep
|
|
|
11
11
|
event: EventRepo;
|
|
12
12
|
eventSeries: EventSeriesRepo;
|
|
13
13
|
project: ProjectRepo;
|
|
14
|
+
setting: SettingRepo;
|
|
14
15
|
task: TaskRepo;
|
|
15
|
-
}
|
|
16
|
+
}) => Promise<void>;
|
|
16
17
|
export { onEventChanged };
|
|
@@ -11,12 +11,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.onEventChanged = void 0;
|
|
13
13
|
const factory = require("../../factory");
|
|
14
|
+
// import { Settings } from '../../settings';
|
|
14
15
|
/**
|
|
15
16
|
* イベント変更時処理
|
|
16
17
|
*/
|
|
17
18
|
function onEventChanged(params) {
|
|
18
|
-
return (repos
|
|
19
|
+
return (repos
|
|
20
|
+
// settings: Settings
|
|
21
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
19
22
|
if (params.id.length > 0) {
|
|
23
|
+
const setting = yield repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onResourceUpdated', 'onEventChanged']);
|
|
20
24
|
// ScreeningEventであれば集計タスク -> migrate to agg(2024-10-31~)
|
|
21
25
|
// inform to agg(2024-10-30~)
|
|
22
26
|
yield createInform2aggTasks({
|
|
@@ -24,14 +28,14 @@ function onEventChanged(params) {
|
|
|
24
28
|
ids: params.id,
|
|
25
29
|
typeOf: params.typeOf,
|
|
26
30
|
isNew: params.isNew
|
|
27
|
-
})(repos
|
|
28
|
-
// 通知タスク作成
|
|
31
|
+
}, setting)(repos);
|
|
32
|
+
// 通知タスク作成
|
|
29
33
|
if (params.useInform === true) {
|
|
30
34
|
yield createInformTasks({
|
|
31
35
|
project: { id: params.project.id },
|
|
32
36
|
ids: params.id,
|
|
33
37
|
typeOf: params.typeOf
|
|
34
|
-
})(repos
|
|
38
|
+
}, setting)(repos);
|
|
35
39
|
}
|
|
36
40
|
if (params.useSync === true) {
|
|
37
41
|
switch (params.typeOf) {
|
|
@@ -78,11 +82,15 @@ function syncEventSeries2screeningEvents(params) {
|
|
|
78
82
|
}
|
|
79
83
|
});
|
|
80
84
|
}
|
|
81
|
-
function createInformTasks(params) {
|
|
85
|
+
function createInformTasks(params, setting) {
|
|
82
86
|
// tslint:disable-next-line:max-func-body-length
|
|
83
|
-
return (repos
|
|
87
|
+
return (repos
|
|
88
|
+
// settings: Settings
|
|
89
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
var _a;
|
|
84
91
|
let events4inform;
|
|
85
|
-
const informEvents = settings.onEventChanged.informEvent;
|
|
92
|
+
// const informEvents = settings.onEventChanged.informEvent;
|
|
93
|
+
const informEvents = (_a = setting === null || setting === void 0 ? void 0 : setting.onResourceUpdated) === null || _a === void 0 ? void 0 : _a.informResource;
|
|
86
94
|
if (params.typeOf === factory.eventType.Event) {
|
|
87
95
|
const eventsFromDB = yield repos.event.projectEventFields({
|
|
88
96
|
id: { $in: params.ids },
|
|
@@ -198,10 +206,14 @@ function createInformTasks(params) {
|
|
|
198
206
|
}
|
|
199
207
|
});
|
|
200
208
|
}
|
|
201
|
-
function createInform2aggTasks(params) {
|
|
202
|
-
return (repos
|
|
209
|
+
function createInform2aggTasks(params, setting) {
|
|
210
|
+
return (repos
|
|
211
|
+
// settings: Settings
|
|
212
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
213
|
+
var _a;
|
|
203
214
|
let event4inform;
|
|
204
|
-
const informEvent2agg = settings.onEventChanged.informEvent2agg;
|
|
215
|
+
// const informEvent2agg = settings.onEventChanged.informEvent2agg;
|
|
216
|
+
const informEvent2agg = (_a = setting === null || setting === void 0 ? void 0 : setting.onEventChanged) === null || _a === void 0 ? void 0 : _a.informEvent2agg;
|
|
205
217
|
if (params.typeOf === factory.eventType.ScreeningEvent) {
|
|
206
218
|
event4inform = {
|
|
207
219
|
id: params.ids,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import { Settings } from '../../settings';
|
|
3
2
|
import type { ActionRepo } from '../../repo/action';
|
|
4
3
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
5
4
|
import { OfferRateLimitRepo } from '../../repo/rateLimit/offer';
|
|
6
5
|
import { ReservationRepo } from '../../repo/reservation';
|
|
6
|
+
import type { SettingRepo } from '../../repo/setting';
|
|
7
7
|
import { StockHolderRepo } from '../../repo/stockHolder';
|
|
8
8
|
import type { TaskRepo } from '../../repo/task';
|
|
9
9
|
/**
|
|
@@ -15,8 +15,9 @@ declare function cancelPendingReservation(actionAttributes: factory.task.cancelP
|
|
|
15
15
|
stockHolder: StockHolderRepo;
|
|
16
16
|
offerRateLimit: OfferRateLimitRepo;
|
|
17
17
|
reservation: ReservationRepo;
|
|
18
|
+
setting: SettingRepo;
|
|
18
19
|
task: TaskRepo;
|
|
19
|
-
}
|
|
20
|
+
}) => Promise<void>;
|
|
20
21
|
/**
|
|
21
22
|
* 予約をキャンセルする
|
|
22
23
|
*/
|
|
@@ -25,9 +26,10 @@ declare function cancelReservation(actionAttributesList: factory.action.cancel.r
|
|
|
25
26
|
stockHolder: StockHolderRepo;
|
|
26
27
|
offerRateLimit: OfferRateLimitRepo;
|
|
27
28
|
reservation: ReservationRepo;
|
|
29
|
+
setting: SettingRepo;
|
|
28
30
|
task: TaskRepo;
|
|
29
31
|
assetTransaction: AssetTransactionRepo;
|
|
30
|
-
}
|
|
32
|
+
}) => Promise<void>;
|
|
31
33
|
declare function processUnlockOfferRateLimit(params: {
|
|
32
34
|
reservation: {
|
|
33
35
|
reservationNumber: string;
|
|
@@ -22,7 +22,9 @@ const onReservationCanceled_1 = require("./potentialActions/onReservationCancele
|
|
|
22
22
|
* 保留予約取消
|
|
23
23
|
*/
|
|
24
24
|
function cancelPendingReservation(actionAttributes) {
|
|
25
|
-
return (repos
|
|
25
|
+
return (repos
|
|
26
|
+
// settings: Settings
|
|
27
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
26
28
|
var _a;
|
|
27
29
|
const { reserveTransaction } = yield cancelPengindIfNotYet(actionAttributes)(repos);
|
|
28
30
|
yield (0, onPendingReservationCanceled_1.onPendingReservationCanceled)(
|
|
@@ -34,7 +36,7 @@ function cancelPendingReservation(actionAttributes) {
|
|
|
34
36
|
id: String((_a = reserveTransaction.object.reservationFor) === null || _a === void 0 ? void 0 : _a.id)
|
|
35
37
|
},
|
|
36
38
|
reservationNumber: reserveTransaction.object.reservationNumber
|
|
37
|
-
})(
|
|
39
|
+
})(repos);
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
exports.cancelPendingReservation = cancelPendingReservation;
|
|
@@ -157,7 +159,9 @@ function cancelPengindIfNotYet(params) {
|
|
|
157
159
|
*/
|
|
158
160
|
function cancelReservation(actionAttributesList) {
|
|
159
161
|
// tslint:disable-next-line:max-func-body-length
|
|
160
|
-
return (repos
|
|
162
|
+
return (repos
|
|
163
|
+
// settings: Settings
|
|
164
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
161
165
|
const now = new Date();
|
|
162
166
|
if (actionAttributesList.length > 0) {
|
|
163
167
|
// tslint:disable-next-line:max-func-body-length
|
|
@@ -317,7 +321,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
317
321
|
{
|
|
318
322
|
project: { id: actionAttributes.project.id },
|
|
319
323
|
id: canceledReservationForId
|
|
320
|
-
})(
|
|
324
|
+
})(repos);
|
|
321
325
|
})));
|
|
322
326
|
}
|
|
323
327
|
});
|