@chevre/domain 21.4.0-alpha.7 → 21.4.0-alpha.9
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/migrateEventOrganizer.ts +25 -18
- package/example/src/chevre/searchEvents.ts +1 -9
- package/lib/chevre/repo/event.d.ts +9 -4
- package/lib/chevre/repo/event.js +85 -62
- package/lib/chevre/repo/seller.d.ts +4 -3
- package/lib/chevre/repo/seller.js +40 -38
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
- package/lib/chevre/service/assetTransaction/pay.js +9 -1
- package/lib/chevre/service/event.js +4 -11
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +15 -1
- package/lib/chevre/service/payment/creditCard.js +9 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
- package/lib/chevre/service/payment/movieTicket.js +19 -2
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
- package/lib/chevre/service/transaction/returnOrder.js +9 -3
- package/package.json +3 -3
- package/example/src/chevre/migrateEventOffersItemOfferedTypeOf.ts +0 -75
- package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +0 -64
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +0 -79
|
@@ -47,11 +47,15 @@ async function main() {
|
|
|
47
47
|
let updateCount = 0;
|
|
48
48
|
await cursor.eachAsync(async (doc) => {
|
|
49
49
|
i += 1;
|
|
50
|
-
const event:
|
|
51
|
-
|
|
50
|
+
const event: Pick<
|
|
51
|
+
chevre.factory.event.IEvent<chevre.factory.eventType.ScreeningEvent>,
|
|
52
|
+
'id' | 'project' | 'location' | 'startDate' | 'typeOf' | 'organizer' | 'superEvent'
|
|
53
|
+
> | Pick<
|
|
54
|
+
chevre.factory.event.IEvent<chevre.factory.eventType.ScreeningEventSeries>,
|
|
55
|
+
'id' | 'project' | 'location' | 'startDate' | 'typeOf' | 'organizer'
|
|
56
|
+
> = doc.toObject();
|
|
52
57
|
|
|
53
58
|
const organizerId = event.organizer?.id;
|
|
54
|
-
|
|
55
59
|
const alreadyMigrated = typeof organizerId === 'string';
|
|
56
60
|
|
|
57
61
|
if (alreadyMigrated) {
|
|
@@ -77,22 +81,25 @@ async function main() {
|
|
|
77
81
|
const movieTheater = movieTheaters.shift();
|
|
78
82
|
const sellerId = movieTheater?.parentOrganization?.id;
|
|
79
83
|
console.log('movieTheater found', event.project.id, event.id, event.startDate, 'sellerId:', sellerId, i);
|
|
80
|
-
if (typeof sellerId !== 'string') {
|
|
81
|
-
|
|
84
|
+
// if (typeof sellerId !== 'string') {
|
|
85
|
+
// throw new Error('movieTheater not found');
|
|
86
|
+
// }
|
|
87
|
+
if (typeof sellerId === 'string') {
|
|
88
|
+
const newOrganizer: chevre.factory.event.screeningEventSeries.IOrganizer = {
|
|
89
|
+
id: sellerId
|
|
90
|
+
};
|
|
91
|
+
console.log('updating event...', event.project.id, event.id, event.startDate, i);
|
|
92
|
+
await eventRepo.updatePartiallyById({
|
|
93
|
+
project: { id: event.project.id },
|
|
94
|
+
id: event.id,
|
|
95
|
+
attributes: <any>{
|
|
96
|
+
typeOf: event.typeOf,
|
|
97
|
+
organizer: newOrganizer
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
updateCount += 1;
|
|
101
|
+
console.log('updated.', event.project.id, event.id, event.startDate, i);
|
|
82
102
|
}
|
|
83
|
-
const newOrganizer: chevre.factory.event.screeningEventSeries.IOrganizer = {
|
|
84
|
-
id: sellerId
|
|
85
|
-
};
|
|
86
|
-
console.log('updating event...', event.project.id, event.id, event.startDate, i);
|
|
87
|
-
await eventRepo.updatePartiallyById({
|
|
88
|
-
id: event.id,
|
|
89
|
-
attributes: <any>{
|
|
90
|
-
typeOf: event.typeOf,
|
|
91
|
-
organizer: newOrganizer
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
updateCount += 1;
|
|
95
|
-
console.log('updated.', event.project.id, event.id, event.startDate, i);
|
|
96
103
|
}
|
|
97
104
|
});
|
|
98
105
|
|
|
@@ -10,14 +10,6 @@ async function main() {
|
|
|
10
10
|
|
|
11
11
|
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
12
12
|
|
|
13
|
-
const event = await eventRepo.findById(
|
|
14
|
-
{ id: 'al6aff83y' },
|
|
15
|
-
{
|
|
16
|
-
name: 1
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
console.log('event found', event);
|
|
20
|
-
|
|
21
13
|
const events = await eventRepo.search(
|
|
22
14
|
{
|
|
23
15
|
limit: 100,
|
|
@@ -25,7 +17,7 @@ async function main() {
|
|
|
25
17
|
sort: { startDate: 1 },
|
|
26
18
|
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
27
19
|
project: { id: { $eq: PROJECT_ID } },
|
|
28
|
-
id: { $
|
|
20
|
+
id: { $eq: 'al6aff83y' }
|
|
29
21
|
},
|
|
30
22
|
{
|
|
31
23
|
name: 1
|
|
@@ -121,6 +121,9 @@ export declare class MongoRepository {
|
|
|
121
121
|
* イベント部分更新
|
|
122
122
|
*/
|
|
123
123
|
updatePartiallyById<T extends factory.eventType>(params: {
|
|
124
|
+
project: {
|
|
125
|
+
id: string;
|
|
126
|
+
};
|
|
124
127
|
id: string;
|
|
125
128
|
attributes: IAttributes4patchUpdate<T>;
|
|
126
129
|
}): Promise<factory.event.IEvent<T>>;
|
|
@@ -143,15 +146,11 @@ export declare class MongoRepository {
|
|
|
143
146
|
oldEventId: string;
|
|
144
147
|
attributes: factory.event.IAttributes<factory.eventType.ScreeningEvent>;
|
|
145
148
|
}): Promise<factory.event.IEvent<factory.eventType.ScreeningEvent>>;
|
|
146
|
-
count<T extends factory.eventType>(params: ISearchConditions<T>): Promise<number>;
|
|
147
149
|
/**
|
|
148
150
|
* イベントを検索する
|
|
149
151
|
*/
|
|
150
152
|
search<T extends factory.eventType>(params: ISearchConditions<T>, projection?: IProjection): Promise<factory.event.IEvent<T>[]>;
|
|
151
153
|
searchIds<T extends factory.eventType>(params: ISearchConditions<T>): Promise<string[]>;
|
|
152
|
-
findById<T extends factory.eventType>(params: {
|
|
153
|
-
id: string;
|
|
154
|
-
}, projection?: IProjection): Promise<factory.event.IEvent<T>>;
|
|
155
154
|
findMinimizedIndividualEventById<T extends factory.eventType.ScreeningEvent | factory.eventType.Event>(params: {
|
|
156
155
|
id: string;
|
|
157
156
|
}): Promise<IMinimizedIndividualEvent<T>>;
|
|
@@ -159,9 +158,15 @@ export declare class MongoRepository {
|
|
|
159
158
|
* イベントをキャンセルする
|
|
160
159
|
*/
|
|
161
160
|
cancel(params: {
|
|
161
|
+
project: {
|
|
162
|
+
id: string;
|
|
163
|
+
};
|
|
162
164
|
id: string;
|
|
163
165
|
}): Promise<void>;
|
|
164
166
|
deleteById(params: {
|
|
167
|
+
project: {
|
|
168
|
+
id: string;
|
|
169
|
+
};
|
|
165
170
|
id: string;
|
|
166
171
|
}): Promise<void>;
|
|
167
172
|
deleteByProject(params: {
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -51,25 +51,23 @@ class MongoRepository {
|
|
|
51
51
|
}
|
|
52
52
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
53
53
|
static CREATE_MONGO_CONDITIONS(conditions) {
|
|
54
|
-
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, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41;
|
|
54
|
+
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, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42;
|
|
55
55
|
const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
|
|
56
56
|
const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
57
57
|
if (typeof projectIdEq === 'string') {
|
|
58
|
-
andConditions.push({
|
|
59
|
-
'project.id': { $eq: projectIdEq }
|
|
60
|
-
});
|
|
58
|
+
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
61
59
|
}
|
|
62
60
|
const organizerIdEq = (_d = (_c = conditions.organizer) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
63
61
|
if (typeof organizerIdEq === 'string') {
|
|
64
|
-
andConditions.push({
|
|
65
|
-
'organizer.id': { $exists: true, $eq: organizerIdEq }
|
|
66
|
-
});
|
|
62
|
+
andConditions.push({ 'organizer.id': { $exists: true, $eq: organizerIdEq } });
|
|
67
63
|
}
|
|
68
|
-
const
|
|
64
|
+
const idEq = (_e = conditions.id) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
65
|
+
if (typeof idEq === 'string') {
|
|
66
|
+
andConditions.push({ _id: { $eq: idEq } });
|
|
67
|
+
}
|
|
68
|
+
const idIn = (_f = conditions.id) === null || _f === void 0 ? void 0 : _f.$in;
|
|
69
69
|
if (Array.isArray(idIn)) {
|
|
70
|
-
andConditions.push({
|
|
71
|
-
_id: { $in: idIn }
|
|
72
|
-
});
|
|
70
|
+
andConditions.push({ _id: { $in: idIn } });
|
|
73
71
|
}
|
|
74
72
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
75
73
|
/* istanbul ignore else */
|
|
@@ -120,17 +118,17 @@ class MongoRepository {
|
|
|
120
118
|
endDate: { $lte: conditions.endThrough }
|
|
121
119
|
});
|
|
122
120
|
}
|
|
123
|
-
const locationBranchCodeEq = (
|
|
121
|
+
const locationBranchCodeEq = (_h = (_g = conditions.location) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
124
122
|
if (typeof locationBranchCodeEq === 'string') {
|
|
125
123
|
andConditions.push({ 'location.branchCode': { $exists: true, $eq: locationBranchCodeEq } });
|
|
126
124
|
}
|
|
127
|
-
const locationBranchCodeIn = (
|
|
125
|
+
const locationBranchCodeIn = (_k = (_j = conditions.location) === null || _j === void 0 ? void 0 : _j.branchCode) === null || _k === void 0 ? void 0 : _k.$in;
|
|
128
126
|
if (Array.isArray(locationBranchCodeIn)) {
|
|
129
127
|
andConditions.push({ 'location.branchCode': { $exists: true, $in: locationBranchCodeIn } });
|
|
130
128
|
}
|
|
131
129
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
132
130
|
/* istanbul ignore else */
|
|
133
|
-
const hasOfferCatalogIdEq = (
|
|
131
|
+
const hasOfferCatalogIdEq = (_m = (_l = conditions.hasOfferCatalog) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$eq;
|
|
134
132
|
if (typeof hasOfferCatalogIdEq === 'string') {
|
|
135
133
|
andConditions.push({
|
|
136
134
|
'hasOfferCatalog.id': {
|
|
@@ -139,7 +137,7 @@ class MongoRepository {
|
|
|
139
137
|
}
|
|
140
138
|
});
|
|
141
139
|
}
|
|
142
|
-
const additionalPropertyElemMatch = (
|
|
140
|
+
const additionalPropertyElemMatch = (_o = conditions.additionalProperty) === null || _o === void 0 ? void 0 : _o.$elemMatch;
|
|
143
141
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
144
142
|
andConditions.push({
|
|
145
143
|
additionalProperty: {
|
|
@@ -155,7 +153,7 @@ class MongoRepository {
|
|
|
155
153
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
156
154
|
/* istanbul ignore else */
|
|
157
155
|
if (params.offers !== undefined) {
|
|
158
|
-
const itemOfferedIdIn4event = (
|
|
156
|
+
const itemOfferedIdIn4event = (_q = (_p = params.offers.itemOffered) === null || _p === void 0 ? void 0 : _p.id) === null || _q === void 0 ? void 0 : _q.$in;
|
|
159
157
|
if (Array.isArray(itemOfferedIdIn4event)) {
|
|
160
158
|
andConditions.push({
|
|
161
159
|
'offers.itemOffered.id': {
|
|
@@ -205,8 +203,8 @@ class MongoRepository {
|
|
|
205
203
|
}
|
|
206
204
|
}
|
|
207
205
|
}
|
|
208
|
-
const sellerMakesOfferElemMatch4event = (
|
|
209
|
-
if (typeof ((
|
|
206
|
+
const sellerMakesOfferElemMatch4event = (_t = (_s = (_r = params.offers) === null || _r === void 0 ? void 0 : _r.seller) === null || _s === void 0 ? void 0 : _s.makesOffer) === null || _t === void 0 ? void 0 : _t.$elemMatch;
|
|
207
|
+
if (typeof ((_u = sellerMakesOfferElemMatch4event === null || sellerMakesOfferElemMatch4event === void 0 ? void 0 : sellerMakesOfferElemMatch4event['availableAtOrFrom.id']) === null || _u === void 0 ? void 0 : _u.$eq) === 'string') {
|
|
210
208
|
andConditions.push({
|
|
211
209
|
'offers.seller.makesOffer': {
|
|
212
210
|
$exists: true,
|
|
@@ -214,7 +212,7 @@ class MongoRepository {
|
|
|
214
212
|
}
|
|
215
213
|
});
|
|
216
214
|
}
|
|
217
|
-
const reservationForIdentifierEq = (_y = (_x = (_w = (_v =
|
|
215
|
+
const reservationForIdentifierEq = (_z = (_y = (_x = (_w = (_v = params.offers) === null || _v === void 0 ? void 0 : _v.itemOffered) === null || _w === void 0 ? void 0 : _w.serviceOutput) === null || _x === void 0 ? void 0 : _x.reservationFor) === null || _y === void 0 ? void 0 : _y.identifier) === null || _z === void 0 ? void 0 : _z.$eq;
|
|
218
216
|
if (typeof reservationForIdentifierEq === 'string') {
|
|
219
217
|
andConditions.push({
|
|
220
218
|
'offers.itemOffered.serviceOutput.reservationFor.identifier': {
|
|
@@ -223,7 +221,7 @@ class MongoRepository {
|
|
|
223
221
|
}
|
|
224
222
|
});
|
|
225
223
|
}
|
|
226
|
-
const reservationForArrivalBusStopBranchCodeEq = (_4 = (_3 = (_2 = (_1 = (_0 =
|
|
224
|
+
const reservationForArrivalBusStopBranchCodeEq = (_5 = (_4 = (_3 = (_2 = (_1 = (_0 = params.offers) === null || _0 === void 0 ? void 0 : _0.itemOffered) === null || _1 === void 0 ? void 0 : _1.serviceOutput) === null || _2 === void 0 ? void 0 : _2.reservationFor) === null || _3 === void 0 ? void 0 : _3.arrivalBusStop) === null || _4 === void 0 ? void 0 : _4.branchCode) === null || _5 === void 0 ? void 0 : _5.$eq;
|
|
227
225
|
if (typeof reservationForArrivalBusStopBranchCodeEq === 'string') {
|
|
228
226
|
andConditions.push({
|
|
229
227
|
'offers.itemOffered.serviceOutput.reservationFor.arrivalBusStop.branchCode': {
|
|
@@ -232,7 +230,7 @@ class MongoRepository {
|
|
|
232
230
|
}
|
|
233
231
|
});
|
|
234
232
|
}
|
|
235
|
-
const reservationForDepartureBusStopBranchCodeEq = (_10 = (_9 = (_8 = (_7 = (_6 =
|
|
233
|
+
const reservationForDepartureBusStopBranchCodeEq = (_11 = (_10 = (_9 = (_8 = (_7 = (_6 = params.offers) === null || _6 === void 0 ? void 0 : _6.itemOffered) === null || _7 === void 0 ? void 0 : _7.serviceOutput) === null || _8 === void 0 ? void 0 : _8.reservationFor) === null || _9 === void 0 ? void 0 : _9.departureBusStop) === null || _10 === void 0 ? void 0 : _10.branchCode) === null || _11 === void 0 ? void 0 : _11.$eq;
|
|
236
234
|
if (typeof reservationForDepartureBusStopBranchCodeEq === 'string') {
|
|
237
235
|
andConditions.push({
|
|
238
236
|
'offers.itemOffered.serviceOutput.reservationFor.departureBusStop.branchCode': {
|
|
@@ -266,7 +264,7 @@ class MongoRepository {
|
|
|
266
264
|
}
|
|
267
265
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
268
266
|
/* istanbul ignore else */
|
|
269
|
-
const superEventLocationIdEq = (
|
|
267
|
+
const superEventLocationIdEq = (_14 = (_13 = (_12 = params.superEvent) === null || _12 === void 0 ? void 0 : _12.location) === null || _13 === void 0 ? void 0 : _13.id) === null || _14 === void 0 ? void 0 : _14.$eq;
|
|
270
268
|
if (typeof superEventLocationIdEq === 'string') {
|
|
271
269
|
andConditions.push({
|
|
272
270
|
'superEvent.location.id': {
|
|
@@ -309,7 +307,7 @@ class MongoRepository {
|
|
|
309
307
|
});
|
|
310
308
|
}
|
|
311
309
|
}
|
|
312
|
-
const itemOfferedIdIn = (
|
|
310
|
+
const itemOfferedIdIn = (_17 = (_16 = (_15 = params.offers) === null || _15 === void 0 ? void 0 : _15.itemOffered) === null || _16 === void 0 ? void 0 : _16.id) === null || _17 === void 0 ? void 0 : _17.$in;
|
|
313
311
|
if (Array.isArray(itemOfferedIdIn)) {
|
|
314
312
|
andConditions.push({
|
|
315
313
|
'offers.itemOffered.id': {
|
|
@@ -318,7 +316,7 @@ class MongoRepository {
|
|
|
318
316
|
}
|
|
319
317
|
});
|
|
320
318
|
}
|
|
321
|
-
const itemOfferedTicketedSeatTypeOfIn = (_21 = (_20 = (_19 = (_18 =
|
|
319
|
+
const itemOfferedTicketedSeatTypeOfIn = (_22 = (_21 = (_20 = (_19 = (_18 = params.offers) === null || _18 === void 0 ? void 0 : _18.itemOffered) === null || _19 === void 0 ? void 0 : _19.serviceOutput) === null || _20 === void 0 ? void 0 : _20.reservedTicket) === null || _21 === void 0 ? void 0 : _21.ticketedSeat) === null || _22 === void 0 ? void 0 : _22.typeOfs;
|
|
322
320
|
if (Array.isArray(itemOfferedTicketedSeatTypeOfIn)) {
|
|
323
321
|
andConditions.push({
|
|
324
322
|
'offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOf': {
|
|
@@ -327,7 +325,7 @@ class MongoRepository {
|
|
|
327
325
|
}
|
|
328
326
|
});
|
|
329
327
|
}
|
|
330
|
-
const itemOfferedServiceTypeIdIn = (
|
|
328
|
+
const itemOfferedServiceTypeIdIn = (_25 = (_24 = (_23 = params.offers) === null || _23 === void 0 ? void 0 : _23.itemOffered) === null || _24 === void 0 ? void 0 : _24.serviceType) === null || _25 === void 0 ? void 0 : _25.ids;
|
|
331
329
|
if (Array.isArray(itemOfferedServiceTypeIdIn)) {
|
|
332
330
|
andConditions.push({
|
|
333
331
|
'offers.itemOffered.serviceType.id': {
|
|
@@ -336,8 +334,8 @@ class MongoRepository {
|
|
|
336
334
|
}
|
|
337
335
|
});
|
|
338
336
|
}
|
|
339
|
-
const sellerMakesOfferElemMatch = (
|
|
340
|
-
if (typeof ((
|
|
337
|
+
const sellerMakesOfferElemMatch = (_28 = (_27 = (_26 = params.offers) === null || _26 === void 0 ? void 0 : _26.seller) === null || _27 === void 0 ? void 0 : _27.makesOffer) === null || _28 === void 0 ? void 0 : _28.$elemMatch;
|
|
338
|
+
if (typeof ((_29 = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _29 === void 0 ? void 0 : _29.$eq) === 'string') {
|
|
341
339
|
andConditions.push({
|
|
342
340
|
'offers.seller.makesOffer': {
|
|
343
341
|
$exists: true,
|
|
@@ -374,7 +372,7 @@ class MongoRepository {
|
|
|
374
372
|
]
|
|
375
373
|
});
|
|
376
374
|
}
|
|
377
|
-
const locationIdEq = (
|
|
375
|
+
const locationIdEq = (_31 = (_30 = params.location) === null || _30 === void 0 ? void 0 : _30.id) === null || _31 === void 0 ? void 0 : _31.$eq;
|
|
378
376
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
379
377
|
/* istanbul ignore else */
|
|
380
378
|
if (typeof locationIdEq === 'string') {
|
|
@@ -396,7 +394,7 @@ class MongoRepository {
|
|
|
396
394
|
});
|
|
397
395
|
}
|
|
398
396
|
}
|
|
399
|
-
const workPerformedIdentifierIn = (
|
|
397
|
+
const workPerformedIdentifierIn = (_32 = params.workPerformed) === null || _32 === void 0 ? void 0 : _32.identifiers;
|
|
400
398
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
401
399
|
/* istanbul ignore else */
|
|
402
400
|
if (Array.isArray(workPerformedIdentifierIn)) {
|
|
@@ -404,13 +402,13 @@ class MongoRepository {
|
|
|
404
402
|
'workPerformed.identifier': { $exists: true, $in: workPerformedIdentifierIn }
|
|
405
403
|
});
|
|
406
404
|
}
|
|
407
|
-
const workPerformedVersionEq = (
|
|
405
|
+
const workPerformedVersionEq = (_34 = (_33 = params.workPerformed) === null || _33 === void 0 ? void 0 : _33.version) === null || _34 === void 0 ? void 0 : _34.$eq;
|
|
408
406
|
if (typeof workPerformedVersionEq === 'string') {
|
|
409
407
|
andConditions.push({
|
|
410
408
|
'workPerformed.version': { $exists: true, $eq: workPerformedVersionEq }
|
|
411
409
|
});
|
|
412
410
|
}
|
|
413
|
-
const videoFormatTypeOfEq = (
|
|
411
|
+
const videoFormatTypeOfEq = (_36 = (_35 = params.videoFormat) === null || _35 === void 0 ? void 0 : _35.typeOf) === null || _36 === void 0 ? void 0 : _36.$eq;
|
|
414
412
|
if (typeof videoFormatTypeOfEq === 'string') {
|
|
415
413
|
andConditions.push({
|
|
416
414
|
'videoFormat.typeOf': {
|
|
@@ -419,7 +417,7 @@ class MongoRepository {
|
|
|
419
417
|
}
|
|
420
418
|
});
|
|
421
419
|
}
|
|
422
|
-
const videoFormatTypeOfIn = (
|
|
420
|
+
const videoFormatTypeOfIn = (_38 = (_37 = params.videoFormat) === null || _37 === void 0 ? void 0 : _37.typeOf) === null || _38 === void 0 ? void 0 : _38.$in;
|
|
423
421
|
if (Array.isArray(videoFormatTypeOfIn)) {
|
|
424
422
|
andConditions.push({
|
|
425
423
|
'videoFormat.typeOf': {
|
|
@@ -428,7 +426,7 @@ class MongoRepository {
|
|
|
428
426
|
}
|
|
429
427
|
});
|
|
430
428
|
}
|
|
431
|
-
const soundFormatTypeOfEq = (
|
|
429
|
+
const soundFormatTypeOfEq = (_40 = (_39 = params.soundFormat) === null || _39 === void 0 ? void 0 : _39.typeOf) === null || _40 === void 0 ? void 0 : _40.$eq;
|
|
432
430
|
if (typeof soundFormatTypeOfEq === 'string') {
|
|
433
431
|
andConditions.push({
|
|
434
432
|
'soundFormat.typeOf': {
|
|
@@ -437,7 +435,7 @@ class MongoRepository {
|
|
|
437
435
|
}
|
|
438
436
|
});
|
|
439
437
|
}
|
|
440
|
-
const soundFormatTypeOfIn = (
|
|
438
|
+
const soundFormatTypeOfIn = (_42 = (_41 = params.soundFormat) === null || _41 === void 0 ? void 0 : _41.typeOf) === null || _42 === void 0 ? void 0 : _42.$in;
|
|
441
439
|
if (Array.isArray(soundFormatTypeOfIn)) {
|
|
442
440
|
andConditions.push({
|
|
443
441
|
'soundFormat.typeOf': {
|
|
@@ -592,6 +590,7 @@ class MongoRepository {
|
|
|
592
590
|
const _a = params.attributes, { typeOf } = _a, updateFields = __rest(_a, ["typeOf"]);
|
|
593
591
|
doc = yield this.eventModel.findOneAndUpdate({
|
|
594
592
|
_id: params.id,
|
|
593
|
+
'project.id': { $eq: params.project.id },
|
|
595
594
|
typeOf: params.attributes.typeOf
|
|
596
595
|
}, {
|
|
597
596
|
$set: updateFields
|
|
@@ -694,6 +693,7 @@ class MongoRepository {
|
|
|
694
693
|
const _a = params.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
|
|
695
694
|
const id = uniqid();
|
|
696
695
|
doc = yield this.eventModel.findOneAndUpdate({
|
|
696
|
+
'project.id': { $eq: params.attributes.project.id },
|
|
697
697
|
typeOf: params.attributes.typeOf,
|
|
698
698
|
// 追加特性をキーに更新
|
|
699
699
|
additionalProperty: {
|
|
@@ -717,14 +717,16 @@ class MongoRepository {
|
|
|
717
717
|
return doc.toObject();
|
|
718
718
|
});
|
|
719
719
|
}
|
|
720
|
-
count(
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
}
|
|
720
|
+
// public async count<T extends factory.eventType>(
|
|
721
|
+
// params: ISearchConditions<T>
|
|
722
|
+
// ): Promise<number> {
|
|
723
|
+
// const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
724
|
+
// return this.eventModel.countDocuments(
|
|
725
|
+
// { $and: conditions }
|
|
726
|
+
// )
|
|
727
|
+
// .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
728
|
+
// .exec();
|
|
729
|
+
// }
|
|
728
730
|
/**
|
|
729
731
|
* イベントを検索する
|
|
730
732
|
*/
|
|
@@ -772,24 +774,39 @@ class MongoRepository {
|
|
|
772
774
|
.exec();
|
|
773
775
|
});
|
|
774
776
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
777
|
+
// searchに置き換え(2023-07-13~)
|
|
778
|
+
// public async findById<T extends factory.eventType>(
|
|
779
|
+
// params: {
|
|
780
|
+
// project: { id: string };
|
|
781
|
+
// id: string;
|
|
782
|
+
// },
|
|
783
|
+
// projection?: IProjection
|
|
784
|
+
// ): Promise<factory.event.IEvent<T>> {
|
|
785
|
+
// const positiveProjectionExists: boolean = (projection !== undefined && projection !== null)
|
|
786
|
+
// ? Object.values(projection)
|
|
787
|
+
// .some((value) => value !== 0)
|
|
788
|
+
// : false;
|
|
789
|
+
// const doc = await this.eventModel.findOne(
|
|
790
|
+
// {
|
|
791
|
+
// _id: params.id,
|
|
792
|
+
// 'project.id': { $eq: params.project.id }
|
|
793
|
+
// },
|
|
794
|
+
// // :1対応(2023-01-25~)
|
|
795
|
+
// (positiveProjectionExists)
|
|
796
|
+
// ? projection
|
|
797
|
+
// : {
|
|
798
|
+
// ...projection,
|
|
799
|
+
// __v: 0,
|
|
800
|
+
// createdAt: 0,
|
|
801
|
+
// updatedAt: 0
|
|
802
|
+
// }
|
|
803
|
+
// )
|
|
804
|
+
// .exec();
|
|
805
|
+
// if (doc === null) {
|
|
806
|
+
// throw new factory.errors.NotFound(this.eventModel.modelName);
|
|
807
|
+
// }
|
|
808
|
+
// return doc.toObject();
|
|
809
|
+
// }
|
|
793
810
|
findMinimizedIndividualEventById(params) {
|
|
794
811
|
return __awaiter(this, void 0, void 0, function* () {
|
|
795
812
|
const doc = yield this.eventModel.findOne({ _id: params.id }, exports.PROJECTION_MINIMIZED_EVENT)
|
|
@@ -805,13 +822,19 @@ class MongoRepository {
|
|
|
805
822
|
*/
|
|
806
823
|
cancel(params) {
|
|
807
824
|
return __awaiter(this, void 0, void 0, function* () {
|
|
808
|
-
yield this.eventModel.findOneAndUpdate({
|
|
825
|
+
yield this.eventModel.findOneAndUpdate({
|
|
826
|
+
_id: params.id,
|
|
827
|
+
'project.id': { $eq: params.project.id }
|
|
828
|
+
}, { eventStatus: factory.eventStatusType.EventCancelled })
|
|
809
829
|
.exec();
|
|
810
830
|
});
|
|
811
831
|
}
|
|
812
832
|
deleteById(params) {
|
|
813
833
|
return __awaiter(this, void 0, void 0, function* () {
|
|
814
|
-
yield this.eventModel.findOneAndDelete({
|
|
834
|
+
yield this.eventModel.findOneAndDelete({
|
|
835
|
+
_id: params.id,
|
|
836
|
+
'project.id': { $eq: params.project.id }
|
|
837
|
+
})
|
|
815
838
|
.exec();
|
|
816
839
|
});
|
|
817
840
|
}
|
|
@@ -34,10 +34,8 @@ export declare class MongoRepository {
|
|
|
34
34
|
static CREATE_MONGO_CONDITIONS(params: factory.seller.ISearchConditions): any[];
|
|
35
35
|
/**
|
|
36
36
|
* 特定販売者検索
|
|
37
|
+
* searchに置き換え(2023-07-13~)
|
|
37
38
|
*/
|
|
38
|
-
findById(conditions: {
|
|
39
|
-
id: string;
|
|
40
|
-
}, inclusion: string[], exclusion: string[]): Promise<ISeller>;
|
|
41
39
|
/**
|
|
42
40
|
* 販売者を保管する
|
|
43
41
|
*/
|
|
@@ -73,6 +71,9 @@ export declare class MongoRepository {
|
|
|
73
71
|
* 販売者を削除する
|
|
74
72
|
*/
|
|
75
73
|
deleteById(params: {
|
|
74
|
+
project: {
|
|
75
|
+
id: string;
|
|
76
|
+
};
|
|
76
77
|
id: string;
|
|
77
78
|
}): Promise<void>;
|
|
78
79
|
/**
|
|
@@ -128,37 +128,39 @@ class MongoRepository {
|
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
130
|
* 特定販売者検索
|
|
131
|
+
* searchに置き換え(2023-07-13~)
|
|
131
132
|
*/
|
|
132
|
-
findById(
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
133
|
+
// public async findById(
|
|
134
|
+
// conditions: {
|
|
135
|
+
// id: string;
|
|
136
|
+
// },
|
|
137
|
+
// inclusion: string[],
|
|
138
|
+
// exclusion: string[]
|
|
139
|
+
// ): Promise<ISeller> {
|
|
140
|
+
// let projection: { [key: string]: number } = {};
|
|
141
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
142
|
+
// inclusion.forEach((field) => {
|
|
143
|
+
// projection[field] = 1;
|
|
144
|
+
// });
|
|
145
|
+
// } else {
|
|
146
|
+
// projection = {
|
|
147
|
+
// __v: 0,
|
|
148
|
+
// createdAt: 0,
|
|
149
|
+
// updatedAt: 0
|
|
150
|
+
// };
|
|
151
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
152
|
+
// exclusion.forEach((field) => {
|
|
153
|
+
// projection[field] = 0;
|
|
154
|
+
// });
|
|
155
|
+
// }
|
|
156
|
+
// }
|
|
157
|
+
// const doc = await this.organizationModel.findOne({ _id: conditions.id }, projection)
|
|
158
|
+
// .exec();
|
|
159
|
+
// if (doc === null) {
|
|
160
|
+
// throw new factory.errors.NotFound(this.organizationModel.modelName);
|
|
161
|
+
// }
|
|
162
|
+
// return doc.toObject();
|
|
163
|
+
// }
|
|
162
164
|
/**
|
|
163
165
|
* 販売者を保管する
|
|
164
166
|
*/
|
|
@@ -172,7 +174,10 @@ class MongoRepository {
|
|
|
172
174
|
else {
|
|
173
175
|
// 上書き禁止属性を除外(2022-08-24~)
|
|
174
176
|
const _a = params.attributes, { id, branchCode, project, typeOf } = _a, updateFields = __rest(_a, ["id", "branchCode", "project", "typeOf"]);
|
|
175
|
-
const doc = yield this.organizationModel.findOneAndUpdate({
|
|
177
|
+
const doc = yield this.organizationModel.findOneAndUpdate({
|
|
178
|
+
_id: params.id,
|
|
179
|
+
'project.id': { $eq: project.id }
|
|
180
|
+
}, updateFields, { upsert: false, new: true })
|
|
176
181
|
.exec();
|
|
177
182
|
if (doc === null) {
|
|
178
183
|
throw new factory.errors.NotFound(this.organizationModel.modelName);
|
|
@@ -182,12 +187,6 @@ class MongoRepository {
|
|
|
182
187
|
return organization;
|
|
183
188
|
});
|
|
184
189
|
}
|
|
185
|
-
// public async count(params: factory.seller.ISearchConditions): Promise<number> {
|
|
186
|
-
// const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
187
|
-
// return this.organizationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
188
|
-
// .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
189
|
-
// .exec();
|
|
190
|
-
// }
|
|
191
190
|
/**
|
|
192
191
|
* 販売者検索
|
|
193
192
|
*/
|
|
@@ -270,7 +269,10 @@ class MongoRepository {
|
|
|
270
269
|
*/
|
|
271
270
|
deleteById(params) {
|
|
272
271
|
return __awaiter(this, void 0, void 0, function* () {
|
|
273
|
-
yield this.organizationModel.findOneAndRemove({
|
|
272
|
+
yield this.organizationModel.findOneAndRemove({
|
|
273
|
+
_id: params.id,
|
|
274
|
+
'project.id': { $eq: params.project.id }
|
|
275
|
+
})
|
|
274
276
|
.exec();
|
|
275
277
|
});
|
|
276
278
|
}
|
|
@@ -28,7 +28,15 @@ function validateAccount(params) {
|
|
|
28
28
|
if (typeof sellerId !== 'string') {
|
|
29
29
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const sellers = yield repos.seller.search({
|
|
32
|
+
limit: 1,
|
|
33
|
+
page: 1,
|
|
34
|
+
id: { $eq: sellerId }
|
|
35
|
+
}, ['paymentAccepted'], []);
|
|
36
|
+
const seller = sellers.shift();
|
|
37
|
+
if (seller === undefined) {
|
|
38
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
39
|
+
}
|
|
32
40
|
const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
|
|
33
41
|
if (paymentAccepted !== true) {
|
|
34
42
|
throw new factory.errors.Argument('recipient', `payment not accepted`);
|
|
@@ -210,7 +210,15 @@ function validateSeller(params) {
|
|
|
210
210
|
if (typeof sellerId !== 'string') {
|
|
211
211
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
212
212
|
}
|
|
213
|
-
const
|
|
213
|
+
const sellers = yield repos.seller.search({
|
|
214
|
+
limit: 1,
|
|
215
|
+
page: 1,
|
|
216
|
+
id: { $eq: sellerId }
|
|
217
|
+
}, ['paymentAccepted'], []);
|
|
218
|
+
const seller = sellers.shift();
|
|
219
|
+
if (seller === undefined) {
|
|
220
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
221
|
+
}
|
|
214
222
|
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.typeOf;
|
|
215
223
|
if (typeof paymentMethodType !== 'string') {
|
|
216
224
|
throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
@@ -379,16 +379,6 @@ function cancelDeletedEvents(params) {
|
|
|
379
379
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
380
380
|
// distinctでidのみ取得(2023-01-25~)
|
|
381
381
|
// COAから削除されたイベントをキャンセル済ステータスへ変更
|
|
382
|
-
// const ids = await repos.event.search<factory.eventType.ScreeningEvent>({
|
|
383
|
-
// project: { id: { $eq: params.project.id } },
|
|
384
|
-
// typeOf: factory.eventType.ScreeningEvent,
|
|
385
|
-
// superEvent: {
|
|
386
|
-
// locationBranchCodes: [params.locationBranchCode]
|
|
387
|
-
// },
|
|
388
|
-
// startFrom: params.targetImportFrom,
|
|
389
|
-
// startThrough: params.targetImportThrough
|
|
390
|
-
// })
|
|
391
|
-
// .then((events) => events.map((e) => e.id));
|
|
392
382
|
const ids = yield repos.event.searchIds({
|
|
393
383
|
project: { id: { $eq: params.project.id } },
|
|
394
384
|
typeOf: factory.eventType.ScreeningEvent,
|
|
@@ -403,7 +393,10 @@ function cancelDeletedEvents(params) {
|
|
|
403
393
|
debug(`cancelling ${cancelledIds.length} events...`);
|
|
404
394
|
for (const cancelledId of cancelledIds) {
|
|
405
395
|
try {
|
|
406
|
-
yield repos.event.cancel({
|
|
396
|
+
yield repos.event.cancel({
|
|
397
|
+
id: cancelledId,
|
|
398
|
+
project: { id: params.project.id }
|
|
399
|
+
});
|
|
407
400
|
}
|
|
408
401
|
catch (error) {
|
|
409
402
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -53,7 +53,21 @@ function searchEventTicketOffersByEvent(params) {
|
|
|
53
53
|
let videoFormatTypes = [];
|
|
54
54
|
if (event.typeOf === factory.eventType.ScreeningEvent) {
|
|
55
55
|
// 取得属性最適化(2023-01-25~)
|
|
56
|
-
const superEvent
|
|
56
|
+
// const superEvent: Pick<factory.event.IEvent<factory.eventType.ScreeningEventSeries>, 'soundFormat' | 'videoFormat'> =
|
|
57
|
+
// await repos.event.findById<factory.eventType.ScreeningEventSeries>(
|
|
58
|
+
// { id: event.superEvent.id },
|
|
59
|
+
// { soundFormat: 1, videoFormat: 1 }
|
|
60
|
+
// );
|
|
61
|
+
const superEvents = yield repos.event.search({
|
|
62
|
+
limit: 1,
|
|
63
|
+
page: 1,
|
|
64
|
+
id: { $eq: event.superEvent.id },
|
|
65
|
+
typeOf: factory.eventType.ScreeningEventSeries
|
|
66
|
+
}, { soundFormat: 1, videoFormat: 1 });
|
|
67
|
+
const superEvent = superEvents.shift();
|
|
68
|
+
if (superEvent === undefined) {
|
|
69
|
+
throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
70
|
+
}
|
|
57
71
|
soundFormatTypes = (Array.isArray(superEvent.soundFormat)) ? superEvent.soundFormat.map((f) => f.typeOf) : [];
|
|
58
72
|
videoFormatTypes = (Array.isArray(superEvent.videoFormat)) ? superEvent.videoFormat.map((f) => f.typeOf) : [];
|
|
59
73
|
}
|
|
@@ -521,7 +521,15 @@ function processChangeTransaction(params) {
|
|
|
521
521
|
function getGMOInfoFromSeller(params) {
|
|
522
522
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
523
523
|
var _a, _b, _c, _d;
|
|
524
|
-
const
|
|
524
|
+
const sellers = yield repos.seller.search({
|
|
525
|
+
limit: 1,
|
|
526
|
+
page: 1,
|
|
527
|
+
id: { $eq: String(params.seller.id) }
|
|
528
|
+
}, ['paymentAccepted', 'project'], []);
|
|
529
|
+
const seller = sellers.shift();
|
|
530
|
+
if (seller === undefined) {
|
|
531
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
532
|
+
}
|
|
525
533
|
const paymentAccepted = (_a = seller.paymentAccepted) === null || _a === void 0 ? void 0 : _a.some((a) => a.paymentMethodType === params.paymentMethodType);
|
|
526
534
|
if (paymentAccepted !== true) {
|
|
527
535
|
throw new factory.errors.Argument('transaction', 'payment not accepted');
|
|
@@ -52,7 +52,15 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
|
|
|
52
52
|
if (typeof sellerId !== 'string') {
|
|
53
53
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
54
54
|
}
|
|
55
|
-
const
|
|
55
|
+
const sellers = yield repos.seller.search({
|
|
56
|
+
limit: 1,
|
|
57
|
+
page: 1,
|
|
58
|
+
id: { $eq: sellerId }
|
|
59
|
+
}, ['paymentAccepted', 'project'], []);
|
|
60
|
+
const seller = sellers.shift();
|
|
61
|
+
if (seller === undefined) {
|
|
62
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
63
|
+
}
|
|
56
64
|
const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
|
|
57
65
|
if (paymentAccepted !== true) {
|
|
58
66
|
throw new factory.errors.Argument('recipient', 'payment not accepted');
|
|
@@ -27,6 +27,7 @@ const onRefund_1 = require("./any/onRefund");
|
|
|
27
27
|
/**
|
|
28
28
|
* MovieTicket認証
|
|
29
29
|
*/
|
|
30
|
+
// tslint:disable-next-line:max-func-body-length
|
|
30
31
|
function checkMovieTicket(params) {
|
|
31
32
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
32
33
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -58,7 +59,15 @@ function checkMovieTicket(params) {
|
|
|
58
59
|
id: eventIds[0]
|
|
59
60
|
});
|
|
60
61
|
// ショップ情報取得
|
|
61
|
-
const
|
|
62
|
+
const sellers = yield repos.seller.search({
|
|
63
|
+
limit: 1,
|
|
64
|
+
page: 1,
|
|
65
|
+
id: { $eq: (_e = params.object[0]) === null || _e === void 0 ? void 0 : _e.seller.id }
|
|
66
|
+
}, ['paymentAccepted', 'project'], []);
|
|
67
|
+
const seller = sellers.shift();
|
|
68
|
+
if (seller === undefined) {
|
|
69
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
70
|
+
}
|
|
62
71
|
const paymentAccepted = (_f = seller.paymentAccepted) === null || _f === void 0 ? void 0 : _f.some((a) => a.paymentMethodType === paymentMethodType);
|
|
63
72
|
if (paymentAccepted !== true) {
|
|
64
73
|
throw new factory.errors.Argument('transactionId', 'payment not accepted');
|
|
@@ -302,7 +311,15 @@ function payActionParams2seatInfoSyncIn(params) {
|
|
|
302
311
|
// イベント取得属性最適化(2023-01-23~)
|
|
303
312
|
// const event = await repos.event.findById<factory.eventType.ScreeningEvent>({ id: eventIds[0] });
|
|
304
313
|
const event = yield repos.event.findMinimizedIndividualEventById({ id: eventIds[0] });
|
|
305
|
-
const
|
|
314
|
+
const sellers = yield repos.seller.search({
|
|
315
|
+
limit: 1,
|
|
316
|
+
page: 1,
|
|
317
|
+
id: { $eq: String((_d = params.recipient) === null || _d === void 0 ? void 0 : _d.id) }
|
|
318
|
+
}, ['paymentAccepted', 'project'], []);
|
|
319
|
+
const seller = sellers.shift();
|
|
320
|
+
if (seller === undefined) {
|
|
321
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
322
|
+
}
|
|
306
323
|
// 全購入管理番号のMovieTicketをマージ
|
|
307
324
|
const movieTickets = params.object.reduce((a, b) => [...a, ...(Array.isArray(b.movieTickets)) ? b.movieTickets : []], []);
|
|
308
325
|
const sellerCredentials = yield (0, getCredentials_1.getCredentials)({ paymentMethodType, seller, paymentServiceId })(repos);
|
|
@@ -28,7 +28,15 @@ const CodeService = require("../code");
|
|
|
28
28
|
*/
|
|
29
29
|
function start(params) {
|
|
30
30
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const
|
|
31
|
+
const sellers = yield repos.seller.search({
|
|
32
|
+
limit: 1,
|
|
33
|
+
page: 1,
|
|
34
|
+
id: { $eq: params.seller.id }
|
|
35
|
+
}, ['name', 'typeOf'], []);
|
|
36
|
+
const seller = sellers.shift();
|
|
37
|
+
if (seller === undefined) {
|
|
38
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
39
|
+
}
|
|
32
40
|
const passport = yield (0, validation_1.validateWaiterPassport)(params);
|
|
33
41
|
// 金額をfix
|
|
34
42
|
const amount = params.object.amount;
|
|
@@ -29,12 +29,15 @@ exports.POINT_AWARD_IDENTIFIER_NAME = 'pointAwardIdentifiers';
|
|
|
29
29
|
function start(params) {
|
|
30
30
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
var _a;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
32
|
+
const sellers = yield repos.seller.search({
|
|
33
|
+
limit: 1,
|
|
34
|
+
page: 1,
|
|
35
|
+
id: { $eq: params.seller.id }
|
|
36
|
+
}, ['name', 'project', 'typeOf', 'makesOffer'], []);
|
|
37
|
+
const seller = sellers.shift();
|
|
38
|
+
if (seller === undefined) {
|
|
39
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
40
|
+
}
|
|
38
41
|
let makesOfferFromClient;
|
|
39
42
|
// 販売者オファー検証(2022-10-14~)
|
|
40
43
|
if (params.validateSeller === true) {
|
|
@@ -29,9 +29,15 @@ function start(params) {
|
|
|
29
29
|
const now = new Date();
|
|
30
30
|
const { acceptedOffers, eventIds, offerIds, orders } = yield fixOrders(params)(repos);
|
|
31
31
|
// sellerはorderから自動取得
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const sellers = yield repos.seller.search({
|
|
33
|
+
limit: 1,
|
|
34
|
+
page: 1,
|
|
35
|
+
id: { $eq: String(orders[0].seller.id) }
|
|
36
|
+
}, ['name', 'project', 'hasMerchantReturnPolicy', 'typeOf'], []);
|
|
37
|
+
const seller = sellers.shift();
|
|
38
|
+
if (seller === undefined) {
|
|
39
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
40
|
+
}
|
|
35
41
|
yield validateOrder({ orders })(repos);
|
|
36
42
|
let offers = [];
|
|
37
43
|
if (offerIds.length > 0) {
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.315.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.160.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.315.0-alpha.1",
|
|
13
|
+
"@cinerino/sdk": "3.160.0-alpha.3",
|
|
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.9"
|
|
121
121
|
}
|
|
@@ -1,75 +0,0 @@
|
|
|
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 EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
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 cursor = eventRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
// 'project.id': { $eq: project.id },
|
|
19
|
-
'project.id': { $ne: EXCLUDED_PROJECT_ID },
|
|
20
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
21
|
-
startDate: {
|
|
22
|
-
$gte: moment()
|
|
23
|
-
.add(-1, 'month')
|
|
24
|
-
.toDate()
|
|
25
|
-
}
|
|
26
|
-
// _id: { $eq: 'al6aff83w' }
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
// _id: 1,
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
console.log('events found');
|
|
33
|
-
|
|
34
|
-
let i = 0;
|
|
35
|
-
let updateCount = 0;
|
|
36
|
-
await cursor.eachAsync(async (doc) => {
|
|
37
|
-
i += 1;
|
|
38
|
-
const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
|
|
39
|
-
|
|
40
|
-
// IAMメンバー検索
|
|
41
|
-
const eventOffers = <chevre.factory.event.screeningEvent.IOffer | undefined>event.offers;
|
|
42
|
-
if (eventOffers === undefined) {
|
|
43
|
-
throw new Error('event.offers undefined');
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const itemOfferedTypeOf = eventOffers.itemOffered.typeOf;
|
|
47
|
-
|
|
48
|
-
const alreadyMigrated = itemOfferedTypeOf === chevre.factory.product.ProductType.EventService;
|
|
49
|
-
|
|
50
|
-
if (alreadyMigrated) {
|
|
51
|
-
console.log(
|
|
52
|
-
'already exist...', event.project.id, event.id, event.startDate, itemOfferedTypeOf, i);
|
|
53
|
-
} else {
|
|
54
|
-
console.log(
|
|
55
|
-
'updating seller...', event.project.id, event.id, event.startDate, i);
|
|
56
|
-
await eventRepo.updatePartiallyById({
|
|
57
|
-
id: event.id,
|
|
58
|
-
attributes: <any>{
|
|
59
|
-
typeOf: event.typeOf,
|
|
60
|
-
'offers.itemOffered.typeOf': chevre.factory.product.ProductType.EventService
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
updateCount += 1;
|
|
64
|
-
console.log(
|
|
65
|
-
'updated...', event.project.id, event.id, event.startDate, i);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
console.log(i, 'events checked');
|
|
70
|
-
console.log(updateCount, 'events updated');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
main()
|
|
74
|
-
.then()
|
|
75
|
-
.catch(console.error);
|
|
@@ -1,64 +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
|
-
const DELETING_PROPERTY_NAME: string = 'COA_ENDPOINT';
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
-
|
|
12
|
-
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const cursor = eventRepo.getCursor(
|
|
15
|
-
{
|
|
16
|
-
'project.id': { $eq: project.id },
|
|
17
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries }
|
|
18
|
-
// typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
19
|
-
// startDate: { $gte: new Date() }
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
// _id: 1,
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
console.log('events found');
|
|
26
|
-
|
|
27
|
-
let i = 0;
|
|
28
|
-
let updateCount = 0;
|
|
29
|
-
await cursor.eachAsync(async (doc) => {
|
|
30
|
-
i += 1;
|
|
31
|
-
const event: chevre.factory.event.IEvent<chevre.factory.eventType> = doc.toObject();
|
|
32
|
-
|
|
33
|
-
const coaEndpointPropert = event.additionalProperty?.find((p) => p.name === DELETING_PROPERTY_NAME);
|
|
34
|
-
|
|
35
|
-
if (coaEndpointPropert !== undefined) {
|
|
36
|
-
const newAdditionalProperty: chevre.factory.propertyValue.IPropertyValue<string>[] =
|
|
37
|
-
(Array.isArray(event.additionalProperty))
|
|
38
|
-
? event.additionalProperty.filter((p) => {
|
|
39
|
-
return p.name !== DELETING_PROPERTY_NAME;
|
|
40
|
-
})
|
|
41
|
-
: [];
|
|
42
|
-
console.log(
|
|
43
|
-
'updating event...', event.project.id, event.id, event.startDate, coaEndpointPropert.value, newAdditionalProperty, i);
|
|
44
|
-
await eventRepo.updatePartiallyById({
|
|
45
|
-
id: event.id,
|
|
46
|
-
attributes: <any>{
|
|
47
|
-
typeOf: event.typeOf,
|
|
48
|
-
additionalProperty: newAdditionalProperty
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
updateCount += 1;
|
|
52
|
-
console.log('event updated', event.project.id, event.id, event.startDate, i);
|
|
53
|
-
} else {
|
|
54
|
-
console.log('no property...', event.project.id, event.id, event.startDate, i);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
console.log(i, 'events checked');
|
|
59
|
-
console.log(updateCount, 'events updated');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
main()
|
|
63
|
-
.then()
|
|
64
|
-
.catch(console.error);
|
|
@@ -1,79 +0,0 @@
|
|
|
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 = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
|
|
8
|
-
|
|
9
|
-
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
10
|
-
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = eventRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
'project.id': {
|
|
19
|
-
// $eq: project.id,
|
|
20
|
-
$ne: EXCLUDED_PROJECT_ID
|
|
21
|
-
},
|
|
22
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries },
|
|
23
|
-
'workPerformed.version': { $exists: false }
|
|
24
|
-
// _id: { $eq: 'bl7ed6sq9' }
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
_id: 1,
|
|
28
|
-
workPerformed: 1,
|
|
29
|
-
project: 1,
|
|
30
|
-
location: 1,
|
|
31
|
-
startDate: 1,
|
|
32
|
-
typeOf: 1
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
console.log('events found');
|
|
36
|
-
|
|
37
|
-
let i = 0;
|
|
38
|
-
let updateCount = 0;
|
|
39
|
-
await cursor.eachAsync(async (doc) => {
|
|
40
|
-
i += 1;
|
|
41
|
-
const event: chevre.factory.event.screeningEventSeries.IEvent = doc.toObject();
|
|
42
|
-
const version = event.workPerformed.version;
|
|
43
|
-
|
|
44
|
-
const alreadyMigrated = typeof version === 'string' && version.length > 0;
|
|
45
|
-
|
|
46
|
-
if (alreadyMigrated) {
|
|
47
|
-
console.log('alreadyMigrated.', event.project.id, event.id, event.startDate, version, i);
|
|
48
|
-
} else {
|
|
49
|
-
// 既存施設コンテンツバージョンを検索
|
|
50
|
-
const { maxVersion } = await eventRepo.aggregateScreeningEventMaxVersion({
|
|
51
|
-
project: { id: { $eq: event.project.id } },
|
|
52
|
-
workPerformed: { identifier: { $eq: event.workPerformed.identifier } },
|
|
53
|
-
location: { branchCode: { $in: [event.location.branchCode] } }
|
|
54
|
-
});
|
|
55
|
-
console.log('maxVersion:', maxVersion);
|
|
56
|
-
|
|
57
|
-
const newVersion: string = `${Number(maxVersion) + 1}`;
|
|
58
|
-
console.log('updating event...', event.project.id, event.id, event.startDate, newVersion, i);
|
|
59
|
-
await eventRepo.updatePartiallyById({
|
|
60
|
-
id: event.id,
|
|
61
|
-
attributes: <any>{
|
|
62
|
-
typeOf: event.typeOf,
|
|
63
|
-
'workPerformed.version': newVersion
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
updateCount += 1;
|
|
67
|
-
console.log('updated.', event.project.id, event.id, event.startDate, newVersion, i);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
console.log(i, 'events checked');
|
|
72
|
-
console.log(updateCount, 'events updated');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
main()
|
|
76
|
-
.then(() => {
|
|
77
|
-
console.log('success!');
|
|
78
|
-
})
|
|
79
|
-
.catch(console.error);
|