@chevre/domain 21.2.0-alpha.116 → 21.2.0-alpha.118
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/lib/chevre/repo/event.js
CHANGED
|
@@ -51,7 +51,7 @@ 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;
|
|
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;
|
|
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') {
|
|
@@ -116,18 +116,15 @@ class MongoRepository {
|
|
|
116
116
|
}
|
|
117
117
|
const locationBranchCodeEq = (_e = (_d = conditions.location) === null || _d === void 0 ? void 0 : _d.branchCode) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
118
118
|
if (typeof locationBranchCodeEq === 'string') {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
$eq: locationBranchCodeEq
|
|
125
|
-
}
|
|
126
|
-
});
|
|
119
|
+
andConditions.push({ 'location.branchCode': { $exists: true, $eq: locationBranchCodeEq } });
|
|
120
|
+
}
|
|
121
|
+
const locationBranchCodeIn = (_g = (_f = conditions.location) === null || _f === void 0 ? void 0 : _f.branchCode) === null || _g === void 0 ? void 0 : _g.$in;
|
|
122
|
+
if (Array.isArray(locationBranchCodeIn)) {
|
|
123
|
+
andConditions.push({ 'location.branchCode': { $exists: true, $in: locationBranchCodeIn } });
|
|
127
124
|
}
|
|
128
125
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
129
126
|
/* istanbul ignore else */
|
|
130
|
-
const hasOfferCatalogIdEq = (
|
|
127
|
+
const hasOfferCatalogIdEq = (_j = (_h = conditions.hasOfferCatalog) === null || _h === void 0 ? void 0 : _h.id) === null || _j === void 0 ? void 0 : _j.$eq;
|
|
131
128
|
if (typeof hasOfferCatalogIdEq === 'string') {
|
|
132
129
|
andConditions.push({
|
|
133
130
|
'hasOfferCatalog.id': {
|
|
@@ -136,7 +133,7 @@ class MongoRepository {
|
|
|
136
133
|
}
|
|
137
134
|
});
|
|
138
135
|
}
|
|
139
|
-
const additionalPropertyElemMatch = (
|
|
136
|
+
const additionalPropertyElemMatch = (_k = conditions.additionalProperty) === null || _k === void 0 ? void 0 : _k.$elemMatch;
|
|
140
137
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
141
138
|
andConditions.push({
|
|
142
139
|
additionalProperty: {
|
|
@@ -152,7 +149,7 @@ class MongoRepository {
|
|
|
152
149
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
153
150
|
/* istanbul ignore else */
|
|
154
151
|
if (params.offers !== undefined) {
|
|
155
|
-
const itemOfferedIdIn4event = (
|
|
152
|
+
const itemOfferedIdIn4event = (_m = (_l = params.offers.itemOffered) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$in;
|
|
156
153
|
if (Array.isArray(itemOfferedIdIn4event)) {
|
|
157
154
|
andConditions.push({
|
|
158
155
|
'offers.itemOffered.id': {
|
|
@@ -202,8 +199,8 @@ class MongoRepository {
|
|
|
202
199
|
}
|
|
203
200
|
}
|
|
204
201
|
}
|
|
205
|
-
const sellerMakesOfferElemMatch4event = (
|
|
206
|
-
if (typeof ((
|
|
202
|
+
const sellerMakesOfferElemMatch4event = (_q = (_p = (_o = params.offers) === null || _o === void 0 ? void 0 : _o.seller) === null || _p === void 0 ? void 0 : _p.makesOffer) === null || _q === void 0 ? void 0 : _q.$elemMatch;
|
|
203
|
+
if (typeof ((_r = sellerMakesOfferElemMatch4event === null || sellerMakesOfferElemMatch4event === void 0 ? void 0 : sellerMakesOfferElemMatch4event['availableAtOrFrom.id']) === null || _r === void 0 ? void 0 : _r.$eq) === 'string') {
|
|
207
204
|
andConditions.push({
|
|
208
205
|
'offers.seller.makesOffer': {
|
|
209
206
|
$exists: true,
|
|
@@ -211,7 +208,7 @@ class MongoRepository {
|
|
|
211
208
|
}
|
|
212
209
|
});
|
|
213
210
|
}
|
|
214
|
-
const reservationForIdentifierEq = (
|
|
211
|
+
const reservationForIdentifierEq = (_w = (_v = (_u = (_t = (_s = params.offers) === null || _s === void 0 ? void 0 : _s.itemOffered) === null || _t === void 0 ? void 0 : _t.serviceOutput) === null || _u === void 0 ? void 0 : _u.reservationFor) === null || _v === void 0 ? void 0 : _v.identifier) === null || _w === void 0 ? void 0 : _w.$eq;
|
|
215
212
|
if (typeof reservationForIdentifierEq === 'string') {
|
|
216
213
|
andConditions.push({
|
|
217
214
|
'offers.itemOffered.serviceOutput.reservationFor.identifier': {
|
|
@@ -220,7 +217,7 @@ class MongoRepository {
|
|
|
220
217
|
}
|
|
221
218
|
});
|
|
222
219
|
}
|
|
223
|
-
const reservationForArrivalBusStopBranchCodeEq = (
|
|
220
|
+
const reservationForArrivalBusStopBranchCodeEq = (_2 = (_1 = (_0 = (_z = (_y = (_x = params.offers) === null || _x === void 0 ? void 0 : _x.itemOffered) === null || _y === void 0 ? void 0 : _y.serviceOutput) === null || _z === void 0 ? void 0 : _z.reservationFor) === null || _0 === void 0 ? void 0 : _0.arrivalBusStop) === null || _1 === void 0 ? void 0 : _1.branchCode) === null || _2 === void 0 ? void 0 : _2.$eq;
|
|
224
221
|
if (typeof reservationForArrivalBusStopBranchCodeEq === 'string') {
|
|
225
222
|
andConditions.push({
|
|
226
223
|
'offers.itemOffered.serviceOutput.reservationFor.arrivalBusStop.branchCode': {
|
|
@@ -229,7 +226,7 @@ class MongoRepository {
|
|
|
229
226
|
}
|
|
230
227
|
});
|
|
231
228
|
}
|
|
232
|
-
const reservationForDepartureBusStopBranchCodeEq = (
|
|
229
|
+
const reservationForDepartureBusStopBranchCodeEq = (_8 = (_7 = (_6 = (_5 = (_4 = (_3 = params.offers) === null || _3 === void 0 ? void 0 : _3.itemOffered) === null || _4 === void 0 ? void 0 : _4.serviceOutput) === null || _5 === void 0 ? void 0 : _5.reservationFor) === null || _6 === void 0 ? void 0 : _6.departureBusStop) === null || _7 === void 0 ? void 0 : _7.branchCode) === null || _8 === void 0 ? void 0 : _8.$eq;
|
|
233
230
|
if (typeof reservationForDepartureBusStopBranchCodeEq === 'string') {
|
|
234
231
|
andConditions.push({
|
|
235
232
|
'offers.itemOffered.serviceOutput.reservationFor.departureBusStop.branchCode': {
|
|
@@ -263,7 +260,7 @@ class MongoRepository {
|
|
|
263
260
|
}
|
|
264
261
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
265
262
|
/* istanbul ignore else */
|
|
266
|
-
const superEventLocationIdEq = (
|
|
263
|
+
const superEventLocationIdEq = (_11 = (_10 = (_9 = params.superEvent) === null || _9 === void 0 ? void 0 : _9.location) === null || _10 === void 0 ? void 0 : _10.id) === null || _11 === void 0 ? void 0 : _11.$eq;
|
|
267
264
|
if (typeof superEventLocationIdEq === 'string') {
|
|
268
265
|
andConditions.push({
|
|
269
266
|
'superEvent.location.id': {
|
|
@@ -306,7 +303,7 @@ class MongoRepository {
|
|
|
306
303
|
});
|
|
307
304
|
}
|
|
308
305
|
}
|
|
309
|
-
const itemOfferedIdIn = (
|
|
306
|
+
const itemOfferedIdIn = (_14 = (_13 = (_12 = params.offers) === null || _12 === void 0 ? void 0 : _12.itemOffered) === null || _13 === void 0 ? void 0 : _13.id) === null || _14 === void 0 ? void 0 : _14.$in;
|
|
310
307
|
if (Array.isArray(itemOfferedIdIn)) {
|
|
311
308
|
andConditions.push({
|
|
312
309
|
'offers.itemOffered.id': {
|
|
@@ -315,7 +312,7 @@ class MongoRepository {
|
|
|
315
312
|
}
|
|
316
313
|
});
|
|
317
314
|
}
|
|
318
|
-
const itemOfferedTicketedSeatTypeOfIn = (
|
|
315
|
+
const itemOfferedTicketedSeatTypeOfIn = (_19 = (_18 = (_17 = (_16 = (_15 = params.offers) === null || _15 === void 0 ? void 0 : _15.itemOffered) === null || _16 === void 0 ? void 0 : _16.serviceOutput) === null || _17 === void 0 ? void 0 : _17.reservedTicket) === null || _18 === void 0 ? void 0 : _18.ticketedSeat) === null || _19 === void 0 ? void 0 : _19.typeOfs;
|
|
319
316
|
if (Array.isArray(itemOfferedTicketedSeatTypeOfIn)) {
|
|
320
317
|
andConditions.push({
|
|
321
318
|
'offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOf': {
|
|
@@ -324,7 +321,7 @@ class MongoRepository {
|
|
|
324
321
|
}
|
|
325
322
|
});
|
|
326
323
|
}
|
|
327
|
-
const itemOfferedServiceTypeIdIn = (
|
|
324
|
+
const itemOfferedServiceTypeIdIn = (_22 = (_21 = (_20 = params.offers) === null || _20 === void 0 ? void 0 : _20.itemOffered) === null || _21 === void 0 ? void 0 : _21.serviceType) === null || _22 === void 0 ? void 0 : _22.ids;
|
|
328
325
|
if (Array.isArray(itemOfferedServiceTypeIdIn)) {
|
|
329
326
|
andConditions.push({
|
|
330
327
|
'offers.itemOffered.serviceType.id': {
|
|
@@ -333,8 +330,8 @@ class MongoRepository {
|
|
|
333
330
|
}
|
|
334
331
|
});
|
|
335
332
|
}
|
|
336
|
-
const sellerMakesOfferElemMatch = (
|
|
337
|
-
if (typeof ((
|
|
333
|
+
const sellerMakesOfferElemMatch = (_25 = (_24 = (_23 = params.offers) === null || _23 === void 0 ? void 0 : _23.seller) === null || _24 === void 0 ? void 0 : _24.makesOffer) === null || _25 === void 0 ? void 0 : _25.$elemMatch;
|
|
334
|
+
if (typeof ((_26 = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _26 === void 0 ? void 0 : _26.$eq) === 'string') {
|
|
338
335
|
andConditions.push({
|
|
339
336
|
'offers.seller.makesOffer': {
|
|
340
337
|
$exists: true,
|
|
@@ -371,7 +368,7 @@ class MongoRepository {
|
|
|
371
368
|
]
|
|
372
369
|
});
|
|
373
370
|
}
|
|
374
|
-
const locationIdEq = (
|
|
371
|
+
const locationIdEq = (_28 = (_27 = params.location) === null || _27 === void 0 ? void 0 : _27.id) === null || _28 === void 0 ? void 0 : _28.$eq;
|
|
375
372
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
376
373
|
/* istanbul ignore else */
|
|
377
374
|
if (typeof locationIdEq === 'string') {
|
|
@@ -393,7 +390,7 @@ class MongoRepository {
|
|
|
393
390
|
});
|
|
394
391
|
}
|
|
395
392
|
}
|
|
396
|
-
const workPerformedIdentifierIn = (
|
|
393
|
+
const workPerformedIdentifierIn = (_29 = params.workPerformed) === null || _29 === void 0 ? void 0 : _29.identifiers;
|
|
397
394
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
398
395
|
/* istanbul ignore else */
|
|
399
396
|
if (Array.isArray(workPerformedIdentifierIn)) {
|
|
@@ -401,13 +398,13 @@ class MongoRepository {
|
|
|
401
398
|
'workPerformed.identifier': { $exists: true, $in: workPerformedIdentifierIn }
|
|
402
399
|
});
|
|
403
400
|
}
|
|
404
|
-
const workPerformedVersionEq = (
|
|
401
|
+
const workPerformedVersionEq = (_31 = (_30 = params.workPerformed) === null || _30 === void 0 ? void 0 : _30.version) === null || _31 === void 0 ? void 0 : _31.$eq;
|
|
405
402
|
if (typeof workPerformedVersionEq === 'string') {
|
|
406
403
|
andConditions.push({
|
|
407
404
|
'workPerformed.version': { $exists: true, $eq: workPerformedVersionEq }
|
|
408
405
|
});
|
|
409
406
|
}
|
|
410
|
-
const videoFormatTypeOfEq = (
|
|
407
|
+
const videoFormatTypeOfEq = (_33 = (_32 = params.videoFormat) === null || _32 === void 0 ? void 0 : _32.typeOf) === null || _33 === void 0 ? void 0 : _33.$eq;
|
|
411
408
|
if (typeof videoFormatTypeOfEq === 'string') {
|
|
412
409
|
andConditions.push({
|
|
413
410
|
'videoFormat.typeOf': {
|
|
@@ -416,7 +413,7 @@ class MongoRepository {
|
|
|
416
413
|
}
|
|
417
414
|
});
|
|
418
415
|
}
|
|
419
|
-
const videoFormatTypeOfIn = (
|
|
416
|
+
const videoFormatTypeOfIn = (_35 = (_34 = params.videoFormat) === null || _34 === void 0 ? void 0 : _34.typeOf) === null || _35 === void 0 ? void 0 : _35.$in;
|
|
420
417
|
if (Array.isArray(videoFormatTypeOfIn)) {
|
|
421
418
|
andConditions.push({
|
|
422
419
|
'videoFormat.typeOf': {
|
|
@@ -425,7 +422,7 @@ class MongoRepository {
|
|
|
425
422
|
}
|
|
426
423
|
});
|
|
427
424
|
}
|
|
428
|
-
const soundFormatTypeOfEq = (
|
|
425
|
+
const soundFormatTypeOfEq = (_37 = (_36 = params.soundFormat) === null || _36 === void 0 ? void 0 : _36.typeOf) === null || _37 === void 0 ? void 0 : _37.$eq;
|
|
429
426
|
if (typeof soundFormatTypeOfEq === 'string') {
|
|
430
427
|
andConditions.push({
|
|
431
428
|
'soundFormat.typeOf': {
|
|
@@ -434,7 +431,7 @@ class MongoRepository {
|
|
|
434
431
|
}
|
|
435
432
|
});
|
|
436
433
|
}
|
|
437
|
-
const soundFormatTypeOfIn = (
|
|
434
|
+
const soundFormatTypeOfIn = (_39 = (_38 = params.soundFormat) === null || _38 === void 0 ? void 0 : _38.typeOf) === null || _39 === void 0 ? void 0 : _39.$in;
|
|
438
435
|
if (Array.isArray(soundFormatTypeOfIn)) {
|
|
439
436
|
andConditions.push({
|
|
440
437
|
'soundFormat.typeOf': {
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -696,7 +696,7 @@ class MongoRepository {
|
|
|
696
696
|
}
|
|
697
697
|
// tslint:disable-next-line:max-func-body-length
|
|
698
698
|
searchScreeningRooms(searchConditions) {
|
|
699
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
699
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
700
700
|
return __awaiter(this, void 0, void 0, function* () {
|
|
701
701
|
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.MovieTheater } } }];
|
|
702
702
|
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -729,20 +729,23 @@ class MongoRepository {
|
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
|
-
|
|
733
|
-
if (
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
$
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
732
|
+
const branchCodeEq = (_e = searchConditions.branchCode) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
733
|
+
if (typeof branchCodeEq === 'string') {
|
|
734
|
+
matchStages.push({
|
|
735
|
+
$match: {
|
|
736
|
+
'containsPlace.branchCode': { $exists: true, $eq: branchCodeEq }
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
const branchCodeIn = (_f = searchConditions.branchCode) === null || _f === void 0 ? void 0 : _f.$in;
|
|
741
|
+
if (Array.isArray(branchCodeIn)) {
|
|
742
|
+
matchStages.push({
|
|
743
|
+
$match: {
|
|
744
|
+
'containsPlace.branchCode': { $exists: true, $in: branchCodeIn }
|
|
745
|
+
}
|
|
746
|
+
});
|
|
744
747
|
}
|
|
745
|
-
const branchCodeRegex = (
|
|
748
|
+
const branchCodeRegex = (_g = searchConditions.branchCode) === null || _g === void 0 ? void 0 : _g.$regex;
|
|
746
749
|
if (typeof branchCodeRegex === 'string') {
|
|
747
750
|
matchStages.push({
|
|
748
751
|
$match: {
|
|
@@ -753,7 +756,7 @@ class MongoRepository {
|
|
|
753
756
|
}
|
|
754
757
|
});
|
|
755
758
|
}
|
|
756
|
-
const nameCodeRegex = (
|
|
759
|
+
const nameCodeRegex = (_h = searchConditions.name) === null || _h === void 0 ? void 0 : _h.$regex;
|
|
757
760
|
if (typeof nameCodeRegex === 'string') {
|
|
758
761
|
matchStages.push({
|
|
759
762
|
$match: {
|
|
@@ -785,7 +788,7 @@ class MongoRepository {
|
|
|
785
788
|
}
|
|
786
789
|
});
|
|
787
790
|
}
|
|
788
|
-
const additionalPropertyElemMatch = (
|
|
791
|
+
const additionalPropertyElemMatch = (_j = searchConditions.additionalProperty) === null || _j === void 0 ? void 0 : _j.$elemMatch;
|
|
789
792
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
790
793
|
matchStages.push({
|
|
791
794
|
$match: {
|
|
@@ -805,7 +808,7 @@ class MongoRepository {
|
|
|
805
808
|
typeOf: '$typeOf',
|
|
806
809
|
branchCode: '$branchCode',
|
|
807
810
|
name: '$name'
|
|
808
|
-
}, openSeatingAllowed: '$containsPlace.openSeatingAllowed', additionalProperty: '$containsPlace.additionalProperty' }, (((
|
|
811
|
+
}, openSeatingAllowed: '$containsPlace.openSeatingAllowed', additionalProperty: '$containsPlace.additionalProperty' }, (((_k = searchConditions.$projection) === null || _k === void 0 ? void 0 : _k.sectionCount) === 1)
|
|
809
812
|
? {
|
|
810
813
|
sectionCount: {
|
|
811
814
|
$cond: {
|
|
@@ -815,7 +818,7 @@ class MongoRepository {
|
|
|
815
818
|
}
|
|
816
819
|
}
|
|
817
820
|
}
|
|
818
|
-
: undefined), (((
|
|
821
|
+
: undefined), (((_l = searchConditions.$projection) === null || _l === void 0 ? void 0 : _l.seatCount) === 1)
|
|
819
822
|
? {
|
|
820
823
|
seatCount: {
|
|
821
824
|
$sum: {
|
|
@@ -133,22 +133,20 @@ class StockHolderRepository {
|
|
|
133
133
|
/**
|
|
134
134
|
* 空席でない座席を検索する
|
|
135
135
|
*/
|
|
136
|
-
findUnavailableOffersByEventId(params) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
});
|
|
151
|
-
}
|
|
136
|
+
// public async findUnavailableOffersByEventId(params: { eventId: string; startDate: Date }): Promise<IOffer[]> {
|
|
137
|
+
// const key = StockHolderRepository.createKey({ eventId: params.eventId, startDate: params.startDate });
|
|
138
|
+
// const reply = await this.redisClient.hGetAll(key);
|
|
139
|
+
// let offers: IOffer[] = [];
|
|
140
|
+
// if (reply !== null) {
|
|
141
|
+
// offers = Object.keys(reply)
|
|
142
|
+
// .map((field) => {
|
|
143
|
+
// const seatSection = field.split(':')[0];
|
|
144
|
+
// const seatNumber = field.split(':')[1];
|
|
145
|
+
// return { seatSection, seatNumber };
|
|
146
|
+
// });
|
|
147
|
+
// }
|
|
148
|
+
// return offers;
|
|
149
|
+
// }
|
|
152
150
|
/**
|
|
153
151
|
* 空席でない座席をカウントする
|
|
154
152
|
*/
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
13
|
const factory = require("../../factory");
|
|
14
|
+
const accountTitle_1 = require("../../repo/accountTitle");
|
|
14
15
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
15
16
|
const creativeWork_1 = require("../../repo/creativeWork");
|
|
16
17
|
const place_1 = require("../../repo/place");
|
|
@@ -24,6 +25,7 @@ const informResources = settings_1.settings.onResourceUpdated.informResource;
|
|
|
24
25
|
function call(data) {
|
|
25
26
|
return (connectionSettings) => __awaiter(this, void 0, void 0, function* () {
|
|
26
27
|
yield onResourceUpdated(data)({
|
|
28
|
+
accountTitle: new accountTitle_1.MongoRepository(connectionSettings.connection),
|
|
27
29
|
categoryCode: new categoryCode_1.MongoRepository(connectionSettings.connection),
|
|
28
30
|
creativeWork: new creativeWork_1.MongoRepository(connectionSettings.connection),
|
|
29
31
|
place: new place_1.MongoRepository(connectionSettings.connection),
|
|
@@ -65,6 +67,13 @@ function onResourceUpdated(params) {
|
|
|
65
67
|
typeOf: params.typeOf
|
|
66
68
|
})(repos);
|
|
67
69
|
break;
|
|
70
|
+
case 'AccountTitle':
|
|
71
|
+
yield createInformAccountTitleTasks({
|
|
72
|
+
project: { id: params.project.id },
|
|
73
|
+
ids: params.id,
|
|
74
|
+
typeOf: params.typeOf
|
|
75
|
+
})(repos);
|
|
76
|
+
break;
|
|
68
77
|
default:
|
|
69
78
|
// no op
|
|
70
79
|
}
|
|
@@ -277,3 +286,67 @@ function createInformMovieTheaterTasks(params) {
|
|
|
277
286
|
}
|
|
278
287
|
});
|
|
279
288
|
}
|
|
289
|
+
function createInformAccountTitleTasks(params) {
|
|
290
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
291
|
+
if (params.ids.length !== 1) {
|
|
292
|
+
throw new factory.errors.Argument('id', 'id.length must be 1');
|
|
293
|
+
}
|
|
294
|
+
const accountTitle = yield repos.accountTitle.accountTitleModel.findOne({
|
|
295
|
+
_id: { $eq: params.ids[0] },
|
|
296
|
+
'project.id': { $eq: params.project.id }
|
|
297
|
+
}, {
|
|
298
|
+
additionalProperty: 1,
|
|
299
|
+
codeValue: 1,
|
|
300
|
+
hasCategoryCode: 1,
|
|
301
|
+
name: 1,
|
|
302
|
+
project: 1,
|
|
303
|
+
typeOf: 1
|
|
304
|
+
})
|
|
305
|
+
.exec()
|
|
306
|
+
.then((doc) => {
|
|
307
|
+
if (doc === null) {
|
|
308
|
+
throw new factory.errors.NotFound(params.typeOf);
|
|
309
|
+
}
|
|
310
|
+
return doc.toObject();
|
|
311
|
+
});
|
|
312
|
+
const accountTitles4inform = [accountTitle];
|
|
313
|
+
if (accountTitles4inform.length > 0) {
|
|
314
|
+
const taskRunsAt = new Date();
|
|
315
|
+
const informTasks = [];
|
|
316
|
+
informResources === null || informResources === void 0 ? void 0 : informResources.forEach((informResource) => {
|
|
317
|
+
var _a;
|
|
318
|
+
const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
|
|
319
|
+
accountTitles4inform.forEach((accountTitle4inform) => {
|
|
320
|
+
var _a;
|
|
321
|
+
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
322
|
+
delete accountTitle4inform._id;
|
|
323
|
+
const informActionAttributes = {
|
|
324
|
+
agent: accountTitle4inform.project,
|
|
325
|
+
object: accountTitle4inform,
|
|
326
|
+
project: accountTitle4inform.project,
|
|
327
|
+
recipient: {
|
|
328
|
+
id: '',
|
|
329
|
+
name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
|
|
330
|
+
typeOf: factory.creativeWorkType.WebApplication,
|
|
331
|
+
url: informUrl
|
|
332
|
+
},
|
|
333
|
+
typeOf: factory.actionType.InformAction
|
|
334
|
+
};
|
|
335
|
+
informTasks.push({
|
|
336
|
+
project: accountTitle4inform.project,
|
|
337
|
+
name: factory.taskName.TriggerWebhook,
|
|
338
|
+
status: factory.taskStatus.Ready,
|
|
339
|
+
runsAt: taskRunsAt,
|
|
340
|
+
remainingNumberOfTries: 10,
|
|
341
|
+
numberOfTried: 0,
|
|
342
|
+
executionResults: [],
|
|
343
|
+
data: informActionAttributes
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
if (informTasks.length > 0) {
|
|
348
|
+
yield repos.task.saveMany(informTasks, { emitImmediately: true });
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
}
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.313.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.157.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.313.0-alpha.38",
|
|
13
|
+
"@cinerino/sdk": "3.157.0-alpha.13",
|
|
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.2.0-alpha.
|
|
120
|
+
"version": "21.2.0-alpha.118"
|
|
121
121
|
}
|