payservedb 1.5.0 → 1.5.1
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/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for companies
|
|
4
|
+
const InvoiceBillingSettingSchema = new mongoose.Schema({
|
|
5
|
+
dueDays: {
|
|
6
|
+
type: Number,
|
|
7
|
+
required: true,
|
|
8
|
+
min: 1 // Ensures dueDays is at least 1
|
|
9
|
+
},
|
|
10
|
+
note: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
facilityId: {
|
|
15
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
16
|
+
ref: 'Facility',
|
|
17
|
+
required: true // Consider making this required if every setting must be linked to a facility
|
|
18
|
+
}
|
|
19
|
+
}, {
|
|
20
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Indexes for improved performance
|
|
24
|
+
InvoiceBillingSettingSchema.index({ facilityId: 1 }); // Index on facilityId
|
|
25
|
+
|
|
26
|
+
// Compile the model from the schema
|
|
27
|
+
const InvoiceBillingSetting = mongoose.model('InvoiceBillingSetting', InvoiceBillingSettingSchema);
|
|
28
|
+
|
|
29
|
+
module.exports = InvoiceBillingSetting;
|