@chevre/domain 22.3.0-alpha.2 → 22.3.0-alpha.3

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.
@@ -8,6 +8,10 @@ async function main() {
8
8
 
9
9
  const accountTitleRepo = await chevre.repository.AccountTitle.createInstance(mongoose.connection);
10
10
  const customerRepo = await chevre.repository.Customer.createInstance(mongoose.connection);
11
+ const additionalPropertyRepo = await chevre.repository.AdditionalProperty.createInstance(mongoose.connection);
12
+ const movieTheaterRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
13
+ const productModelRepo = await chevre.repository.ProductModel.createInstance(mongoose.connection);
14
+ const tripRepo = await chevre.repository.Trip.createInstance(mongoose.connection);
11
15
 
12
16
  let updateResult: any;
13
17
  updateResult = await customerRepo.unsetUnnecessaryFields({
@@ -33,6 +37,54 @@ async function main() {
33
37
  }
34
38
  });
35
39
  console.log(updateResult);
40
+
41
+ updateResult = await additionalPropertyRepo.unsetUnnecessaryFields({
42
+ filter: {
43
+ _id: { $exists: true }
44
+ },
45
+ $unset: {
46
+ createdAt: 1,
47
+ updatedAt: 1,
48
+ __v: 1
49
+ }
50
+ });
51
+ console.log(updateResult);
52
+
53
+ updateResult = await movieTheaterRepo.unsetUnnecessaryFields({
54
+ filter: {
55
+ _id: { $exists: true }
56
+ },
57
+ $unset: {
58
+ createdAt: 1,
59
+ updatedAt: 1,
60
+ __v: 1
61
+ }
62
+ });
63
+ console.log(updateResult);
64
+
65
+ updateResult = await productModelRepo.unsetUnnecessaryFields({
66
+ filter: {
67
+ _id: { $exists: true }
68
+ },
69
+ $unset: {
70
+ createdAt: 1,
71
+ updatedAt: 1,
72
+ __v: 1
73
+ }
74
+ });
75
+ console.log(updateResult);
76
+
77
+ updateResult = await tripRepo.unsetUnnecessaryFields({
78
+ filter: {
79
+ _id: { $exists: true }
80
+ },
81
+ $unset: {
82
+ createdAt: 1,
83
+ updatedAt: 1,
84
+ __v: 1
85
+ }
86
+ });
87
+ console.log(updateResult);
36
88
  }
37
89
 
38
90
  main()
@@ -32,4 +32,8 @@ export declare class AdditionalPropertyRepo {
32
32
  id: string;
33
33
  };
34
34
  }): Promise<void>;
35
+ unsetUnnecessaryFields(params: {
36
+ filter: any;
37
+ $unset: any;
38
+ }): Promise<import("mongodb").UpdateResult>;
35
39
  }
@@ -202,5 +202,11 @@ class AdditionalPropertyRepo {
202
202
  .exec();
203
203
  });
204
204
  }
205
+ unsetUnnecessaryFields(params) {
206
+ return __awaiter(this, void 0, void 0, function* () {
207
+ return this.additionalPropertyModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
208
+ .exec();
209
+ });
210
+ }
205
211
  }
206
212
  exports.AdditionalPropertyRepo = AdditionalPropertyRepo;
@@ -18,6 +18,9 @@ const schemaDefinition = {
18
18
  },
19
19
  inCodeSet: mongoose_1.SchemaTypes.Mixed,
20
20
  name: mongoose_1.SchemaTypes.Mixed
21
+ // createdAt: SchemaTypes.Mixed,
22
+ // updatedAt: SchemaTypes.Mixed,
23
+ // __v: SchemaTypes.Mixed
21
24
  };
22
25
  const schemaOptions = {
23
26
  autoIndex: settings_1.MONGO_AUTO_INDEX,
@@ -28,10 +31,8 @@ const schemaOptions = {
28
31
  writeConcern: writeConcern_1.writeConcern,
29
32
  strict: true,
30
33
  strictQuery: false,
31
- timestamps: {
32
- createdAt: 'createdAt',
33
- updatedAt: 'updatedAt'
34
- },
34
+ timestamps: false,
35
+ versionKey: false,
35
36
  toJSON: {
36
37
  getters: false,
37
38
  virtuals: false,
@@ -46,14 +47,6 @@ const schemaOptions = {
46
47
  }
47
48
  };
48
49
  const indexes = [
49
- [
50
- { createdAt: 1 },
51
- { name: 'searchByCreatedAt' }
52
- ],
53
- [
54
- { updatedAt: 1 },
55
- { name: 'searchByUpdatedAt' }
56
- ],
57
50
  [
58
51
  { codeValue: 1 },
59
52
  { name: 'searchByCodeValue' }
@@ -100,6 +93,11 @@ let schema;
100
93
  function createSchema() {
101
94
  if (schema === undefined) {
102
95
  schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
96
+ if (settings_1.MONGO_AUTO_INDEX) {
97
+ indexes.forEach((indexParams) => {
98
+ schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
99
+ });
100
+ }
103
101
  }
104
102
  return schema;
105
103
  }
@@ -13,6 +13,6 @@ type IModel = Model<IDocType>;
13
13
  type ISchemaDefinition = SchemaDefinition<IDocType>;
14
14
  type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
15
15
  declare const modelName = "Place";
16
- declare function createSchema(): ISchema;
17
16
  declare const indexes: [d: IndexDefinition, o: IndexOptions][];
17
+ declare function createSchema(): ISchema;
18
18
  export { createSchema, IModel, indexes, modelName };
@@ -41,6 +41,9 @@ const schemaDefinition = {
41
41
  // ↓ルームの施設からの分離に伴い属性追加(2023-06-22~)
42
42
  openSeatingAllowed: mongoose_1.SchemaTypes.Mixed,
43
43
  amenityFeature: mongoose_1.SchemaTypes.Mixed
44
+ // createdAt: SchemaTypes.Mixed,
45
+ // updatedAt: SchemaTypes.Mixed,
46
+ // __v: SchemaTypes.Mixed
44
47
  };
45
48
  const schemaOptions = {
46
49
  autoIndex: settings_1.MONGO_AUTO_INDEX,
@@ -51,10 +54,8 @@ const schemaOptions = {
51
54
  writeConcern: writeConcern_1.writeConcern,
52
55
  strict: true,
53
56
  strictQuery: false,
54
- timestamps: {
55
- createdAt: 'createdAt',
56
- updatedAt: 'updatedAt'
57
- },
57
+ timestamps: false,
58
+ versionKey: false,
58
59
  toJSON: {
59
60
  getters: false,
60
61
  virtuals: false,
@@ -68,26 +69,7 @@ const schemaOptions = {
68
69
  versionKey: false
69
70
  }
70
71
  };
71
- /**
72
- * 場所スキーマ
73
- */
74
- let schema;
75
- function createSchema() {
76
- if (schema === undefined) {
77
- schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
78
- }
79
- return schema;
80
- }
81
- exports.createSchema = createSchema;
82
72
  const indexes = [
83
- [
84
- { createdAt: 1 },
85
- { name: 'searchByCreatedAt' }
86
- ],
87
- [
88
- { updatedAt: 1 },
89
- { name: 'searchByUpdatedAt' }
90
- ],
91
73
  [
92
74
  { branchCode: 1 },
93
75
  { name: 'searchByBranchCode-v2' }
@@ -221,3 +203,19 @@ const indexes = [
221
203
  ]
222
204
  ];
223
205
  exports.indexes = indexes;
206
+ /**
207
+ * 施設スキーマ
208
+ */
209
+ let schema;
210
+ function createSchema() {
211
+ if (schema === undefined) {
212
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
213
+ if (settings_1.MONGO_AUTO_INDEX) {
214
+ indexes.forEach((indexParams) => {
215
+ schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
216
+ });
217
+ }
218
+ }
219
+ return schema;
220
+ }
221
+ exports.createSchema = createSchema;
@@ -12,6 +12,9 @@ const schemaDefinition = {
12
12
  category: mongoose_1.SchemaTypes.Mixed,
13
13
  name: mongoose_1.SchemaTypes.Mixed,
14
14
  offers: mongoose_1.SchemaTypes.Mixed
15
+ // createdAt: SchemaTypes.Mixed,
16
+ // updatedAt: SchemaTypes.Mixed,
17
+ // __v: SchemaTypes.Mixed
15
18
  };
16
19
  const schemaOptions = {
17
20
  autoIndex: settings_1.MONGO_AUTO_INDEX,
@@ -22,10 +25,8 @@ const schemaOptions = {
22
25
  writeConcern: writeConcern_1.writeConcern,
23
26
  strict: true,
24
27
  strictQuery: false,
25
- timestamps: {
26
- createdAt: 'createdAt',
27
- updatedAt: 'updatedAt'
28
- },
28
+ timestamps: false,
29
+ versionKey: false,
29
30
  toJSON: {
30
31
  getters: false,
31
32
  virtuals: false,
@@ -39,16 +40,7 @@ const schemaOptions = {
39
40
  versionKey: false
40
41
  }
41
42
  };
42
- const indexes = [
43
- [
44
- { createdAt: 1 },
45
- { name: 'searchByCreatedAt' }
46
- ],
47
- [
48
- { updatedAt: 1 },
49
- { name: 'searchByUpdatedAt' }
50
- ]
51
- ];
43
+ const indexes = [];
52
44
  exports.indexes = indexes;
53
45
  /**
54
46
  * プロダクトモデルスキーマ
@@ -12,6 +12,9 @@ const schemaDefinition = {
12
12
  type: String,
13
13
  required: true
14
14
  }
15
+ // createdAt: SchemaTypes.Mixed,
16
+ // updatedAt: SchemaTypes.Mixed,
17
+ // __v: SchemaTypes.Mixed
15
18
  };
16
19
  const schemaOptions = {
17
20
  autoIndex: settings_1.MONGO_AUTO_INDEX,
@@ -22,10 +25,8 @@ const schemaOptions = {
22
25
  writeConcern: writeConcern_1.writeConcern,
23
26
  strict: false,
24
27
  strictQuery: false,
25
- timestamps: {
26
- createdAt: 'createdAt',
27
- updatedAt: 'updatedAt'
28
- },
28
+ timestamps: false,
29
+ versionKey: false,
29
30
  toJSON: {
30
31
  getters: false,
31
32
  virtuals: false,
@@ -48,6 +49,11 @@ let schema;
48
49
  function createSchema() {
49
50
  if (schema === undefined) {
50
51
  schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
52
+ if (settings_1.MONGO_AUTO_INDEX) {
53
+ indexes.forEach((indexParams) => {
54
+ schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
55
+ });
56
+ }
51
57
  }
52
58
  return schema;
53
59
  }
@@ -126,5 +126,9 @@ export declare class MovieTheaterRepo {
126
126
  } & {
127
127
  _id: import("mongoose").Types.ObjectId;
128
128
  }), never>>>;
129
+ unsetUnnecessaryFields(params: {
130
+ filter: any;
131
+ $unset: any;
132
+ }): Promise<import("mongodb").UpdateResult>;
129
133
  }
130
134
  export {};
@@ -307,5 +307,11 @@ class MovieTheaterRepo {
307
307
  .sort({ branchCode: factory.sortType.Ascending })
308
308
  .cursor();
309
309
  }
310
+ unsetUnnecessaryFields(params) {
311
+ return __awaiter(this, void 0, void 0, function* () {
312
+ return this.placeModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
313
+ .exec();
314
+ });
315
+ }
310
316
  }
311
317
  exports.MovieTheaterRepo = MovieTheaterRepo;
@@ -55,5 +55,9 @@ export declare class ProductModelRepo {
55
55
  id: string;
56
56
  };
57
57
  }): Promise<void>;
58
+ unsetUnnecessaryFields(params: {
59
+ filter: any;
60
+ $unset: any;
61
+ }): Promise<import("mongodb").UpdateResult>;
58
62
  }
59
63
  export {};
@@ -171,5 +171,11 @@ class ProductModelRepo {
171
171
  .exec();
172
172
  });
173
173
  }
174
+ unsetUnnecessaryFields(params) {
175
+ return __awaiter(this, void 0, void 0, function* () {
176
+ return this.productModelModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
177
+ .exec();
178
+ });
179
+ }
174
180
  }
175
181
  exports.ProductModelRepo = ProductModelRepo;
@@ -51,4 +51,8 @@ export declare class TripRepo {
51
51
  id: string;
52
52
  };
53
53
  }): Promise<void>;
54
+ unsetUnnecessaryFields(params: {
55
+ filter: any;
56
+ $unset: any;
57
+ }): Promise<import("mongodb").UpdateResult>;
54
58
  }
@@ -225,5 +225,11 @@ class TripRepo {
225
225
  .exec();
226
226
  });
227
227
  }
228
+ unsetUnnecessaryFields(params) {
229
+ return __awaiter(this, void 0, void 0, function* () {
230
+ return this.tripModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
231
+ .exec();
232
+ });
233
+ }
228
234
  }
229
235
  exports.TripRepo = TripRepo;
package/package.json CHANGED
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "22.3.0-alpha.2"
113
+ "version": "22.3.0-alpha.3"
114
114
  }