@chevre/domain 20.1.0-alpha.2 → 20.1.0-alpha.20

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.
Files changed (77) hide show
  1. package/example/src/chevre/deleteEvents.ts +9 -1
  2. package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +139 -0
  3. package/example/src/chevre/migrateEventSeriesAdditionalPropertyNames.ts +68 -0
  4. package/example/src/chevre/migrateSellerMakesOfferTransactionDuration.ts +71 -0
  5. package/example/src/chevre/searchEvents.ts +36 -16
  6. package/lib/chevre/repo/action.js +42 -31
  7. package/lib/chevre/repo/additionalPropertyName.d.ts +35 -0
  8. package/lib/chevre/repo/additionalPropertyName.js +211 -0
  9. package/lib/chevre/repo/event.d.ts +9 -4
  10. package/lib/chevre/repo/event.js +59 -47
  11. package/lib/chevre/repo/mongoose/model/action.js +9 -1
  12. package/lib/chevre/repo/mongoose/model/additionalPropertyName.d.ts +7 -0
  13. package/lib/chevre/repo/mongoose/model/additionalPropertyName.js +81 -0
  14. package/lib/chevre/repo/mongoose/model/event.js +53 -0
  15. package/lib/chevre/repo/mongoose/model/place.js +18 -0
  16. package/lib/chevre/repo/place.d.ts +1 -0
  17. package/lib/chevre/repo/place.js +5 -0
  18. package/lib/chevre/repo/transaction.js +20 -5
  19. package/lib/chevre/repository.d.ts +6 -0
  20. package/lib/chevre/repository.js +8 -1
  21. package/lib/chevre/service/account.d.ts +0 -4
  22. package/lib/chevre/service/account.js +24 -22
  23. package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
  24. package/lib/chevre/service/accountTransaction/deposit.js +3 -3
  25. package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
  26. package/lib/chevre/service/accountTransaction/transfer.js +3 -3
  27. package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
  28. package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
  29. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +11 -20
  30. package/lib/chevre/service/delivery/factory.js +2 -1
  31. package/lib/chevre/service/event.js +10 -0
  32. package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
  33. package/lib/chevre/service/offer/event/authorize.js +46 -10
  34. package/lib/chevre/service/offer/factory.js +7 -20
  35. package/lib/chevre/service/offer.js +6 -6
  36. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +5 -3
  37. package/lib/chevre/service/order/onOrderStatusChanged.js +5 -4
  38. package/lib/chevre/service/order/placeOrder.js +17 -7
  39. package/lib/chevre/service/order/returnOrder.js +2 -1
  40. package/lib/chevre/service/order/sendOrder.js +4 -2
  41. package/lib/chevre/service/transaction/orderProgramMembership.js +6 -8
  42. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +6 -3
  43. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
  44. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +2 -1
  45. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +2 -1
  46. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +2 -1
  47. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -3
  48. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +4 -2
  49. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -4
  50. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
  51. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
  52. package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
  53. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +4 -5
  54. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +6 -3
  55. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +4 -6
  56. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -1
  57. package/lib/chevre/service/transaction/returnOrder.js +10 -1
  58. package/lib/chevre/service/transaction.js +1 -14
  59. package/package.json +3 -3
  60. package/example/src/chevre/accountBlanceTest.ts +0 -24
  61. package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
  62. package/example/src/chevre/createSeats.ts +0 -59
  63. package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
  64. package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
  65. package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
  66. package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
  67. package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
  68. package/example/src/chevre/publishConfirmationNumber.ts +0 -30
  69. package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
  70. package/example/src/chevre/publishTransactionNumber.ts +0 -28
  71. package/example/src/chevre/renameTransaction.ts +0 -22
  72. package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
  73. package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
  74. package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
  75. package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
  76. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmReservation.d.ts +0 -11
  77. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmReservation.js +0 -187
@@ -0,0 +1,35 @@
1
+ import { Connection } from 'mongoose';
2
+ import * as factory from '../factory';
3
+ /**
4
+ * 追加特性名称リポジトリ
5
+ */
6
+ export declare class MongoRepository {
7
+ private readonly additionalPropertyNameModel;
8
+ constructor(connection: Connection);
9
+ static CREATE_MONGO_CONDITIONS(params: factory.categoryCode.ISearchConditions): any[];
10
+ /**
11
+ * 検索
12
+ */
13
+ search(params: factory.categoryCode.ISearchConditions): Promise<factory.categoryCode.ICategoryCode[]>;
14
+ findById(params: {
15
+ id: string;
16
+ }): Promise<factory.categoryCode.ICategoryCode>;
17
+ save(params: {
18
+ id?: string;
19
+ attributes: factory.categoryCode.ICategoryCode;
20
+ }): Promise<factory.categoryCode.ICategoryCode>;
21
+ /**
22
+ * 削除する
23
+ */
24
+ deleteById(params: {
25
+ id: string;
26
+ }): Promise<void>;
27
+ /**
28
+ * プロジェクト指定で削除する
29
+ */
30
+ deleteByProject(params: {
31
+ project: {
32
+ id: string;
33
+ };
34
+ }): Promise<void>;
35
+ }
@@ -0,0 +1,211 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.MongoRepository = void 0;
24
+ const additionalPropertyName_1 = require("./mongoose/model/additionalPropertyName");
25
+ const factory = require("../factory");
26
+ /**
27
+ * 追加特性名称リポジトリ
28
+ */
29
+ class MongoRepository {
30
+ constructor(connection) {
31
+ this.additionalPropertyNameModel = connection.model(additionalPropertyName_1.modelName);
32
+ }
33
+ // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
34
+ static CREATE_MONGO_CONDITIONS(params) {
35
+ var _a, _b, _c, _d;
36
+ // MongoDB検索条件
37
+ const andConditions = [];
38
+ // tslint:disable-next-line:no-single-line-block-comment
39
+ /* istanbul ignore else */
40
+ if (params.project !== undefined && params.project !== null) {
41
+ if (params.project.id !== undefined && params.project.id !== null) {
42
+ if (typeof params.project.id.$eq === 'string') {
43
+ andConditions.push({
44
+ 'project.id': {
45
+ $eq: params.project.id.$eq
46
+ }
47
+ });
48
+ }
49
+ }
50
+ }
51
+ // tslint:disable-next-line:no-single-line-block-comment
52
+ /* istanbul ignore else */
53
+ if (params.id !== undefined && params.id !== null) {
54
+ if (typeof params.id.$eq === 'string') {
55
+ andConditions.push({
56
+ _id: {
57
+ $eq: params.id.$eq
58
+ }
59
+ });
60
+ }
61
+ }
62
+ // tslint:disable-next-line:no-single-line-block-comment
63
+ /* istanbul ignore else */
64
+ if (params.name !== undefined && params.name !== null) {
65
+ if (typeof params.name.$regex === 'string' && params.name.$regex.length > 0) {
66
+ andConditions.push({
67
+ $or: [
68
+ {
69
+ 'name.ja': {
70
+ $exists: true,
71
+ $regex: new RegExp(params.name.$regex)
72
+ }
73
+ },
74
+ {
75
+ 'name.en': {
76
+ $exists: true,
77
+ $regex: new RegExp(params.name.$regex)
78
+ }
79
+ }
80
+ ]
81
+ });
82
+ }
83
+ }
84
+ const codeValueEq = (_a = params.codeValue) === null || _a === void 0 ? void 0 : _a.$eq;
85
+ if (typeof codeValueEq === 'string') {
86
+ andConditions.push({
87
+ codeValue: {
88
+ $exists: true,
89
+ $eq: codeValueEq
90
+ }
91
+ });
92
+ }
93
+ const codeValueIn = (_b = params.codeValue) === null || _b === void 0 ? void 0 : _b.$in;
94
+ if (Array.isArray(codeValueIn)) {
95
+ andConditions.push({
96
+ codeValue: {
97
+ $exists: true,
98
+ $in: codeValueIn
99
+ }
100
+ });
101
+ }
102
+ // tslint:disable-next-line:no-single-line-block-comment
103
+ /* istanbul ignore else */
104
+ if (params.inCodeSet !== undefined && params.inCodeSet !== null) {
105
+ if (params.inCodeSet.identifier !== undefined && params.inCodeSet.identifier !== null) {
106
+ if (typeof params.inCodeSet.identifier.$eq === 'string') {
107
+ andConditions.push({
108
+ 'inCodeSet.identifier': {
109
+ $exists: true,
110
+ $eq: params.inCodeSet.identifier.$eq
111
+ }
112
+ });
113
+ }
114
+ }
115
+ }
116
+ const inCodeSetIdentifierIn = (_d = (_c = params.inCodeSet) === null || _c === void 0 ? void 0 : _c.identifier) === null || _d === void 0 ? void 0 : _d.$in;
117
+ if (Array.isArray(inCodeSetIdentifierIn)) {
118
+ andConditions.push({
119
+ 'inCodeSet.identifier': {
120
+ $exists: true,
121
+ $in: inCodeSetIdentifierIn
122
+ }
123
+ });
124
+ }
125
+ return andConditions;
126
+ }
127
+ // public async count(params: factory.categoryCode.ISearchConditions): Promise<number> {
128
+ // const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
129
+ // return this.additionalPropertyNameModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
130
+ // .setOptions({ maxTimeMS: 10000 })
131
+ // .exec();
132
+ // }
133
+ /**
134
+ * 検索
135
+ */
136
+ search(params) {
137
+ return __awaiter(this, void 0, void 0, function* () {
138
+ const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
139
+ const query = this.additionalPropertyNameModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
140
+ __v: 0,
141
+ createdAt: 0,
142
+ updatedAt: 0
143
+ });
144
+ if (typeof params.limit === 'number') {
145
+ const page = (typeof params.page === 'number') ? params.page : 1;
146
+ query.limit(params.limit)
147
+ .skip(params.limit * (page - 1));
148
+ }
149
+ // tslint:disable-next-line:no-single-line-block-comment
150
+ /* istanbul ignore else */
151
+ if (params.sort !== undefined) {
152
+ query.sort(params.sort);
153
+ }
154
+ return query.setOptions({ maxTimeMS: 10000 })
155
+ .exec()
156
+ .then((docs) => docs.map((doc) => doc.toObject()));
157
+ });
158
+ }
159
+ findById(params) {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ const doc = yield this.additionalPropertyNameModel.findOne({ _id: params.id }, {
162
+ __v: 0,
163
+ createdAt: 0,
164
+ updatedAt: 0
165
+ })
166
+ .exec();
167
+ if (doc === null) {
168
+ throw new factory.errors.NotFound(this.additionalPropertyNameModel.modelName);
169
+ }
170
+ return doc.toObject();
171
+ });
172
+ }
173
+ save(params) {
174
+ return __awaiter(this, void 0, void 0, function* () {
175
+ let doc;
176
+ if (typeof params.id !== 'string') {
177
+ doc = yield this.additionalPropertyNameModel.create(params.attributes);
178
+ }
179
+ else {
180
+ const _a = params.attributes, { id, codeValue, inCodeSet, project, typeOf } = _a, updateFields = __rest(_a, ["id", "codeValue", "inCodeSet", "project", "typeOf"]);
181
+ doc = yield this.additionalPropertyNameModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
182
+ .exec();
183
+ }
184
+ if (doc === null) {
185
+ throw new factory.errors.NotFound(this.additionalPropertyNameModel.modelName);
186
+ }
187
+ return doc.toObject();
188
+ });
189
+ }
190
+ /**
191
+ * 削除する
192
+ */
193
+ deleteById(params) {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ yield this.additionalPropertyNameModel.findOneAndRemove({ _id: params.id })
196
+ .exec();
197
+ });
198
+ }
199
+ /**
200
+ * プロジェクト指定で削除する
201
+ */
202
+ deleteByProject(params) {
203
+ return __awaiter(this, void 0, void 0, function* () {
204
+ yield this.additionalPropertyNameModel.deleteMany({
205
+ 'project.id': { $eq: params.project.id }
206
+ })
207
+ .exec();
208
+ });
209
+ }
210
+ }
211
+ exports.MongoRepository = MongoRepository;
@@ -29,13 +29,14 @@ export interface IUpdateAggregateUseActionsParams {
29
29
  noExistingAttributeName: 1;
30
30
  };
31
31
  }
32
+ export declare type ISearchConditions<T extends factory.eventType> = factory.event.ISearchConditions<T>;
32
33
  /**
33
34
  * イベントリポジトリ
34
35
  */
35
36
  export declare class MongoRepository {
36
37
  private readonly eventModel;
37
38
  constructor(connection: Connection);
38
- static CREATE_MONGO_CONDITIONS<T extends factory.eventType>(conditions: factory.event.ISearchConditions<T>): any[];
39
+ static CREATE_MONGO_CONDITIONS<T extends factory.eventType>(conditions: ISearchConditions<T>): any[];
39
40
  /**
40
41
  * 複数イベントを作成する
41
42
  */
@@ -71,14 +72,18 @@ export declare class MongoRepository {
71
72
  attributes: factory.event.IAttributes<factory.eventType.ScreeningEvent>;
72
73
  useOldEventId: boolean;
73
74
  }): Promise<factory.event.IEvent<factory.eventType.ScreeningEvent>>;
74
- count<T extends factory.eventType>(params: factory.event.ISearchConditions<T>): Promise<number>;
75
+ count<T extends factory.eventType>(params: ISearchConditions<T>): Promise<number>;
75
76
  /**
76
77
  * イベントを検索する
77
78
  */
78
- search<T extends factory.eventType>(params: factory.event.ISearchConditions<T>, projection?: any): Promise<factory.event.IEvent<T>[]>;
79
+ search<T extends factory.eventType>(params: ISearchConditions<T>, projection?: {
80
+ [key: string]: number;
81
+ }): Promise<factory.event.IEvent<T>[]>;
79
82
  findById<T extends factory.eventType>(params: {
80
83
  id: string;
81
- }, projection?: any): Promise<factory.event.IEvent<T>>;
84
+ }, projection?: {
85
+ [key: string]: number;
86
+ }): Promise<factory.event.IEvent<T>>;
82
87
  /**
83
88
  * イベントをキャンセルする
84
89
  */
@@ -24,6 +24,7 @@ exports.MongoRepository = void 0;
24
24
  const uniqid = require("uniqid");
25
25
  const factory = require("../factory");
26
26
  const event_1 = require("./mongoose/model/event");
27
+ const USE_DEPRECATED_EVENT_SEARCH_CONDITIONS = process.env.USE_DEPRECATED_EVENT_SEARCH_CONDITIONS === '1';
27
28
  /**
28
29
  * イベントリポジトリ
29
30
  */
@@ -33,7 +34,7 @@ class MongoRepository {
33
34
  }
34
35
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
35
36
  static CREATE_MONGO_CONDITIONS(conditions) {
36
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
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;
37
38
  const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
38
39
  const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
39
40
  if (typeof projectIdEq === 'string') {
@@ -144,7 +145,7 @@ class MongoRepository {
144
145
  }
145
146
  // tslint:disable-next-line:no-single-line-block-comment
146
147
  /* istanbul ignore else */
147
- const superEventLocationIdEq = (_k = (_j = (_h = conditions.superEvent) === null || _h === void 0 ? void 0 : _h.location) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$eq;
148
+ const superEventLocationIdEq = (_k = (_j = (_h = params.superEvent) === null || _h === void 0 ? void 0 : _h.location) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$eq;
148
149
  if (typeof superEventLocationIdEq === 'string') {
149
150
  andConditions.push({
150
151
  'superEvent.location.id': {
@@ -190,45 +191,47 @@ class MongoRepository {
190
191
  // tslint:disable-next-line:no-single-line-block-comment
191
192
  /* istanbul ignore else */
192
193
  if (params.offers !== undefined) {
193
- // tslint:disable-next-line:no-single-line-block-comment
194
- /* istanbul ignore else */
195
- if (params.offers.availableFrom instanceof Date) {
196
- andConditions.push({
197
- 'offers.availabilityEnds': {
198
- $exists: true,
199
- $gte: params.offers.availableFrom
200
- }
201
- });
202
- }
203
- // tslint:disable-next-line:no-single-line-block-comment
204
- /* istanbul ignore else */
205
- if (params.offers.availableThrough instanceof Date) {
206
- andConditions.push({
207
- 'offers.availabilityStarts': {
208
- $exists: true,
209
- $lte: params.offers.availableThrough
210
- }
211
- });
212
- }
213
- // tslint:disable-next-line:no-single-line-block-comment
214
- /* istanbul ignore else */
215
- if (params.offers.validFrom instanceof Date) {
216
- andConditions.push({
217
- 'offers.validThrough': {
218
- $exists: true,
219
- $gte: params.offers.validFrom
220
- }
221
- });
222
- }
223
- // tslint:disable-next-line:no-single-line-block-comment
224
- /* istanbul ignore else */
225
- if (params.offers.validThrough instanceof Date) {
226
- andConditions.push({
227
- 'offers.validFrom': {
228
- $exists: true,
229
- $lte: params.offers.validThrough
230
- }
231
- });
194
+ if (USE_DEPRECATED_EVENT_SEARCH_CONDITIONS) {
195
+ // tslint:disable-next-line:no-single-line-block-comment
196
+ /* istanbul ignore else */
197
+ if (params.offers.availableFrom instanceof Date) {
198
+ andConditions.push({
199
+ 'offers.availabilityEnds': {
200
+ $exists: true,
201
+ $gte: params.offers.availableFrom
202
+ }
203
+ });
204
+ }
205
+ // tslint:disable-next-line:no-single-line-block-comment
206
+ /* istanbul ignore else */
207
+ if (params.offers.availableThrough instanceof Date) {
208
+ andConditions.push({
209
+ 'offers.availabilityStarts': {
210
+ $exists: true,
211
+ $lte: params.offers.availableThrough
212
+ }
213
+ });
214
+ }
215
+ // tslint:disable-next-line:no-single-line-block-comment
216
+ /* istanbul ignore else */
217
+ if (params.offers.validFrom instanceof Date) {
218
+ andConditions.push({
219
+ 'offers.validThrough': {
220
+ $exists: true,
221
+ $gte: params.offers.validFrom
222
+ }
223
+ });
224
+ }
225
+ // tslint:disable-next-line:no-single-line-block-comment
226
+ /* istanbul ignore else */
227
+ if (params.offers.validThrough instanceof Date) {
228
+ andConditions.push({
229
+ 'offers.validFrom': {
230
+ $exists: true,
231
+ $lte: params.offers.validThrough
232
+ }
233
+ });
234
+ }
232
235
  }
233
236
  const itemOfferedIdIn = (_m = (_l = params.offers.itemOffered) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$in;
234
237
  if (Array.isArray(itemOfferedIdIn)) {
@@ -280,6 +283,15 @@ class MongoRepository {
280
283
  }
281
284
  }
282
285
  }
286
+ const sellerMakesOfferElemMatch = (_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;
287
+ if (typeof ((_r = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _r === void 0 ? void 0 : _r.$eq) === 'string') {
288
+ andConditions.push({
289
+ 'offers.seller.makesOffer': {
290
+ $exists: true,
291
+ $elemMatch: sellerMakesOfferElemMatch
292
+ }
293
+ });
294
+ }
283
295
  break;
284
296
  case factory.eventType.ScreeningEventSeries:
285
297
  params = conditions;
@@ -309,7 +321,7 @@ class MongoRepository {
309
321
  ]
310
322
  });
311
323
  }
312
- const locationIdEq = (_p = (_o = params.location) === null || _o === void 0 ? void 0 : _o.id) === null || _p === void 0 ? void 0 : _p.$eq;
324
+ const locationIdEq = (_t = (_s = params.location) === null || _s === void 0 ? void 0 : _s.id) === null || _t === void 0 ? void 0 : _t.$eq;
313
325
  // tslint:disable-next-line:no-single-line-block-comment
314
326
  /* istanbul ignore else */
315
327
  if (typeof locationIdEq === 'string') {
@@ -331,7 +343,7 @@ class MongoRepository {
331
343
  });
332
344
  }
333
345
  }
334
- const workPerformedIdentifierIn = (_q = params.workPerformed) === null || _q === void 0 ? void 0 : _q.identifiers;
346
+ const workPerformedIdentifierIn = (_u = params.workPerformed) === null || _u === void 0 ? void 0 : _u.identifiers;
335
347
  // tslint:disable-next-line:no-single-line-block-comment
336
348
  /* istanbul ignore else */
337
349
  if (Array.isArray(workPerformedIdentifierIn)) {
@@ -342,7 +354,7 @@ class MongoRepository {
342
354
  }
343
355
  });
344
356
  }
345
- const videoFormatTypeOfEq = (_s = (_r = params.videoFormat) === null || _r === void 0 ? void 0 : _r.typeOf) === null || _s === void 0 ? void 0 : _s.$eq;
357
+ const videoFormatTypeOfEq = (_w = (_v = params.videoFormat) === null || _v === void 0 ? void 0 : _v.typeOf) === null || _w === void 0 ? void 0 : _w.$eq;
346
358
  if (typeof videoFormatTypeOfEq === 'string') {
347
359
  andConditions.push({
348
360
  'videoFormat.typeOf': {
@@ -351,7 +363,7 @@ class MongoRepository {
351
363
  }
352
364
  });
353
365
  }
354
- const videoFormatTypeOfIn = (_u = (_t = params.videoFormat) === null || _t === void 0 ? void 0 : _t.typeOf) === null || _u === void 0 ? void 0 : _u.$in;
366
+ const videoFormatTypeOfIn = (_y = (_x = params.videoFormat) === null || _x === void 0 ? void 0 : _x.typeOf) === null || _y === void 0 ? void 0 : _y.$in;
355
367
  if (Array.isArray(videoFormatTypeOfIn)) {
356
368
  andConditions.push({
357
369
  'videoFormat.typeOf': {
@@ -360,7 +372,7 @@ class MongoRepository {
360
372
  }
361
373
  });
362
374
  }
363
- const soundFormatTypeOfEq = (_w = (_v = params.soundFormat) === null || _v === void 0 ? void 0 : _v.typeOf) === null || _w === void 0 ? void 0 : _w.$eq;
375
+ const soundFormatTypeOfEq = (_0 = (_z = params.soundFormat) === null || _z === void 0 ? void 0 : _z.typeOf) === null || _0 === void 0 ? void 0 : _0.$eq;
364
376
  if (typeof soundFormatTypeOfEq === 'string') {
365
377
  andConditions.push({
366
378
  'soundFormat.typeOf': {
@@ -369,7 +381,7 @@ class MongoRepository {
369
381
  }
370
382
  });
371
383
  }
372
- const soundFormatTypeOfIn = (_y = (_x = params.soundFormat) === null || _x === void 0 ? void 0 : _x.typeOf) === null || _y === void 0 ? void 0 : _y.$in;
384
+ const soundFormatTypeOfIn = (_2 = (_1 = params.soundFormat) === null || _1 === void 0 ? void 0 : _1.typeOf) === null || _2 === void 0 ? void 0 : _2.$in;
373
385
  if (Array.isArray(soundFormatTypeOfIn)) {
374
386
  andConditions.push({
375
387
  'soundFormat.typeOf': {
@@ -12,6 +12,7 @@ const schema = new mongoose.Schema({
12
12
  project: mongoose.SchemaTypes.Mixed,
13
13
  actionStatus: String,
14
14
  typeOf: String,
15
+ description: String,
15
16
  agent: mongoose.SchemaTypes.Mixed,
16
17
  recipient: mongoose.SchemaTypes.Mixed,
17
18
  result: mongoose.SchemaTypes.Mixed,
@@ -32,7 +33,8 @@ const schema = new mongoose.Schema({
32
33
  id: true,
33
34
  read: 'primaryPreferred',
34
35
  writeConcern: writeConcern,
35
- strict: false,
36
+ // true化(2022-11-12~)
37
+ strict: true,
36
38
  useNestedStrict: true,
37
39
  timestamps: {
38
40
  createdAt: 'createdAt',
@@ -66,6 +68,12 @@ schema.index({ endDate: -1, startDate: -1 }, {
66
68
  endDate: { $exists: true }
67
69
  }
68
70
  });
71
+ schema.index({ 'location.id': 1, startDate: -1 }, {
72
+ name: 'searchByLocationId',
73
+ partialFilterExpression: {
74
+ 'location.id': { $exists: true }
75
+ }
76
+ });
69
77
  schema.index({ 'location.identifier': 1, startDate: -1 }, {
70
78
  name: 'searchByLocationIdentifier',
71
79
  partialFilterExpression: {
@@ -0,0 +1,7 @@
1
+ import * as mongoose from 'mongoose';
2
+ declare const modelName = "AdditionalPropertyNam";
3
+ /**
4
+ * 追加特性名称スキーマ
5
+ */
6
+ declare const schema: mongoose.Schema<mongoose.Document<any, any, any>, mongoose.Model<mongoose.Document<any, any, any>, any, any>, undefined, {}>;
7
+ export { modelName, schema };
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.schema = exports.modelName = void 0;
4
+ const mongoose = require("mongoose");
5
+ const modelName = 'AdditionalPropertyNam';
6
+ exports.modelName = modelName;
7
+ const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
8
+ /**
9
+ * 追加特性名称スキーマ
10
+ */
11
+ const schema = new mongoose.Schema({
12
+ project: mongoose.SchemaTypes.Mixed,
13
+ typeOf: {
14
+ type: String,
15
+ required: true
16
+ },
17
+ codeValue: {
18
+ type: String,
19
+ required: true
20
+ },
21
+ inCodeSet: mongoose.SchemaTypes.Mixed,
22
+ name: mongoose.SchemaTypes.Mixed
23
+ }, {
24
+ collection: 'additionalPropertyNames',
25
+ id: true,
26
+ read: 'primaryPreferred',
27
+ writeConcern: writeConcern,
28
+ strict: true,
29
+ useNestedStrict: true,
30
+ timestamps: {
31
+ createdAt: 'createdAt',
32
+ updatedAt: 'updatedAt'
33
+ },
34
+ toJSON: {
35
+ getters: false,
36
+ virtuals: false,
37
+ minimize: false,
38
+ versionKey: false
39
+ },
40
+ toObject: {
41
+ getters: false,
42
+ virtuals: true,
43
+ minimize: false,
44
+ versionKey: false
45
+ }
46
+ });
47
+ exports.schema = schema;
48
+ schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
49
+ schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
50
+ schema.index({ codeValue: 1 }, { name: 'searchByCodeValue' });
51
+ schema.index({ 'project.id': 1, codeValue: 1 }, {
52
+ name: 'searchByProjectId'
53
+ });
54
+ schema.index({ 'inCodeSet.identifier': 1, codeValue: 1 }, {
55
+ name: 'searchByInCodeSetIdentifier',
56
+ partialFilterExpression: {
57
+ 'inCodeSet.identifier': { $exists: true }
58
+ }
59
+ });
60
+ schema.index({ 'name.ja': 1, codeValue: 1 }, {
61
+ name: 'searchByNameJa',
62
+ partialFilterExpression: {
63
+ 'name.ja': { $exists: true }
64
+ }
65
+ });
66
+ schema.index({ 'name.en': 1, codeValue: 1 }, {
67
+ name: 'searchByNameEn',
68
+ partialFilterExpression: {
69
+ 'name.en': { $exists: true }
70
+ }
71
+ });
72
+ mongoose.model(modelName, schema)
73
+ .on('index',
74
+ // tslint:disable-next-line:no-single-line-block-comment
75
+ /* istanbul ignore next */
76
+ (error) => {
77
+ if (error !== undefined) {
78
+ // tslint:disable-next-line:no-console
79
+ console.error(error);
80
+ }
81
+ });
@@ -185,6 +185,59 @@ schema.index({
185
185
  },
186
186
  name: 'searchByOffersItemOfferedId'
187
187
  });
188
+ // tslint:disable-next-line:no-suspicious-comment
189
+ // TODO add index
190
+ schema.index({ 'offers.seller.makesOffer': 1, startDate: 1 }, {
191
+ name: 'searchBySellerMakesOffer',
192
+ partialFilterExpression: {
193
+ 'offers.seller.makesOffer': { $exists: true }
194
+ }
195
+ });
196
+ // schema.index(
197
+ // { 'offers.seller.makesOffer.availableAtOrFrom.id': 1, startDate: 1 },
198
+ // {
199
+ // name: 'searchBySellerMakesOfferAvailableAtOrFromId',
200
+ // partialFilterExpression: {
201
+ // 'offers.seller.makesOffer.availableAtOrFrom.id': { $exists: true }
202
+ // }
203
+ // }
204
+ // );
205
+ // schema.index(
206
+ // { 'offers.seller.makesOffer.availabilityEnds': 1, startDate: 1 },
207
+ // {
208
+ // name: 'searchBySellerMakesOfferAvailabilityEnds',
209
+ // partialFilterExpression: {
210
+ // 'offers.seller.makesOffer.availabilityEnds': { $exists: true }
211
+ // }
212
+ // }
213
+ // );
214
+ // schema.index(
215
+ // { 'offers.seller.makesOffer.availabilityStarts': 1, startDate: 1 },
216
+ // {
217
+ // name: 'searchBySellerMakesOfferAvailabilityStarts',
218
+ // partialFilterExpression: {
219
+ // 'offers.seller.makesOffer.availabilityStarts': { $exists: true }
220
+ // }
221
+ // }
222
+ // );
223
+ // schema.index(
224
+ // { 'offers.seller.makesOffer.validThrough': 1, startDate: 1 },
225
+ // {
226
+ // name: 'searchBySellerMakesOfferValidThrough',
227
+ // partialFilterExpression: {
228
+ // 'offers.seller.makesOffer.validThrough': { $exists: true }
229
+ // }
230
+ // }
231
+ // );
232
+ // schema.index(
233
+ // { 'offers.seller.makesOffer.validFrom': 1, startDate: 1 },
234
+ // {
235
+ // name: 'searchBySellerMakesOfferValidFrom',
236
+ // partialFilterExpression: {
237
+ // 'offers.seller.makesOffer.validFrom': { $exists: true }
238
+ // }
239
+ // }
240
+ // );
188
241
  schema.index({ 'videoFormat.typeOf': 1, startDate: 1 }, {
189
242
  name: 'searchByVideoFormatTypeOf',
190
243
  partialFilterExpression: {