@chevre/domain 20.2.0-alpha.49 → 20.2.0-alpha.50
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.
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment';
|
|
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 filterName: string = 'eventIdentifier';
|
|
9
|
+
|
|
10
|
+
// tslint:disable-next-line:max-func-body-length
|
|
11
|
+
async function main() {
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
13
|
+
|
|
14
|
+
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const result = await eventRepo.createManyIfNotExist<chevre.factory.eventType.ScreeningEvent>([
|
|
17
|
+
{
|
|
18
|
+
attributes: {
|
|
19
|
+
additionalProperty: [{
|
|
20
|
+
name: filterName,
|
|
21
|
+
value: '20230201143000-03'
|
|
22
|
+
}],
|
|
23
|
+
project: {
|
|
24
|
+
id: PROJECT_ID,
|
|
25
|
+
typeOf: chevre.factory.organizationType.Project
|
|
26
|
+
},
|
|
27
|
+
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
28
|
+
doorTime: moment('2023-02-01T05:00:00.000Z')
|
|
29
|
+
.toDate(),
|
|
30
|
+
startDate: moment('2023-02-01T05:00:00.000Z')
|
|
31
|
+
.toDate(),
|
|
32
|
+
endDate: moment('2023-02-01T06:00:00.000Z')
|
|
33
|
+
.toDate(),
|
|
34
|
+
workPerformed: {
|
|
35
|
+
typeOf: chevre.factory.creativeWorkType.Movie,
|
|
36
|
+
identifier: '1622100',
|
|
37
|
+
id: '5bfb841d5a78d7948369980a',
|
|
38
|
+
name: {
|
|
39
|
+
en: 'Pet',
|
|
40
|
+
ja: 'ペット'
|
|
41
|
+
},
|
|
42
|
+
duration: 'PT2H3M'
|
|
43
|
+
},
|
|
44
|
+
location: {
|
|
45
|
+
typeOf: chevre.factory.placeType.ScreeningRoom,
|
|
46
|
+
branchCode: '10',
|
|
47
|
+
name: {
|
|
48
|
+
ja: 'シネマ1',
|
|
49
|
+
en: 'CINEMA1'
|
|
50
|
+
},
|
|
51
|
+
address: {
|
|
52
|
+
ja: '7階',
|
|
53
|
+
en: '7F'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
superEvent: {
|
|
57
|
+
typeOf: chevre.factory.eventType.ScreeningEventSeries,
|
|
58
|
+
project: {
|
|
59
|
+
typeOf: chevre.factory.organizationType.Project,
|
|
60
|
+
id: 'cinerino'
|
|
61
|
+
},
|
|
62
|
+
id: '7k9ayl8hc',
|
|
63
|
+
videoFormat: [
|
|
64
|
+
{
|
|
65
|
+
typeOf: '2D',
|
|
66
|
+
name: '2D'
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
soundFormat: [],
|
|
70
|
+
workPerformed: {
|
|
71
|
+
typeOf: chevre.factory.creativeWorkType.Movie,
|
|
72
|
+
identifier: '1622100',
|
|
73
|
+
id: '5bfb841d5a78d7948369980a',
|
|
74
|
+
name: {
|
|
75
|
+
en: 'Pet',
|
|
76
|
+
ja: 'ペット'
|
|
77
|
+
},
|
|
78
|
+
duration: 'PT2H3M'
|
|
79
|
+
},
|
|
80
|
+
location: {
|
|
81
|
+
typeOf: chevre.factory.placeType.MovieTheater,
|
|
82
|
+
id: '5bfb841d5a78d7948369979a',
|
|
83
|
+
branchCode: '118',
|
|
84
|
+
name: {
|
|
85
|
+
ja: 'シネモーション赤坂 ',
|
|
86
|
+
en: 'CineMotion Akasaka'
|
|
87
|
+
},
|
|
88
|
+
kanaName: 'シネモーションアカサカ'
|
|
89
|
+
},
|
|
90
|
+
kanaName: 'ペットカナタイトル',
|
|
91
|
+
name: {
|
|
92
|
+
en: 'PetPetPetPet',
|
|
93
|
+
ja: 'ペット'
|
|
94
|
+
},
|
|
95
|
+
additionalProperty: [
|
|
96
|
+
{
|
|
97
|
+
name: 'sortNumber',
|
|
98
|
+
value: '99'
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
startDate: moment('2020-03-31T15:00:00.000Z')
|
|
102
|
+
.toDate(),
|
|
103
|
+
endDate: moment('2034-12-01T15:00:00.000Z')
|
|
104
|
+
.toDate(),
|
|
105
|
+
description: {
|
|
106
|
+
en: 'english description',
|
|
107
|
+
ja: 'ムビチケ検証用のイベントです。'
|
|
108
|
+
},
|
|
109
|
+
headline: {
|
|
110
|
+
en: 'headlineheadlineheadlineheadlineheadlineheadlineheadline',
|
|
111
|
+
ja: 'サブタイトルkanaName'
|
|
112
|
+
},
|
|
113
|
+
subtitleLanguage: {
|
|
114
|
+
typeOf: 'Language',
|
|
115
|
+
name: 'Japanese'
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
name: {
|
|
119
|
+
en: 'PetPetPetPet',
|
|
120
|
+
ja: 'ペット'
|
|
121
|
+
},
|
|
122
|
+
eventStatus: chevre.factory.eventStatusType.EventScheduled,
|
|
123
|
+
offers: {
|
|
124
|
+
typeOf: chevre.factory.offerType.Offer,
|
|
125
|
+
priceCurrency: chevre.factory.priceCurrency.JPY,
|
|
126
|
+
availabilityEnds: moment('2023-02-01T01:20:00.000Z')
|
|
127
|
+
.toDate(),
|
|
128
|
+
availabilityStarts: moment('2023-01-30T15:00:00.000Z')
|
|
129
|
+
.toDate(),
|
|
130
|
+
eligibleQuantity: {
|
|
131
|
+
typeOf: 'QuantitativeValue',
|
|
132
|
+
unitCode: chevre.factory.unitCode.C62,
|
|
133
|
+
maxValue: 6,
|
|
134
|
+
value: 1
|
|
135
|
+
},
|
|
136
|
+
itemOffered: {
|
|
137
|
+
id: '6308580bdef565000a9aa1fd',
|
|
138
|
+
name: {
|
|
139
|
+
ja: '通常興行カタログ'
|
|
140
|
+
},
|
|
141
|
+
serviceOutput: {
|
|
142
|
+
typeOf: chevre.factory.reservationType.EventReservation,
|
|
143
|
+
reservedTicket: {
|
|
144
|
+
typeOf: 'Ticket',
|
|
145
|
+
ticketedSeat: {
|
|
146
|
+
typeOf: chevre.factory.placeType.Seat
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
typeOf: chevre.factory.product.ProductType.EventService,
|
|
151
|
+
availableChannel: {
|
|
152
|
+
typeOf: 'ServiceChannel',
|
|
153
|
+
serviceLocation: {
|
|
154
|
+
typeOf: chevre.factory.placeType.ScreeningRoom,
|
|
155
|
+
branchCode: '10',
|
|
156
|
+
name: {
|
|
157
|
+
ja: 'シネマ1',
|
|
158
|
+
en: 'CINEMA1'
|
|
159
|
+
},
|
|
160
|
+
containedInPlace: {
|
|
161
|
+
typeOf: chevre.factory.placeType.MovieTheater,
|
|
162
|
+
id: '5bfb841d5a78d7948369979a',
|
|
163
|
+
branchCode: '118',
|
|
164
|
+
name: {
|
|
165
|
+
ja: 'シネモーション赤坂 ',
|
|
166
|
+
en: 'CineMotion Akasaka'
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
serviceType: {
|
|
172
|
+
codeValue: '0001',
|
|
173
|
+
id: '5e3361d01dc1ef1a20dd8737',
|
|
174
|
+
inCodeSet: {
|
|
175
|
+
typeOf: 'CategoryCodeSet',
|
|
176
|
+
identifier: chevre.factory.categoryCode.CategorySetIdentifier.ServiceType
|
|
177
|
+
},
|
|
178
|
+
project: {
|
|
179
|
+
typeOf: chevre.factory.organizationType.Project,
|
|
180
|
+
id: 'cinerino'
|
|
181
|
+
},
|
|
182
|
+
typeOf: 'CategoryCode'
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
validFrom: moment('2023-01-29T15:00:00.000Z')
|
|
186
|
+
.toDate(),
|
|
187
|
+
validThrough: moment('2023-02-01T01:20:00.000Z')
|
|
188
|
+
.toDate(),
|
|
189
|
+
seller: {
|
|
190
|
+
typeOf: chevre.factory.organizationType.Corporation,
|
|
191
|
+
id: '59d20831e53ebc2b4e774466',
|
|
192
|
+
name: {
|
|
193
|
+
ja: 'シネモーション赤坂',
|
|
194
|
+
en: 'CineMotion Akasaka'
|
|
195
|
+
},
|
|
196
|
+
makesOffer: []
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
filter: { name: filterName }
|
|
201
|
+
}
|
|
202
|
+
]);
|
|
203
|
+
console.log(result);
|
|
204
|
+
console.log('upsertedIds:', (Array.isArray(result?.result.upserted)) ? result?.result.upserted.map((u) => u._id) : []);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
main()
|
|
208
|
+
.then(console.log)
|
|
209
|
+
.catch(console.error);
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -465,8 +465,8 @@ class MongoRepository {
|
|
|
465
465
|
const bulkWriteOps = [];
|
|
466
466
|
if (Array.isArray(params)) {
|
|
467
467
|
params.forEach((creatingEventParams) => {
|
|
468
|
-
var _a;
|
|
469
|
-
const additionalPropertyValue = (_a = creatingEventParams.attributes.additionalProperty) === null || _a === void 0 ? void 0 : _a.find((property) => property.name === creatingEventParams.filter.name);
|
|
468
|
+
var _a, _b;
|
|
469
|
+
const additionalPropertyValue = (_b = (_a = creatingEventParams.attributes.additionalProperty) === null || _a === void 0 ? void 0 : _a.find((property) => property.name === creatingEventParams.filter.name)) === null || _b === void 0 ? void 0 : _b.value;
|
|
470
470
|
if (typeof additionalPropertyValue !== 'string') {
|
|
471
471
|
throw new factory.errors.NotFound('additionalProperty.value');
|
|
472
472
|
}
|
|
@@ -60,11 +60,18 @@ export declare function searchEventSeatOffersWithPaging(params: {
|
|
|
60
60
|
eventAvailability: EventAvailabilityRepo;
|
|
61
61
|
place: PlaceRepo;
|
|
62
62
|
}) => Promise<factory.place.seat.IPlaceWithOffer[]>;
|
|
63
|
+
interface IChangedEvent {
|
|
64
|
+
id: string;
|
|
65
|
+
typeOf: factory.eventType;
|
|
66
|
+
project: {
|
|
67
|
+
id: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
63
70
|
/**
|
|
64
71
|
* イベント変更時処理
|
|
65
72
|
*/
|
|
66
73
|
export declare function onEventChanged(params: {
|
|
67
|
-
event:
|
|
74
|
+
event: IChangedEvent | IChangedEvent[];
|
|
68
75
|
isNew: boolean;
|
|
69
76
|
}): (repos: {
|
|
70
77
|
event: EventRepo;
|
package/package.json
CHANGED