payservedb 6.5.2 → 6.5.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/package.json +1 -1
- package/src/models/asset.js +86 -29
- package/src/models/leaseagreement.js +1 -27
- package/src/models/water_invoice.js +24 -0
package/package.json
CHANGED
package/src/models/asset.js
CHANGED
|
@@ -1,35 +1,92 @@
|
|
|
1
|
-
const mongoose = require(
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
const inspection_certificate = new mongoose.Schema(
|
|
4
|
+
{
|
|
5
|
+
dateInspected: {
|
|
6
|
+
type: Date,
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
status: {
|
|
10
|
+
type: String,
|
|
11
|
+
enum: ["Passed", "Failed", "Pending"],
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
certificate: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
8
18
|
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
{ _id: false },
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const documents = new mongoose.Schema(
|
|
23
|
+
{
|
|
24
|
+
name: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
type: {
|
|
29
|
+
type: String,
|
|
30
|
+
enum: ["PDF", "Image", "Video"],
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
url: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
17
37
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
38
|
+
{ _id: false },
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const assetSchema = new mongoose.Schema(
|
|
42
|
+
{
|
|
43
|
+
facilityId: {
|
|
44
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
45
|
+
ref: "Facility",
|
|
46
|
+
required: true,
|
|
47
|
+
},
|
|
48
|
+
name: {
|
|
49
|
+
type: String,
|
|
50
|
+
required: true,
|
|
51
|
+
},
|
|
52
|
+
location: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: true,
|
|
55
|
+
},
|
|
56
|
+
inspection_certificate: [
|
|
57
|
+
{
|
|
58
|
+
type: inspection_certificate,
|
|
59
|
+
required: false,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
documents: [
|
|
63
|
+
{
|
|
64
|
+
type: documents,
|
|
65
|
+
required: false,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
serialNumber: {
|
|
69
|
+
type: String,
|
|
70
|
+
unique: true,
|
|
71
|
+
required: true,
|
|
72
|
+
},
|
|
73
|
+
dateBought: {
|
|
74
|
+
type: String,
|
|
75
|
+
required: true,
|
|
76
|
+
},
|
|
77
|
+
insuranceStatus: {
|
|
78
|
+
type: String,
|
|
79
|
+
enum: ["Insured", "Not Insured", "Expired"],
|
|
80
|
+
required: true,
|
|
81
|
+
},
|
|
82
|
+
assigned: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false,
|
|
85
|
+
},
|
|
21
86
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
enum: ['Insured', 'Not Insured', 'Expired'],
|
|
25
|
-
required: true,
|
|
87
|
+
{
|
|
88
|
+
timestamps: true,
|
|
26
89
|
},
|
|
27
|
-
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: false
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
timestamps: true,
|
|
33
|
-
});
|
|
90
|
+
);
|
|
34
91
|
|
|
35
|
-
module.exports = mongoose.model(
|
|
92
|
+
module.exports = mongoose.model("Asset", assetSchema);
|
|
@@ -26,13 +26,10 @@ const leaseAgreementSchema = new mongoose.Schema({
|
|
|
26
26
|
ref: 'Customer',
|
|
27
27
|
required: true
|
|
28
28
|
},
|
|
29
|
-
|
|
30
|
-
// *** NEW FIELD: Add billing address support ***
|
|
31
|
-
billerAddressId: {
|
|
29
|
+
billerAddressId: {
|
|
32
30
|
type: mongoose.Schema.Types.ObjectId,
|
|
33
31
|
ref: 'BillerAddress'
|
|
34
32
|
},
|
|
35
|
-
|
|
36
33
|
// GL Account configurations
|
|
37
34
|
invoiceDoubleEntryAccount: {
|
|
38
35
|
type: mongoose.Schema.Types.ObjectId,
|
|
@@ -99,28 +96,6 @@ const leaseAgreementSchema = new mongoose.Schema({
|
|
|
99
96
|
type: mongoose.Schema.Types.ObjectId,
|
|
100
97
|
ref: 'Penalty'
|
|
101
98
|
},
|
|
102
|
-
|
|
103
|
-
// *** ENHANCED: Add payment configuration flags ***
|
|
104
|
-
bankPayment: {
|
|
105
|
-
type: Boolean,
|
|
106
|
-
default: false
|
|
107
|
-
},
|
|
108
|
-
mobilePayment: {
|
|
109
|
-
type: Boolean,
|
|
110
|
-
default: false
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
// *** ENHANCED: Add structured payment method references ***
|
|
114
|
-
bankAccountId: {
|
|
115
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
116
|
-
ref: 'BankAccount'
|
|
117
|
-
},
|
|
118
|
-
paymentMethodId: {
|
|
119
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
120
|
-
ref: 'PaymentMethod'
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
// Existing M-Pesa fields (keep for backward compatibility)
|
|
124
99
|
mpesaEnabled: {
|
|
125
100
|
type: Boolean,
|
|
126
101
|
default: false
|
|
@@ -130,7 +105,6 @@ const leaseAgreementSchema = new mongoose.Schema({
|
|
|
130
105
|
accountNumber: String,
|
|
131
106
|
phoneNumber: String
|
|
132
107
|
},
|
|
133
|
-
|
|
134
108
|
escalations: [{
|
|
135
109
|
_id: { type: mongoose.Schema.Types.ObjectId, auto: true },
|
|
136
110
|
effectiveDate: { type: Date, required: true },
|
|
@@ -37,6 +37,30 @@ const waterInvoiceSchema = new mongoose.Schema(
|
|
|
37
37
|
default: 0
|
|
38
38
|
},
|
|
39
39
|
|
|
40
|
+
// PAYMENTS
|
|
41
|
+
paymentMethods: {
|
|
42
|
+
mobilePayment: {
|
|
43
|
+
status: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false
|
|
46
|
+
},
|
|
47
|
+
paymentId: {
|
|
48
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
49
|
+
ref: 'FacilityPaymentDetails'
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
bankPayment: {
|
|
53
|
+
status: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
paymentId: {
|
|
58
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
59
|
+
ref: 'BankDetails'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
|
|
40
64
|
// Biller Address Information (added from WaterMeterSettings)
|
|
41
65
|
billerAddress: {
|
|
42
66
|
name: {
|