@chevre/domain 20.2.0-alpha.11 → 20.2.0-alpha.12

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.
@@ -34,7 +34,7 @@ class MongoRepository {
34
34
  }
35
35
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
36
36
  static CREATE_MONGO_CONDITIONS(conditions) {
37
- 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;
37
+ 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;
38
38
  const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
39
39
  const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
40
40
  if (typeof projectIdEq === 'string') {
@@ -131,8 +131,96 @@ class MongoRepository {
131
131
  let params;
132
132
  switch (conditions.typeOf) {
133
133
  case factory.eventType.Event:
134
- // no op
135
- // params = conditions;
134
+ params = conditions;
135
+ // tslint:disable-next-line:no-single-line-block-comment
136
+ /* istanbul ignore else */
137
+ if (params.offers !== undefined) {
138
+ const itemOfferedIdIn = (_k = (_j = params.offers.itemOffered) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$in;
139
+ if (Array.isArray(itemOfferedIdIn)) {
140
+ andConditions.push({
141
+ 'offers.itemOffered.id': {
142
+ $exists: true,
143
+ $in: itemOfferedIdIn
144
+ }
145
+ });
146
+ }
147
+ // tslint:disable-next-line:no-single-line-block-comment
148
+ /* istanbul ignore else */
149
+ if (params.offers.itemOffered !== undefined) {
150
+ // tslint:disable-next-line:no-single-line-block-comment
151
+ /* istanbul ignore else */
152
+ if (params.offers.itemOffered.serviceOutput !== undefined) {
153
+ // tslint:disable-next-line:no-single-line-block-comment
154
+ /* istanbul ignore else */
155
+ if (params.offers.itemOffered.serviceOutput.reservedTicket !== undefined) {
156
+ // tslint:disable-next-line:no-single-line-block-comment
157
+ /* istanbul ignore else */
158
+ if (params.offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat !== undefined) {
159
+ // tslint:disable-next-line:no-single-line-block-comment
160
+ /* istanbul ignore else */
161
+ if (Array.isArray(params.offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOfs)) {
162
+ andConditions.push({
163
+ 'offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOf': {
164
+ $exists: true,
165
+ $in: params.offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOfs
166
+ }
167
+ });
168
+ }
169
+ }
170
+ }
171
+ }
172
+ // tslint:disable-next-line:no-single-line-block-comment
173
+ /* istanbul ignore else */
174
+ if (params.offers.itemOffered.serviceType !== undefined) {
175
+ // tslint:disable-next-line:no-single-line-block-comment
176
+ /* istanbul ignore else */
177
+ if (Array.isArray(params.offers.itemOffered.serviceType.ids)) {
178
+ andConditions.push({
179
+ 'offers.itemOffered.serviceType.id': {
180
+ $exists: true,
181
+ $in: params.offers.itemOffered.serviceType.ids
182
+ }
183
+ });
184
+ }
185
+ }
186
+ }
187
+ }
188
+ const sellerMakesOfferElemMatch4event = (_o = (_m = (_l = params.offers) === null || _l === void 0 ? void 0 : _l.seller) === null || _m === void 0 ? void 0 : _m.makesOffer) === null || _o === void 0 ? void 0 : _o.$elemMatch;
189
+ if (typeof ((_p = sellerMakesOfferElemMatch4event === null || sellerMakesOfferElemMatch4event === void 0 ? void 0 : sellerMakesOfferElemMatch4event['availableAtOrFrom.id']) === null || _p === void 0 ? void 0 : _p.$eq) === 'string') {
190
+ andConditions.push({
191
+ 'offers.seller.makesOffer': {
192
+ $exists: true,
193
+ $elemMatch: sellerMakesOfferElemMatch4event
194
+ }
195
+ });
196
+ }
197
+ const reservationForIdentifierEq = (_u = (_t = (_s = (_r = (_q = params.offers) === null || _q === void 0 ? void 0 : _q.itemOffered) === null || _r === void 0 ? void 0 : _r.serviceOutput) === null || _s === void 0 ? void 0 : _s.reservationFor) === null || _t === void 0 ? void 0 : _t.identifier) === null || _u === void 0 ? void 0 : _u.$eq;
198
+ if (typeof reservationForIdentifierEq === 'string') {
199
+ andConditions.push({
200
+ 'offers.itemOffered.serviceOutput.reservationFor.identifier': {
201
+ $exists: true,
202
+ $eq: reservationForIdentifierEq
203
+ }
204
+ });
205
+ }
206
+ const reservationForArrivalBusStopBranchCodeEq = (_0 = (_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.arrivalBusStop) === null || _z === void 0 ? void 0 : _z.branchCode) === null || _0 === void 0 ? void 0 : _0.$eq;
207
+ if (typeof reservationForArrivalBusStopBranchCodeEq === 'string') {
208
+ andConditions.push({
209
+ 'offers.itemOffered.serviceOutput.reservationFor.arrivalBusStop.branchCode': {
210
+ $exists: true,
211
+ $eq: reservationForArrivalBusStopBranchCodeEq
212
+ }
213
+ });
214
+ }
215
+ const reservationForDepartureBusStopBranchCodeEq = (_6 = (_5 = (_4 = (_3 = (_2 = (_1 = params.offers) === null || _1 === void 0 ? void 0 : _1.itemOffered) === null || _2 === void 0 ? void 0 : _2.serviceOutput) === null || _3 === void 0 ? void 0 : _3.reservationFor) === null || _4 === void 0 ? void 0 : _4.departureBusStop) === null || _5 === void 0 ? void 0 : _5.branchCode) === null || _6 === void 0 ? void 0 : _6.$eq;
216
+ if (typeof reservationForDepartureBusStopBranchCodeEq === 'string') {
217
+ andConditions.push({
218
+ 'offers.itemOffered.serviceOutput.reservationFor.departureBusStop.branchCode': {
219
+ $exists: true,
220
+ $eq: reservationForDepartureBusStopBranchCodeEq
221
+ }
222
+ });
223
+ }
136
224
  break;
137
225
  case factory.eventType.ScreeningEvent:
138
226
  params = conditions;
@@ -158,7 +246,7 @@ class MongoRepository {
158
246
  }
159
247
  // tslint:disable-next-line:no-single-line-block-comment
160
248
  /* istanbul ignore else */
161
- const superEventLocationIdEq = (_l = (_k = (_j = params.superEvent) === null || _j === void 0 ? void 0 : _j.location) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.$eq;
249
+ const superEventLocationIdEq = (_9 = (_8 = (_7 = params.superEvent) === null || _7 === void 0 ? void 0 : _7.location) === null || _8 === void 0 ? void 0 : _8.id) === null || _9 === void 0 ? void 0 : _9.$eq;
162
250
  if (typeof superEventLocationIdEq === 'string') {
163
251
  andConditions.push({
164
252
  'superEvent.location.id': {
@@ -246,7 +334,7 @@ class MongoRepository {
246
334
  });
247
335
  }
248
336
  }
249
- const itemOfferedIdIn = (_o = (_m = params.offers.itemOffered) === null || _m === void 0 ? void 0 : _m.id) === null || _o === void 0 ? void 0 : _o.$in;
337
+ const itemOfferedIdIn = (_11 = (_10 = params.offers.itemOffered) === null || _10 === void 0 ? void 0 : _10.id) === null || _11 === void 0 ? void 0 : _11.$in;
250
338
  if (Array.isArray(itemOfferedIdIn)) {
251
339
  andConditions.push({
252
340
  'offers.itemOffered.id': {
@@ -296,8 +384,8 @@ class MongoRepository {
296
384
  }
297
385
  }
298
386
  }
299
- const sellerMakesOfferElemMatch = (_r = (_q = (_p = params.offers) === null || _p === void 0 ? void 0 : _p.seller) === null || _q === void 0 ? void 0 : _q.makesOffer) === null || _r === void 0 ? void 0 : _r.$elemMatch;
300
- if (typeof ((_s = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _s === void 0 ? void 0 : _s.$eq) === 'string') {
387
+ const sellerMakesOfferElemMatch = (_14 = (_13 = (_12 = params.offers) === null || _12 === void 0 ? void 0 : _12.seller) === null || _13 === void 0 ? void 0 : _13.makesOffer) === null || _14 === void 0 ? void 0 : _14.$elemMatch;
388
+ if (typeof ((_15 = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _15 === void 0 ? void 0 : _15.$eq) === 'string') {
301
389
  andConditions.push({
302
390
  'offers.seller.makesOffer': {
303
391
  $exists: true,
@@ -334,7 +422,7 @@ class MongoRepository {
334
422
  ]
335
423
  });
336
424
  }
337
- const locationIdEq = (_u = (_t = params.location) === null || _t === void 0 ? void 0 : _t.id) === null || _u === void 0 ? void 0 : _u.$eq;
425
+ const locationIdEq = (_17 = (_16 = params.location) === null || _16 === void 0 ? void 0 : _16.id) === null || _17 === void 0 ? void 0 : _17.$eq;
338
426
  // tslint:disable-next-line:no-single-line-block-comment
339
427
  /* istanbul ignore else */
340
428
  if (typeof locationIdEq === 'string') {
@@ -356,7 +444,7 @@ class MongoRepository {
356
444
  });
357
445
  }
358
446
  }
359
- const workPerformedIdentifierIn = (_v = params.workPerformed) === null || _v === void 0 ? void 0 : _v.identifiers;
447
+ const workPerformedIdentifierIn = (_18 = params.workPerformed) === null || _18 === void 0 ? void 0 : _18.identifiers;
360
448
  // tslint:disable-next-line:no-single-line-block-comment
361
449
  /* istanbul ignore else */
362
450
  if (Array.isArray(workPerformedIdentifierIn)) {
@@ -367,7 +455,7 @@ class MongoRepository {
367
455
  }
368
456
  });
369
457
  }
370
- const videoFormatTypeOfEq = (_x = (_w = params.videoFormat) === null || _w === void 0 ? void 0 : _w.typeOf) === null || _x === void 0 ? void 0 : _x.$eq;
458
+ const videoFormatTypeOfEq = (_20 = (_19 = params.videoFormat) === null || _19 === void 0 ? void 0 : _19.typeOf) === null || _20 === void 0 ? void 0 : _20.$eq;
371
459
  if (typeof videoFormatTypeOfEq === 'string') {
372
460
  andConditions.push({
373
461
  'videoFormat.typeOf': {
@@ -376,7 +464,7 @@ class MongoRepository {
376
464
  }
377
465
  });
378
466
  }
379
- const videoFormatTypeOfIn = (_z = (_y = params.videoFormat) === null || _y === void 0 ? void 0 : _y.typeOf) === null || _z === void 0 ? void 0 : _z.$in;
467
+ const videoFormatTypeOfIn = (_22 = (_21 = params.videoFormat) === null || _21 === void 0 ? void 0 : _21.typeOf) === null || _22 === void 0 ? void 0 : _22.$in;
380
468
  if (Array.isArray(videoFormatTypeOfIn)) {
381
469
  andConditions.push({
382
470
  'videoFormat.typeOf': {
@@ -385,7 +473,7 @@ class MongoRepository {
385
473
  }
386
474
  });
387
475
  }
388
- const soundFormatTypeOfEq = (_1 = (_0 = params.soundFormat) === null || _0 === void 0 ? void 0 : _0.typeOf) === null || _1 === void 0 ? void 0 : _1.$eq;
476
+ const soundFormatTypeOfEq = (_24 = (_23 = params.soundFormat) === null || _23 === void 0 ? void 0 : _23.typeOf) === null || _24 === void 0 ? void 0 : _24.$eq;
389
477
  if (typeof soundFormatTypeOfEq === 'string') {
390
478
  andConditions.push({
391
479
  'soundFormat.typeOf': {
@@ -394,7 +482,7 @@ class MongoRepository {
394
482
  }
395
483
  });
396
484
  }
397
- const soundFormatTypeOfIn = (_3 = (_2 = params.soundFormat) === null || _2 === void 0 ? void 0 : _2.typeOf) === null || _3 === void 0 ? void 0 : _3.$in;
485
+ const soundFormatTypeOfIn = (_26 = (_25 = params.soundFormat) === null || _25 === void 0 ? void 0 : _25.typeOf) === null || _26 === void 0 ? void 0 : _26.$in;
398
486
  if (Array.isArray(soundFormatTypeOfIn)) {
399
487
  andConditions.push({
400
488
  'soundFormat.typeOf': {
@@ -32,18 +32,46 @@ class MongoRepository {
32
32
  }
33
33
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
34
34
  static CREATE_MONGO_CONDITIONS(conditions) {
35
- var _a, _b, _c;
35
+ var _a, _b, _c, _d, _e, _f;
36
36
  const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
37
37
  const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
38
38
  if (typeof projectIdEq === 'string') {
39
- andConditions.push({
40
- 'project.id': { $eq: projectIdEq }
41
- });
39
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
42
40
  }
43
41
  const idIn = (_c = conditions.id) === null || _c === void 0 ? void 0 : _c.$in;
44
42
  if (Array.isArray(idIn)) {
43
+ andConditions.push({ _id: { $in: idIn } });
44
+ }
45
+ const identifierEq = (_d = conditions.identifier) === null || _d === void 0 ? void 0 : _d.$eq;
46
+ if (typeof identifierEq === 'string') {
47
+ andConditions.push({ identifier: { $eq: identifierEq } });
48
+ }
49
+ const nameRegex = (_e = conditions.name) === null || _e === void 0 ? void 0 : _e.$regex;
50
+ if (typeof nameRegex === 'string' && nameRegex.length > 0) {
51
+ andConditions.push({
52
+ $or: [
53
+ {
54
+ 'name.ja': {
55
+ $exists: true,
56
+ $regex: new RegExp(nameRegex)
57
+ }
58
+ },
59
+ {
60
+ 'name.en': {
61
+ $exists: true,
62
+ $regex: new RegExp(nameRegex)
63
+ }
64
+ }
65
+ ]
66
+ });
67
+ }
68
+ const additionalPropertyElemMatch = (_f = conditions.additionalProperty) === null || _f === void 0 ? void 0 : _f.$elemMatch;
69
+ if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
45
70
  andConditions.push({
46
- _id: { $in: idIn }
71
+ additionalProperty: {
72
+ $exists: true,
73
+ $elemMatch: additionalPropertyElemMatch
74
+ }
47
75
  });
48
76
  }
49
77
  return andConditions;
@@ -119,28 +147,6 @@ class MongoRepository {
119
147
  if (p.attributes.typeOf === factory.tripType.BusTrip) {
120
148
  // 上書き禁止属性を除外
121
149
  const _a = p.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
122
- bulkWriteOps.push({
123
- updateOne: {
124
- filter: {
125
- _id: p.id,
126
- typeOf: p.attributes.typeOf
127
- },
128
- // upsertの場合、createがありうるので属性を除外しない
129
- update: Object.assign({ $setOnInsert: {
130
- typeOf: p.attributes.typeOf,
131
- project: p.attributes.project,
132
- identifier: p.attributes.identifier
133
- // ...(typeof p.attributes.remainingAttendeeCapacity === 'number')
134
- // ? { remainingAttendeeCapacity: p.attributes.remainingAttendeeCapacity }
135
- // : undefined
136
- }, $set: updateFields }, (p.$unset !== undefined) ? { $unset: p.$unset } : undefined),
137
- upsert
138
- }
139
- });
140
- }
141
- else if (p.attributes.typeOf === factory.tripType.BusTripSeries) {
142
- // 上書き禁止属性を除外
143
- const _b = p.attributes, { identifier, project, typeOf } = _b, updateFields = __rest(_b, ["identifier", "project", "typeOf"]);
144
150
  bulkWriteOps.push({
145
151
  updateOne: {
146
152
  filter: {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.281.0-alpha.4",
12
+ "@chevre/factory": "4.281.0-alpha.6",
13
13
  "@cinerino/sdk": "3.135.0-alpha.7",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.2.0-alpha.11"
123
+ "version": "20.2.0-alpha.12"
124
124
  }