@chevre/domain 22.6.0-alpha.44 → 22.6.0-alpha.45

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.
@@ -11,11 +11,7 @@ mongoose.Model.on('index', (...args) => {
11
11
  async function main() {
12
12
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
13
 
14
- await chevre.repository.CategoryCode.createInstance(mongoose.connection);
15
- await chevre.repository.CreativeWork.createInstance(mongoose.connection);
16
- await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
17
- await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
18
- await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
14
+ await chevre.repository.Reservation.createInstance(mongoose.connection);
19
15
  console.log('success!');
20
16
  }
21
17
 
@@ -9,6 +9,6 @@ type IModel = Model<IDocType>;
9
9
  type ISchemaDefinition = SchemaDefinition<IDocType>;
10
10
  type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
11
11
  declare const modelName = "Reservation";
12
- declare function createSchema(): ISchema;
13
12
  declare const indexes: [d: IndexDefinition, o: IndexOptions][];
13
+ declare function createSchema(): ISchema;
14
14
  export { createSchema, IModel, indexes, modelName };
@@ -75,26 +75,7 @@ const schemaOptions = {
75
75
  versionKey: false
76
76
  }
77
77
  };
78
- /**
79
- * 予約スキーマ
80
- */
81
- let schema;
82
- function createSchema() {
83
- if (schema === undefined) {
84
- schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
85
- }
86
- return schema;
87
- }
88
- exports.createSchema = createSchema;
89
78
  const indexes = [
90
- // [ // discontinue(2024-08-07~)
91
- // { createdAt: 1 },
92
- // { name: 'searchByCreatedAt' }
93
- // ],
94
- // [
95
- // { updatedAt: 1 },
96
- // { name: 'searchByUpdatedAt' }
97
- // ],
98
79
  [
99
80
  { bookingTime: -1 },
100
81
  { name: 'searchByBookingTime-v3' }
@@ -316,6 +297,15 @@ const indexes = [
316
297
  }
317
298
  }
318
299
  ],
300
+ [
301
+ { 'reservedTicket.dateIssued': 1, bookingTime: -1 },
302
+ {
303
+ name: 'reservedTicketDateIssued',
304
+ partialFilterExpression: {
305
+ 'reservedTicket.dateIssued': { $exists: true }
306
+ }
307
+ }
308
+ ],
319
309
  [
320
310
  { 'broker.id': 1, bookingTime: -1 },
321
311
  {
@@ -444,3 +434,19 @@ const indexes = [
444
434
  ]
445
435
  ];
446
436
  exports.indexes = indexes;
437
+ /**
438
+ * 予約スキーマ
439
+ */
440
+ let schema;
441
+ function createSchema() {
442
+ if (schema === undefined) {
443
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
444
+ if (settings_1.MONGO_AUTO_INDEX) {
445
+ indexes.forEach((indexParams) => {
446
+ schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
447
+ });
448
+ }
449
+ }
450
+ return schema;
451
+ }
452
+ exports.createSchema = createSchema;
@@ -987,6 +987,10 @@ class ReservationRepo {
987
987
  checkInIfNot(params) {
988
988
  var _a, _b;
989
989
  return __awaiter(this, void 0, void 0, function* () {
990
+ const { now } = params;
991
+ if (!(now instanceof Date)) {
992
+ throw new factory.errors.Argument('now', 'must be Date');
993
+ }
990
994
  const conditions = [];
991
995
  if (typeof params.id === 'string') {
992
996
  if (params.id.length > 0) {
@@ -1015,8 +1019,11 @@ class ReservationRepo {
1015
1019
  // false->trueのみ(2023-01-31~)
1016
1020
  conditions.push({ checkedIn: { $eq: false } });
1017
1021
  yield this.reservationModel.updateMany({ $and: conditions }, {
1018
- checkedIn: true,
1019
- modifiedTime: params.now
1022
+ $set: {
1023
+ checkedIn: true,
1024
+ modifiedTime: now,
1025
+ 'reservedTicket.dateIssued': now // set reservedTicket.dateIssued(2024-12-03~)
1026
+ }
1020
1027
  })
1021
1028
  .exec();
1022
1029
  }
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
14
  "@chevre/factory": "4.390.0-alpha.1",
15
- "@cinerino/sdk": "10.18.0-alpha.0",
15
+ "@cinerino/sdk": "10.18.0-alpha.1",
16
16
  "@motionpicture/coa-service": "9.6.0-alpha.0",
17
17
  "@motionpicture/gmo-service": "5.3.0",
18
18
  "@sendgrid/mail": "6.4.0",
@@ -108,5 +108,5 @@
108
108
  "postversion": "git push origin --tags",
109
109
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
110
110
  },
111
- "version": "22.6.0-alpha.44"
111
+ "version": "22.6.0-alpha.45"
112
112
  }