payservedb 2.3.9 → 2.3.11

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 CHANGED
@@ -74,8 +74,9 @@ const models = {
74
74
  LevyContract:require('./src/models/levycontract'),
75
75
  Invoice:require('./src/models/invoice'),
76
76
  Reminder:require('./src/models/reminder'),
77
- Penalty:require('./src/models/penalty,'),
78
- Notifiaction:require('./src/models/notification')
77
+ Penalty:require('./src/models/penalty'),
78
+ Notifiaction:require('./src/models/notification'),
79
+ Resident:require('./src/models/resident')
79
80
  };
80
81
 
81
82
  // Function to get models dynamically from a specific database connection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "2.3.9",
3
+ "version": "2.3.11",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -0,0 +1,121 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ // Define the schema for Resident
4
+ const residentSchema = new mongoose.Schema({
5
+ residentId: {
6
+ type: String,
7
+ required: true,
8
+ unique: true
9
+ },
10
+ name: {
11
+ type: String,
12
+ required: true
13
+ },
14
+ email: {
15
+ type: String,
16
+ required: true
17
+ },
18
+ phone: {
19
+ type: String,
20
+ required: true
21
+ },
22
+ nationalId: {
23
+ type: String,
24
+ required: true
25
+ },
26
+ unitId: {
27
+ type: mongoose.Schema.Types.ObjectId,
28
+ ref: 'Unit',
29
+ required: true
30
+ },
31
+ unitName: {
32
+ type: String,
33
+ required: true
34
+ },
35
+ facilityId: {
36
+ type: mongoose.Schema.Types.ObjectId,
37
+ ref: 'Facility',
38
+ required: true
39
+ },
40
+ contracts: [{
41
+ type: mongoose.Schema.Types.ObjectId,
42
+ ref: 'LevyContract'
43
+ }],
44
+ levies: [{
45
+ type: mongoose.Schema.Types.ObjectId,
46
+ ref: 'Levy'
47
+ }],
48
+ invoices: [{
49
+ type: mongoose.Schema.Types.ObjectId,
50
+ ref: 'Invoice'
51
+ }],
52
+ paymentHistory: [{
53
+ paymentDate: {
54
+ type: Date,
55
+ required: true
56
+ },
57
+ amount: {
58
+ type: Number,
59
+ required: true
60
+ },
61
+ paymentMethod: {
62
+ type: String
63
+ },
64
+ transactionId: {
65
+ type: String
66
+ }
67
+ }],
68
+ status: {
69
+ type: String,
70
+ enum: ['Active', 'Inactive'],
71
+ default: 'Active'
72
+ },
73
+ registrationDate: {
74
+ type: Date,
75
+ default: Date.now
76
+ },
77
+ paymentFrequency: {
78
+ type: String,
79
+ enum: ['Monthly', 'Quarterly', 'Annually']
80
+ },
81
+ notificationPreferences: {
82
+ email: {
83
+ type: Boolean,
84
+ default: true
85
+ },
86
+ sms: {
87
+ type: Boolean,
88
+ default: true
89
+ },
90
+ push: {
91
+ type: Boolean,
92
+ default: true
93
+ }
94
+ },
95
+ reminders: [{
96
+ type: mongoose.Schema.Types.ObjectId,
97
+ ref: 'Reminder'
98
+ }],
99
+ notifications: [{
100
+ type: mongoose.Schema.Types.ObjectId,
101
+ ref: 'Notification'
102
+ }],
103
+ penalties: [{
104
+ type: mongoose.Schema.Types.ObjectId,
105
+ ref: 'Penalty'
106
+ }],
107
+ penaltyStatus: {
108
+ type: String,
109
+ enum: ['Pending', 'Paid', 'Waived'],
110
+ default: 'Pending'
111
+ },
112
+ notes: {
113
+ type: String
114
+ }
115
+ }, {
116
+ timestamps: true
117
+ });
118
+
119
+ const Resident = mongoose.model('Resident', residentSchema);
120
+
121
+ module.exports = Resident;