payservedb 5.7.2 → 5.7.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.
- package/index.js +2 -1
- package/package.json +1 -1
- package/src/models/assetsAssignment.js +18 -27
- package/src/models/tickets.js +4 -0
package/index.js
CHANGED
|
@@ -176,7 +176,8 @@ const models = {
|
|
|
176
176
|
UnitManagementTemplate: require("./src/models/unitManagementTemplate"),
|
|
177
177
|
PropertyManagerRevenue: require("./src/models/propertyManagerRevenue"),
|
|
178
178
|
PropertyManagerContract: require("./src/models/propertyManagerContract"),
|
|
179
|
-
BillerAddress: require('./src/models/billerAddress')
|
|
179
|
+
BillerAddress: require('./src/models/billerAddress'),
|
|
180
|
+
AssetAssignment: require('./src/models/assetsAssignment')
|
|
180
181
|
};
|
|
181
182
|
|
|
182
183
|
// Function to get models dynamically from a specific database connection
|
package/package.json
CHANGED
|
@@ -16,13 +16,8 @@ const assetAssignmentSchema = new mongoose.Schema({
|
|
|
16
16
|
ref: 'Facility',
|
|
17
17
|
required: true,
|
|
18
18
|
},
|
|
19
|
-
|
|
20
|
-
type: Date,
|
|
21
|
-
default: Date.now,
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
unassignedDate: {
|
|
25
|
-
type: Date,
|
|
19
|
+
dates: {
|
|
20
|
+
type: [Date],
|
|
26
21
|
},
|
|
27
22
|
status: {
|
|
28
23
|
type: String,
|
|
@@ -32,25 +27,25 @@ const assetAssignmentSchema = new mongoose.Schema({
|
|
|
32
27
|
notes: {
|
|
33
28
|
type: String,
|
|
34
29
|
},
|
|
35
|
-
priority: {
|
|
36
|
-
type: String,
|
|
37
|
-
enum: ['Low', 'Medium', 'High', 'Critical'],
|
|
38
|
-
default: 'Medium',
|
|
39
|
-
},
|
|
40
|
-
serviceType: {
|
|
41
|
-
type: String,
|
|
42
|
-
enum: ['Maintenance', 'Repair', 'Installation', 'Inspection', 'Other'],
|
|
43
|
-
},
|
|
44
|
-
estimatedCompletionDate: {
|
|
45
|
-
type: Date,
|
|
46
|
-
},
|
|
47
|
-
actualCompletionDate: {
|
|
48
|
-
type: Date,
|
|
49
|
-
},
|
|
50
30
|
cost: {
|
|
51
31
|
type: Number,
|
|
52
32
|
min: 0,
|
|
53
33
|
},
|
|
34
|
+
attachments: [{
|
|
35
|
+
fileName: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: true,
|
|
38
|
+
trim: true,
|
|
39
|
+
},
|
|
40
|
+
filePath: {
|
|
41
|
+
type: String,
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
uploadedAt: {
|
|
45
|
+
type: Date,
|
|
46
|
+
default: Date.now,
|
|
47
|
+
}
|
|
48
|
+
}],
|
|
54
49
|
}, {
|
|
55
50
|
timestamps: true,
|
|
56
51
|
});
|
|
@@ -58,7 +53,7 @@ const assetAssignmentSchema = new mongoose.Schema({
|
|
|
58
53
|
// Compound index to ensure unique active assignments per asset-vendor pair
|
|
59
54
|
assetAssignmentSchema.index(
|
|
60
55
|
{ assetId: 1, serviceVendorId: 1, status: 1 },
|
|
61
|
-
{
|
|
56
|
+
{
|
|
62
57
|
unique: true,
|
|
63
58
|
partialFilterExpression: { status: 'Active' }
|
|
64
59
|
}
|
|
@@ -67,8 +62,4 @@ assetAssignmentSchema.index(
|
|
|
67
62
|
// Index for efficient querying by facility
|
|
68
63
|
assetAssignmentSchema.index({ facilityId: 1 });
|
|
69
64
|
|
|
70
|
-
// Index for date-based queries
|
|
71
|
-
assetAssignmentSchema.index({ assignedDate: 1 });
|
|
72
|
-
assetAssignmentSchema.index({ estimatedCompletionDate: 1 });
|
|
73
|
-
|
|
74
65
|
module.exports = mongoose.model('AssetAssignment', assetAssignmentSchema);
|