payservedb 8.1.8 → 8.2.0
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 +1 -0
- package/package.json +1 -1
- package/src/models/handover.js +2 -1
- package/src/models/inspection_category.js +38 -0
- package/src/models/levy.js +17 -0
package/index.js
CHANGED
|
@@ -229,6 +229,7 @@ const models = {
|
|
|
229
229
|
KnowledgeBaseRating: require("./src/models/knowledge_base_rating"),
|
|
230
230
|
AgentNotification: require("./src/models/agent_notifications"),
|
|
231
231
|
TicketCategory: require("./src/models/tickets_category"),
|
|
232
|
+
InspectionCategory: require("./src/models/inspection_category"),
|
|
232
233
|
};
|
|
233
234
|
|
|
234
235
|
// Function to get models dynamically from a specific database connection
|
package/package.json
CHANGED
package/src/models/handover.js
CHANGED
|
@@ -165,7 +165,8 @@ const handoverSchema = new mongoose.Schema({
|
|
|
165
165
|
|
|
166
166
|
// Any attached documents
|
|
167
167
|
attachments: [{
|
|
168
|
-
name: String,
|
|
168
|
+
name: String, // Custom descriptive name (e.g., "Chair Image 23")
|
|
169
|
+
fileName: String, // Original file name
|
|
169
170
|
fileUrl: String,
|
|
170
171
|
uploadDate: {
|
|
171
172
|
type: Date,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for inspection categories
|
|
4
|
+
const inspectionCategorySchema = new mongoose.Schema({
|
|
5
|
+
name: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: [true, 'Category name is required'],
|
|
8
|
+
trim: true,
|
|
9
|
+
unique: false // Unique per facility, not globally
|
|
10
|
+
},
|
|
11
|
+
description: {
|
|
12
|
+
type: String,
|
|
13
|
+
trim: true,
|
|
14
|
+
default: ''
|
|
15
|
+
},
|
|
16
|
+
active: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: true
|
|
19
|
+
},
|
|
20
|
+
facilityId: {
|
|
21
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
22
|
+
ref: 'Facility',
|
|
23
|
+
required: true
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
timestamps: true
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Add compound index to ensure unique category names per facility
|
|
30
|
+
inspectionCategorySchema.index({ facilityId: 1, name: 1 }, { unique: true });
|
|
31
|
+
|
|
32
|
+
// Add index for common queries
|
|
33
|
+
inspectionCategorySchema.index({ facilityId: 1 });
|
|
34
|
+
|
|
35
|
+
// Create InspectionCategory model
|
|
36
|
+
const InspectionCategory = mongoose.model('InspectionCategory', inspectionCategorySchema);
|
|
37
|
+
|
|
38
|
+
module.exports = InspectionCategory;
|
package/src/models/levy.js
CHANGED
|
@@ -28,6 +28,23 @@ const levySchema = new mongoose.Schema(
|
|
|
28
28
|
required: true,
|
|
29
29
|
trim: true,
|
|
30
30
|
},
|
|
31
|
+
taxEnabled: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false,
|
|
34
|
+
required: false
|
|
35
|
+
},
|
|
36
|
+
taxRate: {
|
|
37
|
+
type: Number,
|
|
38
|
+
default: 0,
|
|
39
|
+
required: false,
|
|
40
|
+
min: [0, 'Tax rate must be a positive number'],
|
|
41
|
+
max: [100, 'Tax rate cannot exceed 100']
|
|
42
|
+
},
|
|
43
|
+
taxType: {
|
|
44
|
+
type: String,
|
|
45
|
+
enum: ['VAT', 'Withholding', 'ServiceTax', 'Custom'],
|
|
46
|
+
default: 'VAT'
|
|
47
|
+
},
|
|
31
48
|
collectionFrequency: {
|
|
32
49
|
type: String,
|
|
33
50
|
required: true,
|