@chevre/domain 22.13.0-alpha.4 → 22.13.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/event/migrateEventIdentifier4ttts.ts +96 -0
- package/example/src/chevre/event/upsertManyScreeningEventByIdentifier.ts +192 -0
- package/lib/chevre/repo/event.d.ts +18 -0
- package/lib/chevre/repo/event.js +67 -1
- package/lib/chevre/service/event.d.ts +3 -4
- package/lib/chevre/service/event.js +14 -6
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +2 -2
- package/package.json +1 -1
- package/example/src/chevre/cancelEvent.ts +0 -22
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// tslint:disable:no-console no-magic-numbers
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
// tslint:disable-next-line:max-func-body-length
|
|
9
|
+
async function main() {
|
|
10
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
+
|
|
12
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
13
|
+
|
|
14
|
+
const cursor = eventRepo.getCursor(
|
|
15
|
+
{
|
|
16
|
+
// _id: { $eq: 'blwz44d0k' },
|
|
17
|
+
'project.id': { $eq: project.id }
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
_id: 1,
|
|
21
|
+
startDate: 1,
|
|
22
|
+
project: 1,
|
|
23
|
+
identifier: 1,
|
|
24
|
+
additionalProperty: 1,
|
|
25
|
+
typeOf: 1
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
console.log('events found');
|
|
29
|
+
|
|
30
|
+
let i = 0;
|
|
31
|
+
let updateCount = 0;
|
|
32
|
+
await cursor.eachAsync(async (doc) => {
|
|
33
|
+
i += 1;
|
|
34
|
+
const event: Pick<
|
|
35
|
+
chevre.factory.event.screeningEvent.IEvent,
|
|
36
|
+
'id' | 'identifier' | 'startDate' | 'project' | 'additionalProperty' | 'typeOf'
|
|
37
|
+
> = doc.toObject();
|
|
38
|
+
|
|
39
|
+
console.log(
|
|
40
|
+
'alreadyMigrated?', event.project.id, event.id, event.startDate, i);
|
|
41
|
+
const isValidProject = event.project.id.substring(0, 5) === 'ttts-';
|
|
42
|
+
if (!isValidProject) {
|
|
43
|
+
throw new Error(`${event.project.id} ${event.id} invalid project.`);
|
|
44
|
+
}
|
|
45
|
+
const eventIdentifier = event.identifier;
|
|
46
|
+
const oldEventId = event.additionalProperty?.find(({ name }) => name === 'oldEventId')?.value;
|
|
47
|
+
const tourNumber = event.additionalProperty?.find(({ name }) => name === 'tourNumber')?.value;
|
|
48
|
+
if (typeof oldEventId !== 'string' || oldEventId === '') {
|
|
49
|
+
throw new Error(`${event.project.id} ${event.id} oldEventId required: ${oldEventId}`);
|
|
50
|
+
}
|
|
51
|
+
if (typeof tourNumber !== 'string' || tourNumber === '') {
|
|
52
|
+
throw new Error(`${event.project.id} ${event.id} tourNumber required: ${tourNumber}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const alreadyMigrated = typeof eventIdentifier === 'string' && eventIdentifier === oldEventId;
|
|
56
|
+
|
|
57
|
+
if (alreadyMigrated) {
|
|
58
|
+
console.log(
|
|
59
|
+
'already migrated.', event.project.id, event.id, event.startDate, i);
|
|
60
|
+
} else {
|
|
61
|
+
console.log(
|
|
62
|
+
'updating... oldEventId:',
|
|
63
|
+
oldEventId, event.project.id, event.id, event.startDate, i);
|
|
64
|
+
await eventRepo.updatePartiallyById({
|
|
65
|
+
project: { id: event.project.id },
|
|
66
|
+
id: event.id,
|
|
67
|
+
attributes: {
|
|
68
|
+
typeOf: event.typeOf,
|
|
69
|
+
...{
|
|
70
|
+
identifier: oldEventId
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
updateCount += 1;
|
|
75
|
+
console.log(
|
|
76
|
+
'updated.',
|
|
77
|
+
event.project.id, event.id, event.startDate, i);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
console.log(i, 'events checked');
|
|
82
|
+
console.log(updateCount, 'events updated');
|
|
83
|
+
|
|
84
|
+
// await eventRepo.projectEventFields<chevre.factory.eventType.ScreeningEvent>(
|
|
85
|
+
// {
|
|
86
|
+
// project: { id: { $eq: project.id } },
|
|
87
|
+
// typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
88
|
+
// // id
|
|
89
|
+
// },
|
|
90
|
+
// ['identifier']
|
|
91
|
+
// );
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
main()
|
|
95
|
+
.then()
|
|
96
|
+
.catch(console.error);
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
// tslint:disable:no-console no-magic-numbers
|
|
2
|
+
import * as moment from 'moment-timezone';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../../lib/index';
|
|
6
|
+
|
|
7
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
const ADDITIONAL_PROPERTY_NAME = 'sampleCreateId';
|
|
9
|
+
|
|
10
|
+
// tslint:disable-next-line:max-func-body-length
|
|
11
|
+
async function main() {
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
+
|
|
14
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const today = moment()
|
|
17
|
+
.tz('Asia/Tokyo')
|
|
18
|
+
.format('YYYY-MM-DD');
|
|
19
|
+
const identifier = `fromSamples:${moment()
|
|
20
|
+
.format('YYYY-MM-DD HH:mm')}`;
|
|
21
|
+
const settingEvent: chevre.factory.event.screeningEvent.IEvent = {
|
|
22
|
+
identifier,
|
|
23
|
+
additionalProperty: [
|
|
24
|
+
{ name: ADDITIONAL_PROPERTY_NAME, value: identifier }
|
|
25
|
+
],
|
|
26
|
+
id: 'bmcvkft5g',
|
|
27
|
+
project: {
|
|
28
|
+
id: project.id,
|
|
29
|
+
typeOf: chevre.factory.organizationType.Project
|
|
30
|
+
},
|
|
31
|
+
organizer: {
|
|
32
|
+
id: '59d20831e53ebc2b4e774466'
|
|
33
|
+
},
|
|
34
|
+
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
35
|
+
name: {
|
|
36
|
+
en: 'pet IMAX2D',
|
|
37
|
+
ja: 'ペット IMAX2D'
|
|
38
|
+
},
|
|
39
|
+
doorTime: moment(`${today}T13:00:00Z`)
|
|
40
|
+
.toDate(),
|
|
41
|
+
startDate: moment(`${today}T13:00:00Z`)
|
|
42
|
+
.toDate(),
|
|
43
|
+
endDate: moment(`${today}T14:00:00Z`)
|
|
44
|
+
.toDate(),
|
|
45
|
+
eventStatus: chevre.factory.eventStatusType.EventScheduled,
|
|
46
|
+
location: {
|
|
47
|
+
typeOf: chevre.factory.placeType.ScreeningRoom,
|
|
48
|
+
branchCode: '70',
|
|
49
|
+
name: {
|
|
50
|
+
ja: 'シネマ7',
|
|
51
|
+
en: 'CINEMA7'
|
|
52
|
+
},
|
|
53
|
+
address: {
|
|
54
|
+
ja: '',
|
|
55
|
+
en: ''
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
superEvent: {
|
|
59
|
+
typeOf: chevre.factory.eventType.ScreeningEventSeries,
|
|
60
|
+
id: 'al9s38bj6',
|
|
61
|
+
videoFormat: [
|
|
62
|
+
{
|
|
63
|
+
typeOf: '2D',
|
|
64
|
+
name: '2D'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
typeOf: 'IMAX',
|
|
68
|
+
name: 'IMAX'
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
soundFormat: [],
|
|
72
|
+
workPerformed: {
|
|
73
|
+
typeOf: chevre.factory.creativeWorkType.Movie,
|
|
74
|
+
identifier: '1622100',
|
|
75
|
+
id: '5bfb841d5a78d7948369980a',
|
|
76
|
+
name: {
|
|
77
|
+
en: 'Pet',
|
|
78
|
+
ja: 'ペット'
|
|
79
|
+
},
|
|
80
|
+
duration: 'PT2H3M'
|
|
81
|
+
},
|
|
82
|
+
location: {
|
|
83
|
+
typeOf: chevre.factory.placeType.MovieTheater,
|
|
84
|
+
id: '5bfb841d5a78d7948369979a',
|
|
85
|
+
branchCode: '118',
|
|
86
|
+
name: {
|
|
87
|
+
ja: 'シネモーション赤坂 ',
|
|
88
|
+
en: 'CineMotion Akasaka'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
kanaName: 'ペット IMAX2D',
|
|
92
|
+
name: {
|
|
93
|
+
en: 'pet IMAX2D',
|
|
94
|
+
ja: 'ペット IMAX2D'
|
|
95
|
+
},
|
|
96
|
+
additionalProperty: [],
|
|
97
|
+
startDate: moment('2022-09-30T15:00:00.000Z')
|
|
98
|
+
.toDate(),
|
|
99
|
+
endDate: moment('2029-07-31T15:00:00.000Z')
|
|
100
|
+
.toDate(),
|
|
101
|
+
headline: {
|
|
102
|
+
ja: 'IMAX2D上映'
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
offers: {
|
|
106
|
+
typeOf: chevre.factory.offerType.Offer,
|
|
107
|
+
eligibleQuantity: {
|
|
108
|
+
typeOf: 'QuantitativeValue',
|
|
109
|
+
unitCode: chevre.factory.unitCode.C62,
|
|
110
|
+
maxValue: 6
|
|
111
|
+
},
|
|
112
|
+
itemOffered: {
|
|
113
|
+
id: '655dc6b02cbb99d946cb6081',
|
|
114
|
+
name: {
|
|
115
|
+
ja: '通常興行カタログ(サブカタログ版)'
|
|
116
|
+
},
|
|
117
|
+
serviceOutput: {
|
|
118
|
+
typeOf: chevre.factory.reservationType.EventReservation,
|
|
119
|
+
reservedTicket: {
|
|
120
|
+
typeOf: 'Ticket',
|
|
121
|
+
ticketedSeat: {
|
|
122
|
+
typeOf: chevre.factory.placeType.Seat
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
typeOf: chevre.factory.product.ProductType.EventService,
|
|
127
|
+
availableChannel: {
|
|
128
|
+
typeOf: 'ServiceChannel',
|
|
129
|
+
serviceLocation: {
|
|
130
|
+
typeOf: chevre.factory.placeType.ScreeningRoom,
|
|
131
|
+
branchCode: '70',
|
|
132
|
+
name: {
|
|
133
|
+
ja: 'シネマ7',
|
|
134
|
+
en: 'CINEMA7'
|
|
135
|
+
},
|
|
136
|
+
containedInPlace: {
|
|
137
|
+
typeOf: chevre.factory.placeType.MovieTheater,
|
|
138
|
+
id: '5bfb841d5a78d7948369979a',
|
|
139
|
+
branchCode: '118',
|
|
140
|
+
name: {
|
|
141
|
+
ja: 'シネモーション赤坂 ',
|
|
142
|
+
en: 'CineMotion Akasaka'
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
seller: {
|
|
149
|
+
typeOf: chevre.factory.organizationType.Corporation,
|
|
150
|
+
id: '59d20831e53ebc2b4e774466',
|
|
151
|
+
name: {
|
|
152
|
+
ja: 'シネモーション赤坂',
|
|
153
|
+
en: 'CineMotion Akasaka'
|
|
154
|
+
},
|
|
155
|
+
makesOffer: [
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const createResult = await eventRepo.upsertManyScreeningEventByIdentifier(
|
|
162
|
+
[
|
|
163
|
+
{
|
|
164
|
+
$set: settingEvent,
|
|
165
|
+
$unset: {}
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
{ update: false }
|
|
169
|
+
);
|
|
170
|
+
// tslint:disable-next-line:no-null-keyword
|
|
171
|
+
console.dir(createResult, { depth: null });
|
|
172
|
+
|
|
173
|
+
const updateResult = await eventRepo.upsertManyScreeningEventByIdentifier(
|
|
174
|
+
[
|
|
175
|
+
{
|
|
176
|
+
$set: {
|
|
177
|
+
...settingEvent,
|
|
178
|
+
eventStatus: chevre.factory.eventStatusType.EventCancelled
|
|
179
|
+
},
|
|
180
|
+
$unset: {}
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
{ update: true }
|
|
184
|
+
);
|
|
185
|
+
// tslint:disable-next-line:no-null-keyword
|
|
186
|
+
console.dir(updateResult, { depth: null });
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
main()
|
|
191
|
+
.then()
|
|
192
|
+
.catch(console.error);
|
|
@@ -105,6 +105,24 @@ export declare class EventRepo {
|
|
|
105
105
|
id: string;
|
|
106
106
|
}[];
|
|
107
107
|
} | void>;
|
|
108
|
+
/**
|
|
109
|
+
* イベントコードをキーにして冪等置換
|
|
110
|
+
*/
|
|
111
|
+
upsertManyScreeningEventByIdentifier(params: {
|
|
112
|
+
$set: factory.event.screeningEvent.IEvent;
|
|
113
|
+
$unset: IUnset<factory.eventType.ScreeningEvent>;
|
|
114
|
+
}[], options: {
|
|
115
|
+
/**
|
|
116
|
+
* falseの場合setOnInsertのみ
|
|
117
|
+
* trueの場合setのみ
|
|
118
|
+
*/
|
|
119
|
+
update: boolean;
|
|
120
|
+
}): Promise<{
|
|
121
|
+
bulkWriteResult: BulkWriteResult;
|
|
122
|
+
modifiedEvents: {
|
|
123
|
+
id: string;
|
|
124
|
+
}[];
|
|
125
|
+
} | void>;
|
|
108
126
|
/**
|
|
109
127
|
* イベント部分更新
|
|
110
128
|
*/
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -482,6 +482,71 @@ class EventRepo {
|
|
|
482
482
|
}
|
|
483
483
|
});
|
|
484
484
|
}
|
|
485
|
+
/**
|
|
486
|
+
* イベントコードをキーにして冪等置換
|
|
487
|
+
*/
|
|
488
|
+
upsertManyScreeningEventByIdentifier(params, options) {
|
|
489
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
490
|
+
const { update } = options;
|
|
491
|
+
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
492
|
+
const bulkWriteOps = [];
|
|
493
|
+
const queryFilters = [];
|
|
494
|
+
if (Array.isArray(params)) {
|
|
495
|
+
params.forEach(({ $set, $unset }) => {
|
|
496
|
+
const { project, identifier } = $set;
|
|
497
|
+
if (typeof identifier !== 'string' || identifier.length === 0) {
|
|
498
|
+
throw new factory.errors.ArgumentNull('identifier');
|
|
499
|
+
}
|
|
500
|
+
// リソースのユニークネスを保証するfilter
|
|
501
|
+
const filter = {
|
|
502
|
+
'project.id': { $eq: project.id },
|
|
503
|
+
identifier: { $exists: true, $eq: identifier }
|
|
504
|
+
};
|
|
505
|
+
queryFilters.push({
|
|
506
|
+
'project.id': { $eq: project.id },
|
|
507
|
+
identifier: { $exists: true, $eq: identifier }
|
|
508
|
+
});
|
|
509
|
+
if (update === true) {
|
|
510
|
+
const { maximumPhysicalAttendeeCapacity, additionalProperty, eventStatus, location, name, superEvent, offers, doorTime, endDate, startDate } = $set;
|
|
511
|
+
const setFields = {
|
|
512
|
+
maximumPhysicalAttendeeCapacity, additionalProperty,
|
|
513
|
+
eventStatus, location, name, superEvent, offers,
|
|
514
|
+
doorTime, endDate, startDate
|
|
515
|
+
};
|
|
516
|
+
const updateOne = {
|
|
517
|
+
filter,
|
|
518
|
+
update: Object.assign({ $set: setFields }, ($unset !== undefined) ? { $unset } : undefined),
|
|
519
|
+
upsert: false
|
|
520
|
+
};
|
|
521
|
+
bulkWriteOps.push({ updateOne });
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
const { id, coaInfo, description, maximumAttendeeCapacity, remainingAttendeeCapacity, checkInCount, attendeeCount, aggregateReservation } = $set, setOnInsertFields = __rest($set, ["id", "coaInfo", "description", "maximumAttendeeCapacity", "remainingAttendeeCapacity", "checkInCount", "attendeeCount", "aggregateReservation"]);
|
|
525
|
+
const setOnInsert = Object.assign(Object.assign({}, setOnInsertFields), { identifier, _id: uniqid() });
|
|
526
|
+
const updateOne = {
|
|
527
|
+
filter,
|
|
528
|
+
update: {
|
|
529
|
+
$setOnInsert: setOnInsert
|
|
530
|
+
},
|
|
531
|
+
upsert: true
|
|
532
|
+
};
|
|
533
|
+
bulkWriteOps.push({ updateOne });
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
if (bulkWriteOps.length > 0) {
|
|
538
|
+
const bulkWriteResult = yield this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
539
|
+
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
540
|
+
const modifiedEvents = yield this.eventModel.find({ $or: queryFilters }, {
|
|
541
|
+
_id: 0,
|
|
542
|
+
id: { $toString: '$_id' }
|
|
543
|
+
})
|
|
544
|
+
.lean()
|
|
545
|
+
.exec();
|
|
546
|
+
return { bulkWriteResult, modifiedEvents };
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
}
|
|
485
550
|
/**
|
|
486
551
|
* イベント部分更新
|
|
487
552
|
*/
|
|
@@ -595,7 +660,7 @@ class EventRepo {
|
|
|
595
660
|
saveEventByIdentifier4ttts(params) {
|
|
596
661
|
return __awaiter(this, void 0, void 0, function* () {
|
|
597
662
|
const { oldEventId } = params;
|
|
598
|
-
const _a = params.attributes, { project, typeOf } = _a, updateFields = __rest(_a, ["project", "typeOf"]);
|
|
663
|
+
const _a = params.attributes, { project, typeOf, eventStatus } = _a, updateFields = __rest(_a, ["project", "typeOf", "eventStatus"]);
|
|
599
664
|
const identifier = oldEventId;
|
|
600
665
|
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
601
666
|
const id = uniqid();
|
|
@@ -614,6 +679,7 @@ class EventRepo {
|
|
|
614
679
|
_id: id,
|
|
615
680
|
typeOf,
|
|
616
681
|
project,
|
|
682
|
+
eventStatus,
|
|
617
683
|
identifier // イベントコードを必ず追加(2025-09-03~)
|
|
618
684
|
// ...(typeof identifier === 'string' && identifier !== '') ? { identifier } : undefined
|
|
619
685
|
},
|
|
@@ -63,6 +63,9 @@ export declare function createScreeningEventIdFromCOA(params: {
|
|
|
63
63
|
screenCode: string;
|
|
64
64
|
timeBegin: string;
|
|
65
65
|
}): string;
|
|
66
|
+
/**
|
|
67
|
+
* イベントコード指定でtttsイベントを冪等更新する
|
|
68
|
+
*/
|
|
66
69
|
export declare function updateEvent4ttts(params: {
|
|
67
70
|
/**
|
|
68
71
|
* 旧イベントID
|
|
@@ -75,10 +78,6 @@ export declare function updateEvent4ttts(params: {
|
|
|
75
78
|
project: {
|
|
76
79
|
id: string;
|
|
77
80
|
};
|
|
78
|
-
/**
|
|
79
|
-
* 更新者
|
|
80
|
-
*/
|
|
81
|
-
agent: factory.action.IParticipant;
|
|
82
81
|
}): (repos: {
|
|
83
82
|
action: ActionRepo;
|
|
84
83
|
event: EventRepo;
|
|
@@ -858,19 +858,28 @@ function createScreeningRoomFromCOA(project, seller, screenFromCOA) {
|
|
|
858
858
|
parentOrganization: { id: seller.id, typeOf: factory.organizationType.Corporation }
|
|
859
859
|
};
|
|
860
860
|
}
|
|
861
|
+
/**
|
|
862
|
+
* イベントコード指定でtttsイベントを冪等更新する
|
|
863
|
+
*/
|
|
861
864
|
function updateEvent4ttts(params) {
|
|
862
865
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
863
|
-
const
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
866
|
+
const updateObject = {
|
|
867
|
+
id: params.oldEventId,
|
|
868
|
+
identifier: params.oldEventId, // support identifier(2025-09-03~)
|
|
869
|
+
typeOf: factory.eventType.ScreeningEvent
|
|
870
|
+
};
|
|
871
|
+
const actionAttributes = {
|
|
872
|
+
project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
873
|
+
typeOf: factory.actionType.UpdateAction,
|
|
874
|
+
agent: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
875
|
+
object: updateObject,
|
|
867
876
|
// replacee: reservation,
|
|
868
877
|
// replacer: params.attributes, // $unsetもありうるのでいったん保留
|
|
869
878
|
targetCollection: {
|
|
870
879
|
id: params.oldEventId,
|
|
871
880
|
typeOf: factory.eventType.ScreeningEvent
|
|
872
881
|
}
|
|
873
|
-
}
|
|
882
|
+
};
|
|
874
883
|
const action = yield repos.action.start(actionAttributes);
|
|
875
884
|
let savedEvent;
|
|
876
885
|
try {
|
|
@@ -888,7 +897,6 @@ function updateEvent4ttts(params) {
|
|
|
888
897
|
}
|
|
889
898
|
throw error;
|
|
890
899
|
}
|
|
891
|
-
// アクション完了
|
|
892
900
|
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: { id: savedEvent.id } });
|
|
893
901
|
yield (0, onEventChanged_1.onEventChanged)({
|
|
894
902
|
id: [savedEvent.id],
|
|
@@ -225,8 +225,8 @@ schedule, createDate) {
|
|
|
225
225
|
yield (0, event_1.updateEvent4ttts)({
|
|
226
226
|
oldEventId,
|
|
227
227
|
attributes: eventAttributes,
|
|
228
|
-
project: { id: eventAttributes.project.id }
|
|
229
|
-
agent: eventAttributes.project
|
|
228
|
+
project: { id: eventAttributes.project.id }
|
|
229
|
+
// agent: eventAttributes.project
|
|
230
230
|
})(repos
|
|
231
231
|
// settings
|
|
232
232
|
);
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
10
|
-
|
|
11
|
-
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
const result = await eventRepo.cancelEvent({
|
|
14
|
-
project: { id: project.id },
|
|
15
|
-
id: '7iri6w0m1h1hu5y'
|
|
16
|
-
});
|
|
17
|
-
console.log(result);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
main()
|
|
21
|
-
.then()
|
|
22
|
-
.catch(console.error);
|