payservedb 7.0.8 → 7.0.9

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "7.0.8",
3
+ "version": "7.0.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -4,7 +4,8 @@ const waterMeterSettingsSchema = new mongoose.Schema({
4
4
  facilityId: {
5
5
  type: mongoose.Schema.Types.ObjectId,
6
6
  ref: 'Facility',
7
- required: true
7
+ required: true,
8
+ unique: true
8
9
  },
9
10
  minAmount: {
10
11
  type: Number,
@@ -18,9 +19,11 @@ const waterMeterSettingsSchema = new mongoose.Schema({
18
19
  },
19
20
  lowThreshold: {
20
21
  type: Number,
22
+ default: 0
21
23
  },
22
24
  highThreshold: {
23
25
  type: Number,
26
+ default: 0
24
27
  },
25
28
  gracePeriod: {
26
29
  type: Number,
@@ -71,8 +74,9 @@ const waterMeterSettingsSchema = new mongoose.Schema({
71
74
  default: 0
72
75
  },
73
76
 
74
- // Updated notification structure
77
+ // Updated notification structure - separated concerns
75
78
  notifications: {
79
+ // Usage and billing notifications
76
80
  usageAlerts: {
77
81
  enabled: {
78
82
  type: Boolean,
@@ -96,22 +100,28 @@ const waterMeterSettingsSchema = new mongoose.Schema({
96
100
  type: Boolean,
97
101
  default: false
98
102
  }
103
+ },
104
+ // Payment reminder notifications (separate from usage notifications)
105
+ paymentReminders: {
106
+ enabled: {
107
+ type: Boolean,
108
+ default: false
109
+ },
110
+ daysBeforeDue: {
111
+ type: Number,
112
+ default: 3,
113
+ min: 1,
114
+ max: 30
115
+ },
116
+ frequency: {
117
+ type: String,
118
+ enum: ['daily', 'weekly', 'once'],
119
+ default: 'once'
120
+ }
99
121
  }
100
122
  },
101
- dailyNotifications: {
102
- type: Boolean,
103
- default: false
104
- },
105
- weeklyNotifications: {
106
- type: Boolean,
107
- default: false
108
- },
109
- allNotifications: {
110
- type: Boolean,
111
- default: false
112
- },
113
123
 
114
- // Add other charges section
124
+ // Other charges section
115
125
  otherCharges: {
116
126
  type: String,
117
127
  enum: ['yes', 'no'],
@@ -132,7 +142,7 @@ const waterMeterSettingsSchema = new mongoose.Schema({
132
142
  default: 0
133
143
  },
134
144
 
135
- // PAYMENTS
145
+ // Payment methods
136
146
  paymentMethods: {
137
147
  mobilePayment: {
138
148
  status: {
@@ -156,7 +166,7 @@ const waterMeterSettingsSchema = new mongoose.Schema({
156
166
  }
157
167
  },
158
168
 
159
- // Biller Address Information for Invoice Generation
169
+ // Biller address for invoices
160
170
  billerAddress: {
161
171
  name: {
162
172
  type: String,
@@ -193,6 +203,7 @@ const waterMeterSettingsSchema = new mongoose.Schema({
193
203
  }
194
204
  },
195
205
 
206
+ // GL accounts for accounting entries
196
207
  glAccounts: {
197
208
  invoice: {
198
209
  debit: {