@brimble/models 1.4.14 → 1.4.16
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.
- package/dist/index.js +6 -1
- package/dist/logs.d.ts +2 -2
- package/dist/logs.js +3 -1
- package/dist/project.d.ts +2 -2
- package/dist/project.js +3 -1
- package/dist/user.d.ts +2 -3
- package/dist/user.js +4 -1
- package/index.ts +6 -2
- package/logs.ts +5 -1
- package/package.json +1 -1
- package/project.ts +5 -1
- package/user.ts +5 -1
package/dist/index.js
CHANGED
|
@@ -46,7 +46,12 @@ const mongoose_1 = __importDefault(require("mongoose"));
|
|
|
46
46
|
const utils_1 = require("@brimble/utils");
|
|
47
47
|
// Connection to Mongo
|
|
48
48
|
const connectToMongo = (mongoUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
-
const options = {
|
|
49
|
+
const options = {
|
|
50
|
+
useNewUrlParser: true,
|
|
51
|
+
useUnifiedTopology: true,
|
|
52
|
+
poolSize: 10,
|
|
53
|
+
socketTimeoutMS: 30000,
|
|
54
|
+
};
|
|
50
55
|
mongoose_1.default.set("useFindAndModify", false);
|
|
51
56
|
mongoose_1.default.set("useCreateIndex", true);
|
|
52
57
|
// connect to mongo
|
package/dist/logs.d.ts
CHANGED
package/dist/logs.js
CHANGED
|
@@ -22,4 +22,6 @@ const LogSchema = new mongoose_1.Schema({
|
|
|
22
22
|
startTime: mongoose_1.Schema.Types.Date,
|
|
23
23
|
endTime: mongoose_1.Schema.Types.Date,
|
|
24
24
|
}, { timestamps: true });
|
|
25
|
-
|
|
25
|
+
const Log = (0, mongoose_1.model)("Log", LogSchema);
|
|
26
|
+
Log.ensureIndexes({ _id: 1, project: 1 });
|
|
27
|
+
exports.default = Log;
|
package/dist/project.d.ts
CHANGED
package/dist/project.js
CHANGED
|
@@ -69,4 +69,6 @@ const projectSchema = new mongoose_1.Schema({
|
|
|
69
69
|
},
|
|
70
70
|
screenshot: String,
|
|
71
71
|
}, { timestamps: true });
|
|
72
|
-
|
|
72
|
+
const Project = (0, mongoose_1.model)("Project", projectSchema);
|
|
73
|
+
Project.ensureIndexes({ _id: 1, updatedAt: 1, createdAt: 1 });
|
|
74
|
+
exports.default = Project;
|
package/dist/user.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
/// <reference types="mongoose" />
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export default _default;
|
|
2
|
+
declare const User: import("mongoose").Model<import("mongoose").Document<any, any, any>, any, any>;
|
|
3
|
+
export default User;
|
package/dist/user.js
CHANGED
|
@@ -54,4 +54,7 @@ const userSchema = new mongoose_1.Schema({
|
|
|
54
54
|
type: String,
|
|
55
55
|
},
|
|
56
56
|
}, { timestamps: true });
|
|
57
|
-
|
|
57
|
+
const User = (0, mongoose_1.model)("User", userSchema);
|
|
58
|
+
// Create indexes for _id and email
|
|
59
|
+
User.ensureIndexes({ _id: 1, email: 1 });
|
|
60
|
+
exports.default = User;
|
package/index.ts
CHANGED
|
@@ -37,7 +37,12 @@ import { log } from "@brimble/utils";
|
|
|
37
37
|
|
|
38
38
|
// Connection to Mongo
|
|
39
39
|
export const connectToMongo = async (mongoUrl: string): Promise<void> => {
|
|
40
|
-
const options = {
|
|
40
|
+
const options = {
|
|
41
|
+
useNewUrlParser: true,
|
|
42
|
+
useUnifiedTopology: true,
|
|
43
|
+
poolSize: 10,
|
|
44
|
+
socketTimeoutMS: 30000,
|
|
45
|
+
};
|
|
41
46
|
mongoose.set("useFindAndModify", false);
|
|
42
47
|
mongoose.set("useCreateIndex", true);
|
|
43
48
|
|
|
@@ -61,4 +66,3 @@ export const db = mongoose.connection;
|
|
|
61
66
|
export const closeMongo = () => {
|
|
62
67
|
mongoose.connection.close(true);
|
|
63
68
|
};
|
|
64
|
-
|
package/logs.ts
CHANGED
package/package.json
CHANGED
package/project.ts
CHANGED
|
@@ -73,4 +73,8 @@ const projectSchema = new Schema(
|
|
|
73
73
|
{ timestamps: true },
|
|
74
74
|
);
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
const Project = model<IProject>("Project", projectSchema);
|
|
77
|
+
|
|
78
|
+
Project.ensureIndexes({ _id: 1, updatedAt: 1, createdAt: 1 });
|
|
79
|
+
|
|
80
|
+
export default Project;
|
package/user.ts
CHANGED
|
@@ -58,5 +58,9 @@ const userSchema: Schema = new Schema(
|
|
|
58
58
|
},
|
|
59
59
|
{ timestamps: true },
|
|
60
60
|
);
|
|
61
|
+
const User = model("User", userSchema);
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
// Create indexes for _id and email
|
|
64
|
+
User.ensureIndexes({ _id: 1, email: 1 });
|
|
65
|
+
|
|
66
|
+
export default User;
|