@chevre/domain 22.5.0-alpha.21 → 22.5.0-alpha.22
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.
|
@@ -4,6 +4,8 @@ import * as mongoose from 'mongoose';
|
|
|
4
4
|
|
|
5
5
|
import { chevre } from '../../../lib/index';
|
|
6
6
|
|
|
7
|
+
const excludedProject = { id: String(process.env.EXCLUDED_PROJECT_ID) };
|
|
8
|
+
|
|
7
9
|
async function main() {
|
|
8
10
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
11
|
|
|
@@ -12,6 +14,7 @@ async function main() {
|
|
|
12
14
|
let updateResult: any;
|
|
13
15
|
updateResult = await eventRepo.unsetUnnecessaryFields({
|
|
14
16
|
filter: {
|
|
17
|
+
'project.id': { $ne: excludedProject.id },
|
|
15
18
|
'offers.validFrom': { $exists: true },
|
|
16
19
|
startDate: {
|
|
17
20
|
$gte: moment()
|
|
@@ -6,6 +6,7 @@ const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
|
6
6
|
|
|
7
7
|
// tslint:disable-next-line:max-func-body-length
|
|
8
8
|
async function main() {
|
|
9
|
+
const now = new Date();
|
|
9
10
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
11
|
|
|
11
12
|
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
@@ -14,8 +15,8 @@ async function main() {
|
|
|
14
15
|
{
|
|
15
16
|
additionalProperty: [
|
|
16
17
|
{
|
|
17
|
-
name: '
|
|
18
|
-
value: 'akeuu512i-
|
|
18
|
+
name: 'sampleCreateId',
|
|
19
|
+
value: 'akeuu512i-202410171410-01'
|
|
19
20
|
}
|
|
20
21
|
],
|
|
21
22
|
project: {
|
|
@@ -23,10 +24,10 @@ async function main() {
|
|
|
23
24
|
typeOf: chevre.factory.organizationType.Project
|
|
24
25
|
},
|
|
25
26
|
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
26
|
-
doorTime: new Date('2024-
|
|
27
|
-
endDate: new Date('2024-
|
|
28
|
-
|
|
29
|
-
eventStatus: chevre.factory.eventStatusType.EventCancelled,
|
|
27
|
+
doorTime: new Date('2024-10-17T05:30:00.000Z'),
|
|
28
|
+
endDate: new Date('2024-10-17T05:45:00.000Z'),
|
|
29
|
+
eventStatus: chevre.factory.eventStatusType.EventScheduled,
|
|
30
|
+
// eventStatus: chevre.factory.eventStatusType.EventCancelled,
|
|
30
31
|
location: {
|
|
31
32
|
typeOf: chevre.factory.placeType.ScreeningRoom,
|
|
32
33
|
branchCode: '10',
|
|
@@ -106,7 +107,16 @@ async function main() {
|
|
|
106
107
|
ja: 'シネモーション赤坂',
|
|
107
108
|
en: 'CineMotion Akasaka'
|
|
108
109
|
},
|
|
109
|
-
makesOffer: [
|
|
110
|
+
makesOffer: [
|
|
111
|
+
{
|
|
112
|
+
typeOf: chevre.factory.offerType.Offer,
|
|
113
|
+
availableAtOrFrom: { id: '51qbjcfr72h62m06vtv5kkhgje' },
|
|
114
|
+
availabilityEnds: now,
|
|
115
|
+
availabilityStarts: now,
|
|
116
|
+
validFrom: now,
|
|
117
|
+
validThrough: now
|
|
118
|
+
}
|
|
119
|
+
]
|
|
110
120
|
},
|
|
111
121
|
unacceptedPaymentMethod: [
|
|
112
122
|
'MovieTicket'
|
|
@@ -115,7 +125,7 @@ async function main() {
|
|
|
115
125
|
organizer: {
|
|
116
126
|
id: '59d20831e53ebc2b4e774466'
|
|
117
127
|
},
|
|
118
|
-
startDate: new Date('2024-
|
|
128
|
+
startDate: new Date('2024-10-17T05:30:00.000Z'),
|
|
119
129
|
superEvent: {
|
|
120
130
|
typeOf: chevre.factory.eventType.ScreeningEventSeries,
|
|
121
131
|
id: 'akeuu512i',
|
|
@@ -163,13 +173,14 @@ async function main() {
|
|
|
163
173
|
}
|
|
164
174
|
}
|
|
165
175
|
],
|
|
166
|
-
additionalPropertyFilter: { name: '
|
|
176
|
+
additionalPropertyFilter: { name: 'sampleCreateId' },
|
|
167
177
|
eventSeries: {
|
|
168
178
|
id: 'akeuu512i'
|
|
169
179
|
},
|
|
170
180
|
screeningRoom: {
|
|
171
181
|
branchCode: '10'
|
|
172
|
-
}
|
|
182
|
+
},
|
|
183
|
+
options: { updateOffersSeller: false }
|
|
173
184
|
});
|
|
174
185
|
// tslint:disable-next-line:no-null-keyword
|
|
175
186
|
console.dir(result, { depth: null });
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -387,8 +387,10 @@ class EventRepo {
|
|
|
387
387
|
* 施設コンテンツとルームは1つに限定
|
|
388
388
|
* 存在すれば、特定の属性のみ更新する
|
|
389
389
|
*/
|
|
390
|
+
// tslint:disable-next-line:max-func-body-length
|
|
390
391
|
upsertManyByAdditionalProperty(params) {
|
|
391
392
|
return __awaiter(this, void 0, void 0, function* () {
|
|
393
|
+
const { updateOffersSeller } = params.options;
|
|
392
394
|
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
393
395
|
const bulkWriteOps = [];
|
|
394
396
|
const additionalProperties = [];
|
|
@@ -406,7 +408,7 @@ class EventRepo {
|
|
|
406
408
|
additionalProperties.push({ name: additionalPropertyFilter.name, value: additionalPropertyValue });
|
|
407
409
|
const { coaInfo, // ←適用しない
|
|
408
410
|
maximumAttendeeCapacity, remainingAttendeeCapacity, checkInCount, attendeeCount, aggregateReservation, // ←適用しない
|
|
409
|
-
eventStatus, superEvent } = creatingEventParams, setOnInsertFields = __rest(creatingEventParams, ["coaInfo", "maximumAttendeeCapacity", "remainingAttendeeCapacity", "checkInCount", "attendeeCount", "aggregateReservation", "eventStatus", "superEvent"]);
|
|
411
|
+
eventStatus, superEvent, offers } = creatingEventParams, setOnInsertFields = __rest(creatingEventParams, ["coaInfo", "maximumAttendeeCapacity", "remainingAttendeeCapacity", "checkInCount", "attendeeCount", "aggregateReservation", "eventStatus", "superEvent", "offers"]);
|
|
410
412
|
if (superEvent.id !== eventSeries.id) {
|
|
411
413
|
throw new factory.errors.Argument('superEvent.id', 'superEvent.id not matched');
|
|
412
414
|
}
|
|
@@ -424,17 +426,23 @@ class EventRepo {
|
|
|
424
426
|
},
|
|
425
427
|
'superEvent.id': { $exists: true, $eq: superEvent.id } // add superEvent.id(2024-09-15~)
|
|
426
428
|
};
|
|
427
|
-
|
|
429
|
+
let setOnInsert;
|
|
430
|
+
if (updateOffersSeller) {
|
|
431
|
+
setOnInsert = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, setOnInsertFields), { 'offers.typeOf': offers.typeOf, 'offers.eligibleQuantity': offers.eligibleQuantity, 'offers.itemOffered': offers.itemOffered }), (offers.offeredThrough !== undefined) ? { 'offers.offeredThrough': offers.offeredThrough } : undefined), (offers.unacceptedPaymentMethod !== undefined)
|
|
432
|
+
? { 'offers.unacceptedPaymentMethod': offers.unacceptedPaymentMethod }
|
|
433
|
+
: undefined), { _id: uniqid() });
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
setOnInsert = Object.assign(Object.assign({}, setOnInsertFields), { offers, _id: uniqid() });
|
|
437
|
+
}
|
|
428
438
|
bulkWriteOps.push({
|
|
429
439
|
updateOne: {
|
|
430
440
|
filter,
|
|
431
441
|
update: {
|
|
432
442
|
$setOnInsert: setOnInsert,
|
|
433
443
|
// 変更可能な属性のみ上書き
|
|
434
|
-
$set: {
|
|
435
|
-
|
|
436
|
-
superEvent // add superEvent(2024-09-15~)
|
|
437
|
-
}
|
|
444
|
+
$set: Object.assign({ eventStatus,
|
|
445
|
+
superEvent }, (updateOffersSeller) ? { 'offers.seller': offers.seller } : undefined)
|
|
438
446
|
},
|
|
439
447
|
upsert: true
|
|
440
448
|
}
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "4.386.0
|
|
15
|
-
"@cinerino/sdk": "10.13.0
|
|
14
|
+
"@chevre/factory": "4.386.0",
|
|
15
|
+
"@cinerino/sdk": "10.13.0",
|
|
16
16
|
"@motionpicture/coa-service": "9.5.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
18
18
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"postversion": "git push origin --tags",
|
|
109
109
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
110
110
|
},
|
|
111
|
-
"version": "22.5.0-alpha.
|
|
111
|
+
"version": "22.5.0-alpha.22"
|
|
112
112
|
}
|