payservedb 2.7.6 → 2.7.8
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/index.js +4 -2
- package/package.json +1 -1
- package/src/models/employees.js +33 -0
- package/src/models/tickets.js +1 -1
package/index.js
CHANGED
|
@@ -18,7 +18,7 @@ async function connectToMongoDB(dbName, secured, username, password, url, port)
|
|
|
18
18
|
console.log('Connected to MongoDB');
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
const url_ = `${username}:${password}
|
|
21
|
+
const url_ = `${username}:${password}@${url}${port}`;
|
|
22
22
|
const source = '?authSource=admin'
|
|
23
23
|
const connectionString = `mongodb://${url_}/${dbName}${source}`;
|
|
24
24
|
await mongoose.connect(connectionString, {
|
|
@@ -33,6 +33,7 @@ async function connectToMongoDB(dbName, secured, username, password, url, port)
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
|
|
36
37
|
// Function to switch databases dynamically
|
|
37
38
|
async function switchDB(dbName) {
|
|
38
39
|
// Check if there's already a connection to the desired database
|
|
@@ -104,7 +105,8 @@ const models = {
|
|
|
104
105
|
ValueAddedService:require('./src/models/valueaddedservices'),
|
|
105
106
|
VasInvoice:require('./src/models/vasinvoice'),
|
|
106
107
|
VasVendor:require('./src/models/vasvendor'),
|
|
107
|
-
ServiceRequest:require('./src/models/servicerequest')
|
|
108
|
+
ServiceRequest:require('./src/models/servicerequest'),
|
|
109
|
+
Employee:require('./src/models/employees')
|
|
108
110
|
|
|
109
111
|
};
|
|
110
112
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the Employee schema
|
|
4
|
+
const employeeSchema = new mongoose.Schema({
|
|
5
|
+
facilityId: {
|
|
6
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
7
|
+
ref: 'Facility',
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
contact: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
phoneNumber: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
service: [{
|
|
23
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
24
|
+
ref: 'ValueAddedService',
|
|
25
|
+
required: true,
|
|
26
|
+
}],
|
|
27
|
+
}, {
|
|
28
|
+
timestamps: true,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const Employee = mongoose.model('Employee', employeeSchema);
|
|
32
|
+
|
|
33
|
+
module.exports = { Employee };
|