payservedb 3.5.4 → 3.5.6

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": "3.5.4",
3
+ "version": "3.5.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,6 +1,5 @@
1
1
  const mongoose = require('mongoose');
2
2
 
3
- // Define the schema for Lease Agreements
4
3
  const leaseAgreementSchema = new mongoose.Schema({
5
4
  facilityId: {
6
5
  type: mongoose.Schema.Types.ObjectId,
@@ -38,42 +37,34 @@ const leaseAgreementSchema = new mongoose.Schema({
38
37
  enum: ['Bank Transfer', 'Mobile Money', 'Cash', 'Cheque']
39
38
  },
40
39
  details: {
41
- // For Bank Transfer
42
40
  bankName: String,
43
41
  accountName: String,
44
42
  accountNumber: String,
45
43
  branch: String,
46
44
  swiftCode: String,
47
- // For Mobile Money
48
45
  phoneNumber: String,
49
46
  provider: String,
50
47
  mobileAccountName: String,
51
- // For Cheque
52
48
  bankToDraft: String,
53
49
  chequeAccountNumber: String,
54
- // For Cash
55
50
  preferredCashLocation: String
56
51
  },
57
52
  isPrimary: { type: Boolean, default: false }
58
53
  }],
59
54
  securityDeposit: { type: Number, required: true },
60
- penaltyId: { // Reference to Penalty collection
55
+ penaltyId: {
61
56
  type: mongoose.Schema.Types.ObjectId,
62
57
  ref: 'Penalty'
63
58
  }
64
59
  },
65
60
  billingCycle: {
66
- frequency: { type: String, enum: ['Monthly', 'Quarterly', 'Annually'], required: true },
61
+ frequency: {
62
+ type: String,
63
+ enum: ['Monthly', 'Quarterly', 'Annually'],
64
+ required: true
65
+ },
67
66
  nextInvoiceDate: { type: Date },
68
- autoSend: { type: Boolean, default: false },
69
- overdue: {
70
- reminderDays: {
71
- type: Number,
72
- default: 7,
73
- min: 0,
74
- max: 30 // Reasonable limit for overdue reminders
75
- }
76
- }
67
+ autoSend: { type: Boolean, default: false }
77
68
  },
78
69
  invoices: [
79
70
  { type: mongoose.Schema.Types.ObjectId, ref: 'Invoice' }
@@ -92,11 +83,15 @@ const leaseAgreementSchema = new mongoose.Schema({
92
83
  ],
93
84
  reminders: [
94
85
  {
95
- reminderId: { // Reference to Reminder collection
86
+ reminderId: {
96
87
  type: mongoose.Schema.Types.ObjectId,
97
88
  ref: 'Reminder'
98
89
  },
99
- status: { type: String, enum: ['Pending', 'Sent'], default: 'Pending' }
90
+ status: {
91
+ type: String,
92
+ enum: ['Pending', 'Sent'],
93
+ default: 'Pending'
94
+ }
100
95
  }
101
96
  ],
102
97
  status: {
@@ -106,7 +101,11 @@ const leaseAgreementSchema = new mongoose.Schema({
106
101
  },
107
102
  payments: [
108
103
  {
109
- invoiceId: { type: mongoose.Schema.Types.ObjectId, ref: 'Invoice', required: true },
104
+ invoiceId: {
105
+ type: mongoose.Schema.Types.ObjectId,
106
+ ref: 'Invoice',
107
+ required: true
108
+ },
110
109
  method: {
111
110
  type: {
112
111
  type: String,
@@ -114,7 +113,6 @@ const leaseAgreementSchema = new mongoose.Schema({
114
113
  required: true
115
114
  },
116
115
  details: {
117
- // Capture specific details of the payment method used
118
116
  bankName: String,
119
117
  accountNumber: String,
120
118
  transactionId: String,
@@ -123,7 +121,11 @@ const leaseAgreementSchema = new mongoose.Schema({
123
121
  }
124
122
  },
125
123
  amount: { type: Number, required: true },
126
- receivedBy: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true },
124
+ receivedBy: {
125
+ type: mongoose.Schema.Types.ObjectId,
126
+ ref: 'User',
127
+ required: true
128
+ },
127
129
  receivedAt: { type: Date, default: Date.now }
128
130
  }
129
131
  ],
@@ -22,6 +22,14 @@ const meterSchema = new mongoose.Schema({
22
22
  trim: true,
23
23
  unique: true
24
24
  },
25
+ accountBalance: {
26
+ type: Number,
27
+ trim: true,
28
+ },
29
+ negativeBalance: {
30
+ type: Number,
31
+ trim: true,
32
+ },
25
33
  userType: {
26
34
  type: String,
27
35
  enum: ['postpaid', 'prepaid'],