@chevre/domain 21.4.0-alpha.17 → 21.4.0-alpha.19
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/migrateReservationProvider.ts +15 -5
- package/lib/chevre/repo/order.js +26 -35
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/service/event/createEvent.d.ts +9 -0
- package/lib/chevre/service/event/createEvent.js +86 -0
- package/lib/chevre/service/event.d.ts +2 -0
- package/lib/chevre/service/event.js +3 -1
- package/lib/chevre/service/task/createEvent.d.ts +7 -0
- package/lib/chevre/service/task/createEvent.js +29 -0
- package/package.json +3 -3
- package/example/src/chevre/findByOrderNumberAndReservationId.ts +0 -20
|
@@ -9,7 +9,7 @@ import { chevre } from '../../../lib/index';
|
|
|
9
9
|
|
|
10
10
|
// tslint:disable-next-line:max-func-body-length
|
|
11
11
|
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex:
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
13
|
|
|
14
14
|
const reservationRepo = new chevre.repository.Reservation(mongoose.connection);
|
|
15
15
|
const placeRepo = new chevre.repository.Place(mongoose.connection);
|
|
@@ -20,12 +20,12 @@ async function main() {
|
|
|
20
20
|
$in: [
|
|
21
21
|
chevre.factory.reservationType.EventReservation
|
|
22
22
|
]
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
24
|
// bookingTime: {
|
|
25
25
|
// $gte: moment('2023-06-09T00:00:00Z')
|
|
26
26
|
// .toDate()
|
|
27
27
|
// }
|
|
28
|
-
|
|
28
|
+
'provider.id': { $exists: false }
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
_id: 1,
|
|
@@ -78,14 +78,24 @@ async function main() {
|
|
|
78
78
|
i
|
|
79
79
|
);
|
|
80
80
|
if (typeof sellerId !== 'string') {
|
|
81
|
+
console.error(
|
|
82
|
+
'movieTheater not found',
|
|
83
|
+
reservation.project.id, reservation.id, reservation.bookingTime, providerId, 'sellerId:', sellerId,
|
|
84
|
+
'movieTheaterId:', movieTheaterId,
|
|
85
|
+
'movieTheaterBranchCode:', movieTheaterBranchCode,
|
|
86
|
+
i
|
|
87
|
+
);
|
|
81
88
|
throw new Error('movieTheater not found');
|
|
89
|
+
|
|
90
|
+
// return;
|
|
82
91
|
}
|
|
83
92
|
if (typeof sellerId === 'string') {
|
|
84
93
|
const newProvider: chevre.factory.reservation.IProvider = {
|
|
85
94
|
id: sellerId,
|
|
86
95
|
typeOf: chevre.factory.organizationType.Corporation
|
|
87
96
|
};
|
|
88
|
-
console.log(
|
|
97
|
+
console.log(
|
|
98
|
+
'updating reservation...', reservation.project.id, reservation.id, reservation.bookingTime, providerId, i, updateCount);
|
|
89
99
|
await reservationRepo.updatePartiallyById({
|
|
90
100
|
id: reservation.id,
|
|
91
101
|
update: <any>{
|
|
@@ -93,7 +103,7 @@ async function main() {
|
|
|
93
103
|
}
|
|
94
104
|
});
|
|
95
105
|
updateCount += 1;
|
|
96
|
-
console.log('updated.', reservation.project.id, reservation.id, reservation.bookingTime, providerId, i);
|
|
106
|
+
console.log('updated.', reservation.project.id, reservation.id, reservation.bookingTime, providerId, i, updateCount);
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
109
|
});
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -24,7 +24,7 @@ class MongoRepository {
|
|
|
24
24
|
}
|
|
25
25
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
26
26
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
27
|
-
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;
|
|
27
|
+
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;
|
|
28
28
|
const andConditions = [];
|
|
29
29
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
30
30
|
if (typeof projectIdEq === 'string') {
|
|
@@ -70,31 +70,22 @@ class MongoRepository {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
/* istanbul ignore else */
|
|
88
|
-
if (Array.isArray(params.seller.ids)) {
|
|
89
|
-
andConditions.push({
|
|
90
|
-
'seller.id': {
|
|
91
|
-
$exists: true,
|
|
92
|
-
$in: params.seller.ids
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
73
|
+
const providerIdEq = (_h = (_g = params.provider) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
74
|
+
if (typeof providerIdEq === 'string') {
|
|
75
|
+
andConditions.push({ 'seller.id': { $exists: true, $eq: providerIdEq } });
|
|
76
|
+
}
|
|
77
|
+
const sellerIdEq = (_k = (_j = params.seller) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
78
|
+
if (typeof sellerIdEq === 'string') {
|
|
79
|
+
andConditions.push({ 'seller.id': { $exists: true, $eq: sellerIdEq } });
|
|
80
|
+
}
|
|
81
|
+
const sellerIds = (_l = params.seller) === null || _l === void 0 ? void 0 : _l.ids;
|
|
82
|
+
if (Array.isArray(sellerIds)) {
|
|
83
|
+
andConditions.push({ 'seller.id': { $exists: true, $in: sellerIds } });
|
|
84
|
+
}
|
|
85
|
+
if (typeof ((_m = params.seller) === null || _m === void 0 ? void 0 : _m.typeOf) === 'string') {
|
|
86
|
+
andConditions.push({ 'seller.typeOf': { $exists: true, $eq: params.seller.typeOf } });
|
|
96
87
|
}
|
|
97
|
-
const brokerIdEq = (
|
|
88
|
+
const brokerIdEq = (_p = (_o = params.broker) === null || _o === void 0 ? void 0 : _o.id) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
98
89
|
if (typeof brokerIdEq === 'string') {
|
|
99
90
|
andConditions.push({
|
|
100
91
|
'broker.id': {
|
|
@@ -311,7 +302,7 @@ class MongoRepository {
|
|
|
311
302
|
}
|
|
312
303
|
}
|
|
313
304
|
}
|
|
314
|
-
const nameEq = (
|
|
305
|
+
const nameEq = (_q = params.name) === null || _q === void 0 ? void 0 : _q.$eq;
|
|
315
306
|
if (typeof nameEq === 'string') {
|
|
316
307
|
andConditions.push({
|
|
317
308
|
name: {
|
|
@@ -320,7 +311,7 @@ class MongoRepository {
|
|
|
320
311
|
}
|
|
321
312
|
});
|
|
322
313
|
}
|
|
323
|
-
const nameRegex = (
|
|
314
|
+
const nameRegex = (_r = params.name) === null || _r === void 0 ? void 0 : _r.$regex;
|
|
324
315
|
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
325
316
|
andConditions.push({
|
|
326
317
|
name: {
|
|
@@ -353,7 +344,7 @@ class MongoRepository {
|
|
|
353
344
|
}
|
|
354
345
|
});
|
|
355
346
|
}
|
|
356
|
-
const itemOfferedIdentifierIn = (
|
|
347
|
+
const itemOfferedIdentifierIn = (_u = (_t = (_s = params.acceptedOffers) === null || _s === void 0 ? void 0 : _s.itemOffered) === null || _t === void 0 ? void 0 : _t.identifier) === null || _u === void 0 ? void 0 : _u.$in;
|
|
357
348
|
if (Array.isArray(itemOfferedIdentifierIn)) {
|
|
358
349
|
andConditions.push({
|
|
359
350
|
'acceptedOffers.itemOffered.identifier': {
|
|
@@ -362,7 +353,7 @@ class MongoRepository {
|
|
|
362
353
|
}
|
|
363
354
|
});
|
|
364
355
|
}
|
|
365
|
-
const itemOfferedTypeOfIn = (
|
|
356
|
+
const itemOfferedTypeOfIn = (_x = (_w = (_v = params.acceptedOffers) === null || _v === void 0 ? void 0 : _v.itemOffered) === null || _w === void 0 ? void 0 : _w.typeOf) === null || _x === void 0 ? void 0 : _x.$in;
|
|
366
357
|
if (Array.isArray(itemOfferedTypeOfIn)) {
|
|
367
358
|
andConditions.push({
|
|
368
359
|
'acceptedOffers.itemOffered.typeOf': {
|
|
@@ -371,7 +362,7 @@ class MongoRepository {
|
|
|
371
362
|
}
|
|
372
363
|
});
|
|
373
364
|
}
|
|
374
|
-
const itemOfferedIssuedThroughTypeOfEq = (
|
|
365
|
+
const itemOfferedIssuedThroughTypeOfEq = (_1 = (_0 = (_z = (_y = params.acceptedOffers) === null || _y === void 0 ? void 0 : _y.itemOffered) === null || _z === void 0 ? void 0 : _z.issuedThrough) === null || _0 === void 0 ? void 0 : _0.typeOf) === null || _1 === void 0 ? void 0 : _1.$eq;
|
|
375
366
|
if (typeof itemOfferedIssuedThroughTypeOfEq === 'string') {
|
|
376
367
|
andConditions.push({
|
|
377
368
|
'acceptedOffers.itemOffered.issuedThrough.typeOf': {
|
|
@@ -380,7 +371,7 @@ class MongoRepository {
|
|
|
380
371
|
}
|
|
381
372
|
});
|
|
382
373
|
}
|
|
383
|
-
const itemOfferedIssuedThroughIdIn = (
|
|
374
|
+
const itemOfferedIssuedThroughIdIn = (_5 = (_4 = (_3 = (_2 = params.acceptedOffers) === null || _2 === void 0 ? void 0 : _2.itemOffered) === null || _3 === void 0 ? void 0 : _3.issuedThrough) === null || _4 === void 0 ? void 0 : _4.id) === null || _5 === void 0 ? void 0 : _5.$in;
|
|
384
375
|
if (Array.isArray(itemOfferedIssuedThroughIdIn)) {
|
|
385
376
|
andConditions.push({
|
|
386
377
|
'acceptedOffers.itemOffered.issuedThrough.id': {
|
|
@@ -389,7 +380,7 @@ class MongoRepository {
|
|
|
389
380
|
}
|
|
390
381
|
});
|
|
391
382
|
}
|
|
392
|
-
const itemOfferedProgramMembershipUsedIdentifierEq = (
|
|
383
|
+
const itemOfferedProgramMembershipUsedIdentifierEq = (_9 = (_8 = (_7 = (_6 = params.acceptedOffers) === null || _6 === void 0 ? void 0 : _6.itemOffered) === null || _7 === void 0 ? void 0 : _7.programMembershipUsed) === null || _8 === void 0 ? void 0 : _8.identifier) === null || _9 === void 0 ? void 0 : _9.$eq;
|
|
393
384
|
if (typeof itemOfferedProgramMembershipUsedIdentifierEq === 'string') {
|
|
394
385
|
andConditions.push({
|
|
395
386
|
'acceptedOffers.itemOffered.programMembershipUsed.identifier': {
|
|
@@ -398,7 +389,7 @@ class MongoRepository {
|
|
|
398
389
|
}
|
|
399
390
|
});
|
|
400
391
|
}
|
|
401
|
-
const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq = (
|
|
392
|
+
const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq = (_15 = (_14 = (_13 = (_12 = (_11 = (_10 = params.acceptedOffers) === null || _10 === void 0 ? void 0 : _10.itemOffered) === null || _11 === void 0 ? void 0 : _11.programMembershipUsed) === null || _12 === void 0 ? void 0 : _12.issuedThrough) === null || _13 === void 0 ? void 0 : _13.serviceType) === null || _14 === void 0 ? void 0 : _14.codeValue) === null || _15 === void 0 ? void 0 : _15.$eq;
|
|
402
393
|
if (typeof itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq === 'string') {
|
|
403
394
|
andConditions.push({
|
|
404
395
|
'acceptedOffers.itemOffered.programMembershipUsed.issuedThrough.serviceType.codeValue': {
|
|
@@ -594,7 +585,7 @@ class MongoRepository {
|
|
|
594
585
|
});
|
|
595
586
|
}
|
|
596
587
|
}
|
|
597
|
-
const paymentMethodAdditionalPropertyAll = (
|
|
588
|
+
const paymentMethodAdditionalPropertyAll = (_17 = (_16 = params.paymentMethods) === null || _16 === void 0 ? void 0 : _16.additionalProperty) === null || _17 === void 0 ? void 0 : _17.$all;
|
|
598
589
|
if (Array.isArray(paymentMethodAdditionalPropertyAll)) {
|
|
599
590
|
andConditions.push({
|
|
600
591
|
'paymentMethods.additionalProperty': {
|
|
@@ -603,7 +594,7 @@ class MongoRepository {
|
|
|
603
594
|
}
|
|
604
595
|
});
|
|
605
596
|
}
|
|
606
|
-
const paymentMethodAdditionalPropertyIn = (
|
|
597
|
+
const paymentMethodAdditionalPropertyIn = (_19 = (_18 = params.paymentMethods) === null || _18 === void 0 ? void 0 : _18.additionalProperty) === null || _19 === void 0 ? void 0 : _19.$in;
|
|
607
598
|
if (Array.isArray(paymentMethodAdditionalPropertyIn)) {
|
|
608
599
|
andConditions.push({
|
|
609
600
|
'paymentMethods.additionalProperty': {
|
|
@@ -63,7 +63,7 @@ export declare class MongoRepository {
|
|
|
63
63
|
*/
|
|
64
64
|
$nin?: factory.taskName[];
|
|
65
65
|
};
|
|
66
|
-
}): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/orderProgramMembership").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
|
|
66
|
+
}): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/orderProgramMembership").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
|
|
67
67
|
retry(params: {
|
|
68
68
|
intervalInMinutes: number;
|
|
69
69
|
}): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as factory from '../../factory';
|
|
2
|
+
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
3
|
+
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
4
|
+
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
5
|
+
export declare function createEvent(params: factory.task.createEvent.IData): (repos: {
|
|
6
|
+
action: ActionRepo;
|
|
7
|
+
event: EventRepo;
|
|
8
|
+
task: TaskRepo;
|
|
9
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createEvent = void 0;
|
|
13
|
+
const factory = require("../../factory");
|
|
14
|
+
// tslint:disable-next-line:max-func-body-length
|
|
15
|
+
function createEvent(params) {
|
|
16
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a;
|
|
18
|
+
const actionAttributes = params;
|
|
19
|
+
const action = yield repos.action.start(actionAttributes);
|
|
20
|
+
let eventIds = [];
|
|
21
|
+
let eventType;
|
|
22
|
+
try {
|
|
23
|
+
if (((_a = actionAttributes.instrument) === null || _a === void 0 ? void 0 : _a.createScreeningEventSeriesIfNotExistByWorkPerformed) === true) {
|
|
24
|
+
const bulkWriteResult = yield repos.event.createScreeningEventSeriesIfNotExistByWorkPerformed(actionAttributes.object.map((p) => {
|
|
25
|
+
if (p.typeOf !== factory.eventType.ScreeningEventSeries) {
|
|
26
|
+
throw new factory.errors.Argument('typeOf', `must be ${factory.eventType.ScreeningEventSeries}`);
|
|
27
|
+
}
|
|
28
|
+
return { attributes: p };
|
|
29
|
+
}));
|
|
30
|
+
let upsertedIds;
|
|
31
|
+
if (bulkWriteResult !== undefined) {
|
|
32
|
+
upsertedIds = bulkWriteResult.getUpsertedIds()
|
|
33
|
+
.map((doc) => doc._id.toString());
|
|
34
|
+
}
|
|
35
|
+
eventIds = (Array.isArray(upsertedIds)) ? upsertedIds : [];
|
|
36
|
+
eventType = factory.eventType.ScreeningEventSeries;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// no op
|
|
40
|
+
throw new factory.errors.NotImplemented('only createScreeningEventSeriesIfNotExistByWorkPerformed implemented');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
// actionにエラー結果を追加
|
|
45
|
+
try {
|
|
46
|
+
const actionError = Object.assign(Object.assign({}, error), { message: error.message, name: error.name });
|
|
47
|
+
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error: actionError });
|
|
48
|
+
}
|
|
49
|
+
catch (__) {
|
|
50
|
+
// 失敗したら仕方ない
|
|
51
|
+
}
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
// アクション完了
|
|
55
|
+
yield repos.action.complete({
|
|
56
|
+
typeOf: action.typeOf,
|
|
57
|
+
id: action.id,
|
|
58
|
+
result: (Array.isArray(eventIds))
|
|
59
|
+
? eventIds.map((eventId) => {
|
|
60
|
+
return { id: eventId };
|
|
61
|
+
})
|
|
62
|
+
: undefined
|
|
63
|
+
});
|
|
64
|
+
if (Array.isArray(eventIds) && eventIds.length > 0) {
|
|
65
|
+
// 非同期に変更(2023-06-08~)
|
|
66
|
+
const onEventChangedTask = {
|
|
67
|
+
project: actionAttributes.project,
|
|
68
|
+
name: factory.taskName.OnEventChanged,
|
|
69
|
+
status: factory.taskStatus.Ready,
|
|
70
|
+
runsAt: new Date(),
|
|
71
|
+
remainingNumberOfTries: 3,
|
|
72
|
+
numberOfTried: 0,
|
|
73
|
+
executionResults: [],
|
|
74
|
+
data: {
|
|
75
|
+
id: eventIds,
|
|
76
|
+
project: { id: actionAttributes.project.id },
|
|
77
|
+
typeOf: eventType,
|
|
78
|
+
isNew: true,
|
|
79
|
+
useInform: true
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
yield repos.task.saveMany([onEventChangedTask], { emitImmediately: true });
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
exports.createEvent = createEvent;
|
|
@@ -6,6 +6,7 @@ import { MongoRepository as ProjectRepo } from '../repo/project';
|
|
|
6
6
|
import { MongoRepository as SellerRepo } from '../repo/seller';
|
|
7
7
|
import { MongoRepository as TaskRepo } from '../repo/task';
|
|
8
8
|
import * as factory from '../factory';
|
|
9
|
+
import { createEvent } from './event/createEvent';
|
|
9
10
|
/**
|
|
10
11
|
* Googleで作品画像を検索する
|
|
11
12
|
*/
|
|
@@ -71,3 +72,4 @@ export declare function updateEvent4ttts(params: {
|
|
|
71
72
|
project: ProjectRepo;
|
|
72
73
|
task: TaskRepo;
|
|
73
74
|
}) => Promise<void>;
|
|
75
|
+
export { createEvent };
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.updateEvent4ttts = exports.createScreeningEventIdFromCOA = exports.importFromCOA = void 0;
|
|
12
|
+
exports.createEvent = exports.updateEvent4ttts = exports.createScreeningEventIdFromCOA = exports.importFromCOA = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* マスターデータ同期サービス
|
|
15
15
|
*/
|
|
@@ -21,6 +21,8 @@ const difference = require("lodash.difference");
|
|
|
21
21
|
const moment = require("moment-timezone");
|
|
22
22
|
const credentials_1 = require("../credentials");
|
|
23
23
|
const factory = require("../factory");
|
|
24
|
+
const createEvent_1 = require("./event/createEvent");
|
|
25
|
+
Object.defineProperty(exports, "createEvent", { enumerable: true, get: function () { return createEvent_1.createEvent; } });
|
|
24
26
|
const offer_1 = require("./offer");
|
|
25
27
|
const debug = createDebug('chevre-domain:service:event');
|
|
26
28
|
const coaAuthClient = new COA.auth.RefreshToken({
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as factory from '../../factory';
|
|
2
|
+
import { IConnectionSettings } from '../task';
|
|
3
|
+
export type IOperation<T> = (settings: IConnectionSettings) => Promise<T>;
|
|
4
|
+
/**
|
|
5
|
+
* タスク実行関数
|
|
6
|
+
*/
|
|
7
|
+
export declare function call(data: factory.task.createEvent.IData): IOperation<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.call = void 0;
|
|
13
|
+
const action_1 = require("../../repo/action");
|
|
14
|
+
const event_1 = require("../../repo/event");
|
|
15
|
+
const task_1 = require("../../repo/task");
|
|
16
|
+
const EventService = require("../event");
|
|
17
|
+
/**
|
|
18
|
+
* タスク実行関数
|
|
19
|
+
*/
|
|
20
|
+
function call(data) {
|
|
21
|
+
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
yield EventService.createEvent(data)({
|
|
23
|
+
action: new action_1.MongoRepository(settings.connection),
|
|
24
|
+
event: new event_1.MongoRepository(settings.connection),
|
|
25
|
+
task: new task_1.MongoRepository(settings.connection)
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.call = call;
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.316.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.316.0-alpha.2",
|
|
13
|
+
"@cinerino/sdk": "3.161.0-alpha.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.4.0-alpha.
|
|
120
|
+
"version": "21.4.0-alpha.19"
|
|
121
121
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
8
|
-
|
|
9
|
-
const orderRepo = new chevre.repository.Order(mongoose.connection);
|
|
10
|
-
|
|
11
|
-
const order = await orderRepo.findByOrderNumberAndReservationId({
|
|
12
|
-
orderNumber: 'CIN9-4783801-1618274',
|
|
13
|
-
reservationId: '139787058570943-0'
|
|
14
|
-
});
|
|
15
|
-
console.log('order found', order);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
main()
|
|
19
|
-
.then()
|
|
20
|
-
.catch(console.error);
|