@chevre/domain 20.2.0-alpha.3 → 20.2.0-alpha.31

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 (88) hide show
  1. package/example/src/chevre/aggregateEventReservation.ts +37 -0
  2. package/example/src/chevre/aggregation/aggregateSystem.ts +104 -0
  3. package/example/src/chevre/importEventsFromCOA.ts +8 -1
  4. package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +2 -1
  5. package/example/src/chevre/migrateProjectSubscription.ts +51 -0
  6. package/example/src/chevre/searchEventIds.ts +24 -0
  7. package/example/src/chevre/searchEvents.ts +20 -41
  8. package/example/src/chevre/updateTransaction.ts +38 -0
  9. package/lib/chevre/factory/event.d.ts +2 -0
  10. package/lib/chevre/factory/event.js +2 -0
  11. package/lib/chevre/repo/action.d.ts +58 -0
  12. package/lib/chevre/repo/action.js +187 -0
  13. package/lib/chevre/repo/aggregation.d.ts +36 -0
  14. package/lib/chevre/repo/aggregation.js +66 -0
  15. package/lib/chevre/repo/assetTransaction.d.ts +32 -0
  16. package/lib/chevre/repo/assetTransaction.js +148 -0
  17. package/lib/chevre/repo/event.d.ts +47 -13
  18. package/lib/chevre/repo/event.js +386 -113
  19. package/lib/chevre/repo/mongoose/model/aggregation.d.ts +7 -0
  20. package/lib/chevre/repo/mongoose/model/aggregation.js +47 -0
  21. package/lib/chevre/repo/mongoose/model/event.js +4 -3
  22. package/lib/chevre/repo/mongoose/model/project.js +7 -1
  23. package/lib/chevre/repo/mongoose/model/telemetry.js +4 -28
  24. package/lib/chevre/repo/place.d.ts +15 -1
  25. package/lib/chevre/repo/place.js +175 -10
  26. package/lib/chevre/repo/product.d.ts +1 -0
  27. package/lib/chevre/repo/product.js +5 -0
  28. package/lib/chevre/repo/project.d.ts +4 -1
  29. package/lib/chevre/repo/project.js +9 -10
  30. package/lib/chevre/repo/reservation.d.ts +0 -6
  31. package/lib/chevre/repo/reservation.js +106 -66
  32. package/lib/chevre/repo/task.d.ts +31 -3
  33. package/lib/chevre/repo/task.js +141 -27
  34. package/lib/chevre/repo/transaction.d.ts +45 -5
  35. package/lib/chevre/repo/transaction.js +187 -29
  36. package/lib/chevre/repo/trip.js +33 -27
  37. package/lib/chevre/repository.d.ts +3 -0
  38. package/lib/chevre/repository.js +5 -1
  39. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +1 -1
  40. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +40 -15
  41. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +3 -1
  42. package/lib/chevre/service/aggregation/system.d.ts +86 -0
  43. package/lib/chevre/service/aggregation/system.js +345 -0
  44. package/lib/chevre/service/aggregation.d.ts +2 -0
  45. package/lib/chevre/service/aggregation.js +3 -1
  46. package/lib/chevre/service/assetTransaction/pay/movieTicket/validation.js +5 -1
  47. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +2 -4
  48. package/lib/chevre/service/assetTransaction/pay.d.ts +19 -4
  49. package/lib/chevre/service/assetTransaction/pay.js +65 -32
  50. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +3 -0
  51. package/lib/chevre/service/assetTransaction/reserve/factory.js +33 -2
  52. package/lib/chevre/service/assetTransaction/reserve.d.ts +7 -2
  53. package/lib/chevre/service/assetTransaction/reserve.js +43 -56
  54. package/lib/chevre/service/delivery/factory.js +1 -0
  55. package/lib/chevre/service/event.d.ts +2 -4
  56. package/lib/chevre/service/event.js +34 -13
  57. package/lib/chevre/service/offer/event/authorize.js +5 -1
  58. package/lib/chevre/service/offer/event/cancel.js +0 -1
  59. package/lib/chevre/service/offer/event/factory.d.ts +3 -2
  60. package/lib/chevre/service/offer/event/factory.js +25 -5
  61. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +2 -2
  62. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +124 -9
  63. package/lib/chevre/service/offer/event/voidTransaction.js +0 -2
  64. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
  65. package/lib/chevre/service/offer/eventServiceByCOA.js +10 -2
  66. package/lib/chevre/service/offer.js +36 -20
  67. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +2 -1
  68. package/lib/chevre/service/order/onOrderStatusChanged.js +2 -1
  69. package/lib/chevre/service/order/placeOrder.js +16 -0
  70. package/lib/chevre/service/payment/any.d.ts +5 -0
  71. package/lib/chevre/service/payment/any.js +1 -1
  72. package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
  73. package/lib/chevre/service/payment/movieTicket.js +8 -2
  74. package/lib/chevre/service/reserve/confirmReservation.js +7 -10
  75. package/lib/chevre/service/reserve/useReservation.js +2 -1
  76. package/lib/chevre/service/task/confirmPayTransaction.js +20 -1
  77. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +4 -0
  78. package/lib/chevre/service/task/confirmReserveTransaction.js +5 -5
  79. package/lib/chevre/service/task/importEventsFromCOA.js +3 -1
  80. package/lib/chevre/service/task.js +6 -9
  81. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +42 -27
  82. package/lib/chevre/service/transaction/placeOrderInProgress.js +7 -7
  83. package/lib/chevre/service/transaction/returnOrder.js +3 -3
  84. package/lib/chevre/settings.d.ts +2 -0
  85. package/lib/chevre/settings.js +7 -2
  86. package/package.json +3 -3
  87. package/example/src/chevre/aggregateReservationOnProject.ts +0 -32
  88. package/example/src/chevre/migratePlaceAdditionalProperties.ts +0 -162
@@ -0,0 +1,47 @@
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 = 'Aggregation';
6
+ exports.modelName = modelName;
7
+ const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
8
+ /**
9
+ * 集計スキーマ
10
+ */
11
+ const schema = new mongoose.Schema({}, {
12
+ collection: 'aggregations',
13
+ id: true,
14
+ read: 'primaryPreferred',
15
+ writeConcern: writeConcern,
16
+ strict: false,
17
+ useNestedStrict: true,
18
+ timestamps: {
19
+ createdAt: 'createdAt',
20
+ updatedAt: 'updatedAt'
21
+ },
22
+ toJSON: {
23
+ getters: false,
24
+ virtuals: false,
25
+ minimize: false,
26
+ versionKey: false
27
+ },
28
+ toObject: {
29
+ getters: false,
30
+ virtuals: true,
31
+ minimize: false,
32
+ versionKey: false
33
+ }
34
+ });
35
+ exports.schema = schema;
36
+ schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
37
+ schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
38
+ mongoose.model(modelName, schema)
39
+ .on('index',
40
+ // tslint:disable-next-line:no-single-line-block-comment
41
+ /* istanbul ignore next */
42
+ (error) => {
43
+ if (error !== undefined) {
44
+ // tslint:disable-next-line:no-console
45
+ console.error(error);
46
+ }
47
+ });
@@ -30,12 +30,13 @@ const schema = new mongoose.Schema({
30
30
  startDate: Date,
31
31
  workPerformed: mongoose.SchemaTypes.Mixed,
32
32
  superEvent: mongoose.SchemaTypes.Mixed,
33
- videoFormat: [mongoose.SchemaTypes.Mixed],
34
- soundFormat: [mongoose.SchemaTypes.Mixed],
33
+ videoFormat: mongoose.SchemaTypes.Mixed,
34
+ soundFormat: mongoose.SchemaTypes.Mixed,
35
35
  subtitleLanguage: mongoose.SchemaTypes.Mixed,
36
36
  dubLanguage: mongoose.SchemaTypes.Mixed,
37
37
  kanaName: String,
38
- hasOfferCatalog: mongoose.SchemaTypes.Mixed,
38
+ // 不要なので廃止(2023-01-23~)
39
+ // hasOfferCatalog: mongoose.SchemaTypes.Mixed,
39
40
  offers: mongoose.SchemaTypes.Mixed,
40
41
  maximumAttendeeCapacity: { type: Number },
41
42
  remainingAttendeeCapacity: { type: Number },
@@ -10,6 +10,12 @@ const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
10
10
  */
11
11
  const schema = new mongoose.Schema({
12
12
  _id: String,
13
+ aggregateReservation: mongoose.SchemaTypes.Mixed,
14
+ alternateName: String,
15
+ logo: String,
16
+ name: String,
17
+ settings: mongoose.SchemaTypes.Mixed,
18
+ subscription: mongoose.SchemaTypes.Mixed,
13
19
  typeOf: {
14
20
  type: String,
15
21
  required: true
@@ -19,7 +25,7 @@ const schema = new mongoose.Schema({
19
25
  id: true,
20
26
  read: 'primaryPreferred',
21
27
  writeConcern: writeConcern,
22
- strict: false,
28
+ strict: true,
23
29
  useNestedStrict: true,
24
30
  timestamps: {
25
31
  createdAt: 'createdAt',
@@ -5,41 +5,17 @@ const mongoose = require("mongoose");
5
5
  const modelName = 'Telemetry';
6
6
  exports.modelName = modelName;
7
7
  const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
8
- const purposeSchema = new mongoose.Schema({
9
- typeOf: String
10
- }, {
11
- id: false,
12
- _id: false,
13
- strict: false
14
- });
15
- const objectSchema = new mongoose.Schema({
16
- measuredAt: Date
17
- }, {
18
- id: false,
19
- _id: false,
20
- strict: false
21
- });
22
- const resultSchema = new mongoose.Schema({}, {
23
- id: false,
24
- _id: false,
25
- strict: false
26
- });
27
- const errorSchema = new mongoose.Schema({}, {
28
- id: false,
29
- _id: false,
30
- strict: false
31
- });
32
8
  /**
33
9
  * 測定スキーマ
34
10
  */
35
11
  const schema = new mongoose.Schema({
36
12
  project: mongoose.SchemaTypes.Mixed,
37
- result: resultSchema,
38
- error: errorSchema,
39
- object: objectSchema,
13
+ result: mongoose.SchemaTypes.Mixed,
14
+ error: mongoose.SchemaTypes.Mixed,
15
+ object: mongoose.SchemaTypes.Mixed,
40
16
  startDate: Date,
41
17
  endDate: Date,
42
- purpose: purposeSchema
18
+ purpose: mongoose.SchemaTypes.Mixed
43
19
  }, {
44
20
  collection: 'telemetries',
45
21
  id: true,
@@ -7,6 +7,7 @@ declare type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.scre
7
7
  export declare class MongoRepository {
8
8
  private readonly placeModel;
9
9
  constructor(connection: Connection);
10
+ static CREATE_BUS_STOP_MONGO_CONDITIONS(params: factory.place.busStop.ISearchConditions): any[];
10
11
  static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params: factory.place.movieTheater.ISearchConditions): any[];
11
12
  /**
12
13
  * 施設を保管する
@@ -19,7 +20,6 @@ export declare class MongoRepository {
19
20
  };
20
21
  branchCode: string;
21
22
  }): Promise<factory.place.movieTheater.IPlace>;
22
- countMovieTheaters(params: factory.place.movieTheater.ISearchConditions): Promise<number>;
23
23
  /**
24
24
  * 施設検索
25
25
  */
@@ -114,6 +114,20 @@ export declare class MongoRepository {
114
114
  id: string;
115
115
  };
116
116
  }): Promise<void>;
117
+ saveBusStop(params: factory.place.busStop.IPlace): Promise<factory.place.busStop.IPlace>;
118
+ findBusStopByBranchCode(params: {
119
+ project: {
120
+ id: string;
121
+ };
122
+ branchCode: string;
123
+ }): Promise<factory.place.movieTheater.IPlace>;
124
+ searchBusStops(params: factory.place.busStop.ISearchConditions): Promise<factory.place.busStop.IPlace[]>;
125
+ findBusStopById(params: {
126
+ id: string;
127
+ }, projection?: any): Promise<factory.place.busStop.IPlace>;
128
+ deleteBusStopById(params: {
129
+ id: string;
130
+ }): Promise<void>;
117
131
  getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
118
132
  }
119
133
  export {};
@@ -32,6 +32,82 @@ class MongoRepository {
32
32
  this.placeModel = connection.model(place_1.modelName);
33
33
  }
34
34
  // tslint:disable-next-line:max-func-body-length
35
+ static CREATE_BUS_STOP_MONGO_CONDITIONS(params) {
36
+ var _a, _b, _c, _d, _e, _f, _g, _h;
37
+ const andConditions = [{ typeOf: { $eq: factory.placeType.BusStop } }];
38
+ const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
39
+ if (typeof projectIdEq === 'string') {
40
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
41
+ }
42
+ const branchCodeEq = (_c = params.branchCode) === null || _c === void 0 ? void 0 : _c.$eq;
43
+ if (typeof branchCodeEq === 'string') {
44
+ andConditions.push({
45
+ branchCode: {
46
+ $exists: true,
47
+ $eq: branchCodeEq
48
+ }
49
+ });
50
+ }
51
+ const branchCodeRegex = (_d = params.branchCode) === null || _d === void 0 ? void 0 : _d.$regex;
52
+ if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
53
+ andConditions.push({
54
+ branchCode: {
55
+ $exists: true,
56
+ $regex: new RegExp(branchCodeRegex)
57
+ }
58
+ });
59
+ }
60
+ const branchCodeIn = (_e = params.branchCode) === null || _e === void 0 ? void 0 : _e.$in;
61
+ if (Array.isArray(branchCodeIn)) {
62
+ andConditions.push({
63
+ branchCode: {
64
+ $exists: true,
65
+ $in: branchCodeIn
66
+ }
67
+ });
68
+ }
69
+ // tslint:disable-next-line:no-single-line-block-comment
70
+ /* istanbul ignore else */
71
+ const idEq = (_f = params.id) === null || _f === void 0 ? void 0 : _f.$eq;
72
+ if (typeof idEq === 'string') {
73
+ andConditions.push({
74
+ _id: {
75
+ $eq: idEq
76
+ }
77
+ });
78
+ }
79
+ const idIn = (_g = params.id) === null || _g === void 0 ? void 0 : _g.$in;
80
+ if (Array.isArray(idIn)) {
81
+ andConditions.push({
82
+ _id: {
83
+ $in: idIn
84
+ }
85
+ });
86
+ }
87
+ const nameRegex = (_h = params.name) === null || _h === void 0 ? void 0 : _h.$regex;
88
+ // tslint:disable-next-line:no-single-line-block-comment
89
+ /* istanbul ignore else */
90
+ if (typeof nameRegex === 'string' && nameRegex.length > 0) {
91
+ andConditions.push({
92
+ $or: [
93
+ {
94
+ 'name.ja': {
95
+ $exists: true,
96
+ $regex: new RegExp(nameRegex)
97
+ }
98
+ },
99
+ {
100
+ 'name.en': {
101
+ $exists: true,
102
+ $regex: new RegExp(nameRegex)
103
+ }
104
+ }
105
+ ]
106
+ });
107
+ }
108
+ return andConditions;
109
+ }
110
+ // tslint:disable-next-line:max-func-body-length
35
111
  static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params) {
36
112
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
37
113
  // MongoDB検索条件
@@ -171,6 +247,7 @@ class MongoRepository {
171
247
  findMovieTheaterByBranchCode(params) {
172
248
  return __awaiter(this, void 0, void 0, function* () {
173
249
  return this.placeModel.findOne({
250
+ typeOf: { $eq: factory.placeType.MovieTheater },
174
251
  'project.id': { $eq: params.project.id },
175
252
  branchCode: { $eq: params.branchCode }
176
253
  })
@@ -183,14 +260,12 @@ class MongoRepository {
183
260
  });
184
261
  });
185
262
  }
186
- countMovieTheaters(params) {
187
- return __awaiter(this, void 0, void 0, function* () {
188
- const conditions = MongoRepository.CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params);
189
- return this.placeModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
190
- .setOptions({ maxTimeMS: 10000 })
191
- .exec();
192
- });
193
- }
263
+ // public async countMovieTheaters(params: factory.place.movieTheater.ISearchConditions): Promise<number> {
264
+ // const conditions = MongoRepository.CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params);
265
+ // return this.placeModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
266
+ // .setOptions({ maxTimeMS: 10000 })
267
+ // .exec();
268
+ // }
194
269
  /**
195
270
  * 施設検索
196
271
  */
@@ -224,7 +299,10 @@ class MongoRepository {
224
299
  */
225
300
  findById(params, projection) {
226
301
  return __awaiter(this, void 0, void 0, function* () {
227
- const doc = yield this.placeModel.findOne({ _id: params.id }, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection))
302
+ const doc = yield this.placeModel.findOne({
303
+ typeOf: { $eq: factory.placeType.MovieTheater },
304
+ _id: { $eq: params.id }
305
+ }, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection))
228
306
  .exec();
229
307
  if (doc === null) {
230
308
  throw new factory.errors.NotFound(this.placeModel.modelName);
@@ -235,7 +313,8 @@ class MongoRepository {
235
313
  deleteMovieTheaterById(params) {
236
314
  return __awaiter(this, void 0, void 0, function* () {
237
315
  yield this.placeModel.findOneAndDelete({
238
- _id: params.id
316
+ typeOf: { $eq: factory.placeType.MovieTheater },
317
+ _id: { $eq: params.id }
239
318
  })
240
319
  .exec()
241
320
  .then((doc) => {
@@ -1066,6 +1145,92 @@ class MongoRepository {
1066
1145
  .exec();
1067
1146
  });
1068
1147
  }
1148
+ saveBusStop(params) {
1149
+ return __awaiter(this, void 0, void 0, function* () {
1150
+ let doc;
1151
+ if (typeof params.id !== 'string' || params.id.length === 0) {
1152
+ doc = yield this.placeModel.create(params);
1153
+ }
1154
+ else {
1155
+ // 上書き禁止属性を除外(2022-08-24~)
1156
+ const { id, branchCode, project, typeOf } = params, updateFields = __rest(params, ["id", "branchCode", "project", "typeOf"]);
1157
+ doc = yield this.placeModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
1158
+ .exec();
1159
+ }
1160
+ if (doc === null) {
1161
+ throw new factory.errors.NotFound(this.placeModel.modelName);
1162
+ }
1163
+ return doc.toObject();
1164
+ });
1165
+ }
1166
+ findBusStopByBranchCode(params) {
1167
+ return __awaiter(this, void 0, void 0, function* () {
1168
+ return this.placeModel.findOne({
1169
+ typeOf: { $eq: factory.placeType.BusStop },
1170
+ 'project.id': { $eq: params.project.id },
1171
+ branchCode: { $eq: params.branchCode }
1172
+ })
1173
+ .exec()
1174
+ .then((doc) => {
1175
+ if (doc === null) {
1176
+ throw new factory.errors.NotFound(`${factory.placeType.BusStop} ${params.branchCode}`);
1177
+ }
1178
+ return doc.toObject();
1179
+ });
1180
+ });
1181
+ }
1182
+ searchBusStops(params) {
1183
+ return __awaiter(this, void 0, void 0, function* () {
1184
+ const conditions = MongoRepository.CREATE_BUS_STOP_MONGO_CONDITIONS(params);
1185
+ // containsPlaceを含めるとデータサイズが大きくなるので、検索結果には含めない
1186
+ const query = this.placeModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
1187
+ __v: 0,
1188
+ createdAt: 0,
1189
+ updatedAt: 0,
1190
+ containsPlace: 0
1191
+ });
1192
+ if (typeof params.limit === 'number') {
1193
+ const page = (typeof params.page === 'number') ? params.page : 1;
1194
+ query.limit(params.limit)
1195
+ .skip(params.limit * (page - 1));
1196
+ }
1197
+ // tslint:disable-next-line:no-single-line-block-comment
1198
+ /* istanbul ignore else */
1199
+ if (params.sort !== undefined) {
1200
+ query.sort(params.sort);
1201
+ }
1202
+ return query.setOptions({ maxTimeMS: 10000 })
1203
+ .exec()
1204
+ .then((docs) => docs.map((doc) => doc.toObject()));
1205
+ });
1206
+ }
1207
+ findBusStopById(params, projection) {
1208
+ return __awaiter(this, void 0, void 0, function* () {
1209
+ const doc = yield this.placeModel.findOne({
1210
+ typeOf: { $eq: factory.placeType.BusStop },
1211
+ _id: { $eq: params.id }
1212
+ }, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection))
1213
+ .exec();
1214
+ if (doc === null) {
1215
+ throw new factory.errors.NotFound(this.placeModel.modelName);
1216
+ }
1217
+ return doc.toObject();
1218
+ });
1219
+ }
1220
+ deleteBusStopById(params) {
1221
+ return __awaiter(this, void 0, void 0, function* () {
1222
+ yield this.placeModel.findOneAndDelete({
1223
+ typeOf: { $eq: factory.placeType.BusStop },
1224
+ _id: { $eq: params.id }
1225
+ })
1226
+ .exec()
1227
+ .then((doc) => {
1228
+ if (doc === null) {
1229
+ throw new factory.errors.NotFound(this.placeModel.modelName);
1230
+ }
1231
+ });
1232
+ });
1233
+ }
1069
1234
  getCursor(conditions, projection) {
1070
1235
  return this.placeModel.find(conditions, projection)
1071
1236
  .sort({ branchCode: factory.sortType.Ascending })
@@ -52,4 +52,5 @@ export declare class MongoRepository {
52
52
  id: string;
53
53
  };
54
54
  }): Promise<void>;
55
+ getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
55
56
  }
@@ -251,5 +251,10 @@ class MongoRepository {
251
251
  .exec();
252
252
  });
253
253
  }
254
+ getCursor(conditions, projection) {
255
+ return this.productModel.find(conditions, projection)
256
+ .sort({ productID: factory.sortType.Ascending })
257
+ .cursor();
258
+ }
254
259
  }
255
260
  exports.MongoRepository = MongoRepository;
@@ -10,7 +10,6 @@ export declare class MongoRepository {
10
10
  findById(conditions: {
11
11
  id: string;
12
12
  }, projection?: any): Promise<factory.project.IProject>;
13
- count(params: factory.project.ISearchConditions): Promise<number>;
14
13
  /**
15
14
  * プロジェクト検索
16
15
  */
@@ -24,6 +23,9 @@ export declare class MongoRepository {
24
23
  settings?: {
25
24
  sendgridApiKey?: string;
26
25
  };
26
+ subscription?: {
27
+ useEventServiceAsProduct?: boolean;
28
+ };
27
29
  }): Promise<void>;
28
30
  updateAggregateReservation(params: {
29
31
  id: string;
@@ -32,4 +34,5 @@ export declare class MongoRepository {
32
34
  deleteById(params: {
33
35
  id: string;
34
36
  }): Promise<void>;
37
+ getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
35
38
  }
@@ -61,14 +61,6 @@ class MongoRepository {
61
61
  return doc.toObject();
62
62
  });
63
63
  }
64
- count(params) {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
67
- return this.projectModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
68
- .setOptions({ maxTimeMS: 10000 })
69
- .exec();
70
- });
71
- }
72
64
  /**
73
65
  * プロジェクト検索
74
66
  */
@@ -98,12 +90,14 @@ class MongoRepository {
98
90
  });
99
91
  }
100
92
  findByIdAndIUpdate(params) {
101
- var _a;
93
+ var _a, _b;
102
94
  return __awaiter(this, void 0, void 0, function* () {
103
- yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
95
+ yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
104
96
  ? { alternateName: params.alternateName }
105
97
  : undefined), (typeof params.name === 'string' && params.name.length > 0) ? { name: params.name } : undefined), (typeof params.logo === 'string' && params.logo.length > 0) ? { logo: params.logo } : undefined), (typeof ((_a = params.settings) === null || _a === void 0 ? void 0 : _a.sendgridApiKey) === 'string')
106
98
  ? { 'settings.sendgridApiKey': params.settings.sendgridApiKey }
99
+ : undefined), (typeof ((_b = params.subscription) === null || _b === void 0 ? void 0 : _b.useEventServiceAsProduct) === 'boolean')
100
+ ? { 'subscription.useEventServiceAsProduct': params.subscription.useEventServiceAsProduct }
107
101
  : undefined), {
108
102
  // ↓customerUserPoolは廃止
109
103
  $unset: {
@@ -131,5 +125,10 @@ class MongoRepository {
131
125
  .exec();
132
126
  });
133
127
  }
128
+ getCursor(conditions, projection) {
129
+ return this.projectModel.find(conditions, projection)
130
+ .sort({ _id: factory.sortType.Ascending })
131
+ .cursor();
132
+ }
134
133
  }
135
134
  exports.MongoRepository = MongoRepository;
@@ -30,12 +30,6 @@ export declare class MongoRepository {
30
30
  /**
31
31
  * 予約確定
32
32
  */
33
- confirm<T extends factory.reservationType>(params: {
34
- id: string;
35
- previousReservationStatus: factory.reservationStatusType;
36
- underName?: factory.reservation.IUnderName<T>;
37
- reservedTicket?: factory.reservation.ITicket;
38
- }): Promise<factory.reservation.IReservation<T>>;
39
33
  confirmByReservationNumber(params: {
40
34
  reservationNumber: string;
41
35
  previousReservationStatus: factory.reservationStatusType;