codebase-models 3.0.0 → 3.0.2

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.
@@ -97,5 +97,5 @@ ClientRetentionSchema.index({ viewId: 1 }, { sparse: true });
97
97
  ClientRetentionSchema.index({ "retentions.active": 1 }, { partialFilterExpression: { "retentions.active": true } });
98
98
  // Index for sorting by retainer value
99
99
  ClientRetentionSchema.index({ "retentions.retainerValue": -1 });
100
- const ClientRetention = mongoose_1.default.models.clientretention || (0, mongoose_1.model)("ClientRetention", ClientRetentionSchema);
100
+ const ClientRetention = mongoose_1.default.models.clientretention || (0, mongoose_1.model)("clientretention", ClientRetentionSchema);
101
101
  exports.default = ClientRetention;
@@ -22,18 +22,6 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
- import mongoose, { Document } from 'mongoose';
26
- interface ICustomQuery extends Document {
27
- iid: string;
28
- organizationId?: mongoose.Schema.Types.ObjectId;
29
- title: string;
30
- module: string;
31
- client: mongoose.Schema.Types.ObjectId;
32
- query: string;
33
- metadata: any;
34
- createdBy?: mongoose.Schema.Types.ObjectId;
35
- }
36
- declare const CustomQuery: mongoose.Model<ICustomQuery, {}, {}, {}, mongoose.Document<unknown, {}, ICustomQuery> & ICustomQuery & {
37
- _id: mongoose.Types.ObjectId;
38
- }, any>;
25
+ import mongoose from 'mongoose';
26
+ declare const CustomQuery: mongoose.Model<any, {}, {}, {}, any, any>;
39
27
  export default CustomQuery;
@@ -65,5 +65,5 @@ CustomQuerySchema.pre('save', function (next) {
65
65
  next();
66
66
  });
67
67
  });
68
- const CustomQuery = (0, mongoose_1.model)('CustomQuery', CustomQuerySchema);
68
+ const CustomQuery = mongoose_1.default.models.customquery || (0, mongoose_1.model)('customquery', CustomQuerySchema);
69
69
  exports.default = CustomQuery;
@@ -44,7 +44,5 @@ export interface IHypothesisSheet extends Document {
44
44
  tested?: Boolean;
45
45
  createdBy?: mongoose.Schema.Types.ObjectId;
46
46
  }
47
- declare const HypothesisSheet: mongoose.Model<IHypothesisSheet, {}, {}, {}, mongoose.Document<unknown, {}, IHypothesisSheet> & IHypothesisSheet & {
48
- _id: mongoose.Types.ObjectId;
49
- }, any>;
47
+ declare const HypothesisSheet: mongoose.Model<any, {}, {}, {}, any, any>;
50
48
  export default HypothesisSheet;
@@ -114,5 +114,5 @@ const HypothesisSheetSchema = new mongoose_1.Schema({
114
114
  }, {
115
115
  timestamps: true,
116
116
  });
117
- const HypothesisSheet = (0, mongoose_1.model)("hypothesisSheet", HypothesisSheetSchema);
117
+ const HypothesisSheet = mongoose_1.default.models.hypothesissheet || (0, mongoose_1.model)("hypothesissheet", HypothesisSheetSchema);
118
118
  exports.default = HypothesisSheet;
@@ -34,7 +34,5 @@ export interface INewIdeas extends Document {
34
34
  totalPriority?: string;
35
35
  createdBy?: mongoose.Schema.Types.ObjectId;
36
36
  }
37
- declare const NewIdeas: mongoose.Model<INewIdeas, {}, {}, {}, mongoose.Document<unknown, {}, INewIdeas> & INewIdeas & {
38
- _id: mongoose.Types.ObjectId;
39
- }, any>;
37
+ declare const NewIdeas: mongoose.Model<any, {}, {}, {}, any, any>;
40
38
  export default NewIdeas;
@@ -67,5 +67,5 @@ NewIdeasSchema.index({
67
67
  client: 1,
68
68
  viewId: 1,
69
69
  });
70
- const NewIdeas = (0, mongoose_1.model)("Newideas", NewIdeasSchema);
70
+ const NewIdeas = mongoose_1.default.models.newideas || (0, mongoose_1.model)("newideas", NewIdeasSchema);
71
71
  exports.default = NewIdeas;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebase-models",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Common models for codebase",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -100,7 +100,7 @@ ClientRetentionSchema.index(
100
100
  ClientRetentionSchema.index({ "retentions.retainerValue": -1 });
101
101
 
102
102
  const ClientRetention = mongoose.models.clientretention || model<IClientRetention>(
103
- "ClientRetention",
103
+ "clientretention",
104
104
  ClientRetentionSchema
105
105
  );
106
106
 
@@ -46,6 +46,6 @@ CustomQuerySchema.pre('save', async function(next) {
46
46
  });
47
47
 
48
48
 
49
- const CustomQuery = model<ICustomQuery>('CustomQuery', CustomQuerySchema);
49
+ const CustomQuery = mongoose.models.customquery || model<ICustomQuery>('customquery', CustomQuerySchema);
50
50
 
51
51
  export default CustomQuery;
@@ -113,8 +113,8 @@ const HypothesisSheetSchema = new Schema<IHypothesisSheet>(
113
113
  }
114
114
  );
115
115
 
116
- const HypothesisSheet = model<IHypothesisSheet>(
117
- "hypothesisSheet",
116
+ const HypothesisSheet = mongoose.models.hypothesissheet || model<IHypothesisSheet>(
117
+ "hypothesissheet",
118
118
  HypothesisSheetSchema
119
119
  );
120
120
 
@@ -60,5 +60,5 @@ NewIdeasSchema.index({
60
60
  viewId: 1,
61
61
  });
62
62
 
63
- const NewIdeas = model<INewIdeas>("Newideas", NewIdeasSchema);
63
+ const NewIdeas = mongoose.models.newideas || model<INewIdeas>("newideas", NewIdeasSchema);
64
64
  export default NewIdeas;