payservedb 1.9.1 → 1.9.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.
Files changed (37) hide show
  1. package/index.js +98 -98
  2. package/package.json +15 -15
  3. package/src/models/apilog.js +18 -18
  4. package/src/models/archivedapilog.js +18 -18
  5. package/src/models/archivedauditlog.js +83 -83
  6. package/src/models/auditlog.js +83 -83
  7. package/src/models/bankdetails.js +40 -40
  8. package/src/models/combinedUnits.js +62 -62
  9. package/src/models/company.js +52 -52
  10. package/src/models/contract.js +42 -42
  11. package/src/models/customer.js +169 -129
  12. package/src/models/email.js +24 -24
  13. package/src/models/entry_exit.js +43 -43
  14. package/src/models/facility.js +39 -39
  15. package/src/models/facilityasset.js +25 -25
  16. package/src/models/guard.js +47 -47
  17. package/src/models/invoice.js +105 -105
  18. package/src/models/invoiceBillingSetting.js +29 -29
  19. package/src/models/levy.js +49 -49
  20. package/src/models/levytype.js +19 -19
  21. package/src/models/message.js +38 -38
  22. package/src/models/module.js +21 -21
  23. package/src/models/penalty.js +51 -51
  24. package/src/models/refresh_token.js +23 -23
  25. package/src/models/reminder.js +47 -47
  26. package/src/models/settings.js +19 -19
  27. package/src/models/sms_africastalking.js +20 -20
  28. package/src/models/sms_meliora.js +16 -16
  29. package/src/models/tax.js +35 -35
  30. package/src/models/unitasset.js +25 -25
  31. package/src/models/units.js +66 -66
  32. package/src/models/user.js +81 -81
  33. package/src/models/visitLog.js +83 -83
  34. package/src/models/visitor.js +50 -50
  35. package/src/models/waterConcentrator.js +50 -50
  36. package/src/models/waterMeter.js +50 -50
  37. package/src/models/waterMeterSetting.js +29 -29
@@ -1,129 +1,169 @@
1
- const mongoose = require('mongoose');
2
-
3
- const CustomerSchema = new mongoose.Schema({
4
- customerNumber: {
5
- type: Number,
6
- required: true
7
- },
8
- firstName: {
9
- type: String,
10
- required: true,
11
- },
12
- lastName: {
13
- type: String,
14
- required: true,
15
- },
16
- phoneNumber: {
17
- type: String,
18
- required: true,
19
- },
20
- idNumber: {
21
- type: String,
22
- required: true,
23
- },
24
- email: {
25
- type: String,
26
- required: true
27
- },
28
- nextOfKinName: {
29
- type: String,
30
- required: true
31
- },
32
- nextOfKinRelationship: {
33
- type: String,
34
- required: true
35
- },
36
- nextOfKinContact: {
37
- type: String,
38
- required: true
39
- },
40
- customerType: {
41
- type: String,
42
- required: true
43
- },
44
- residentType: {
45
- type: String,
46
- required: true
47
- },
48
- facilityId: {
49
- type: mongoose.Schema.Types.ObjectId,
50
- ref: 'Facility'
51
- },
52
- status: {
53
- type: String,
54
- required: true,
55
- enum: ['Active', 'Inactive']
56
- },
57
-
58
- familyMembers: [
59
- {
60
- name: {
61
- type: String,
62
- required: false,
63
- },
64
- phoneNumber: {
65
- type: String,
66
- required: false,
67
- },
68
- relation: {
69
- type: String,
70
- required: false,
71
- },
72
- qrCode: {
73
- type: Boolean,
74
- required: false
75
- },
76
- qrUniqueCode: { type: String, unique: true }
77
- },
78
- ],
79
- staff: [
80
- {
81
- name: {
82
- type: String,
83
- required: false,
84
- },
85
- phoneNumber: {
86
- type: String,
87
- required: false,
88
- },
89
- jobRole: {
90
- type: String,
91
- required: false,
92
- },
93
- qrCode: {
94
- type: Boolean,
95
- required: false
96
- },
97
- qrUniqueCode: { type: String, unique: true }
98
- },
99
- ],
100
- vehicles: [
101
- {
102
- registration: {
103
- type: String,
104
- required: false
105
- },
106
- name: {
107
- type: String,
108
- required: false
109
- },
110
- model: {
111
- type: String,
112
- required: false
113
- },
114
- plateNumber: {
115
- type: String,
116
- required: false
117
- },
118
- qrCode: {
119
- type: Boolean,
120
- required: false
121
- },
122
- qrUniqueCode: { type: String, unique: true }
123
- },
124
- ],
125
- });
126
-
127
- const Customer = mongoose.model('Customer', CustomerSchema);
128
-
129
- module.exports = Customer;
1
+ const mongoose = require('mongoose');
2
+
3
+ const CustomerSchema = new mongoose.Schema({
4
+ customerNumber: {
5
+ type: Number,
6
+ required: true
7
+ },
8
+ firstName: {
9
+ type: String,
10
+ required: true,
11
+ },
12
+ lastName: {
13
+ type: String,
14
+ required: true,
15
+ },
16
+ phoneNumber: {
17
+ type: String,
18
+ required: true,
19
+ },
20
+ idNumber: {
21
+ type: String,
22
+ required: true,
23
+ },
24
+ email: {
25
+ type: String,
26
+ required: true
27
+ },
28
+ nextOfKinName: {
29
+ type: String,
30
+ required: true
31
+ },
32
+ nextOfKinRelationship: {
33
+ type: String,
34
+ required: true
35
+ },
36
+ nextOfKinContact: {
37
+ type: String,
38
+ required: true
39
+ },
40
+ customerType: {
41
+ type: String,
42
+ required: true
43
+ },
44
+ residentType: {
45
+ type: String,
46
+ required: true
47
+ },
48
+ facilityId: {
49
+ type: mongoose.Schema.Types.ObjectId,
50
+ ref: 'Facility'
51
+ },
52
+ status: {
53
+ type: String,
54
+ required: true,
55
+ enum: ['Active', 'Inactive']
56
+ },
57
+
58
+ familyMembers: [
59
+ {
60
+ no: {
61
+ type: Number,
62
+ required: true
63
+ },
64
+ name: {
65
+ type: String,
66
+ required: false,
67
+ },
68
+ phoneNumber: {
69
+ type: String,
70
+ required: false,
71
+ },
72
+ relation: {
73
+ type: String,
74
+ required: false,
75
+ },
76
+ qrCode: {
77
+ type: Boolean,
78
+ required: false
79
+ },
80
+ addVisitor:{
81
+ type:Boolean,
82
+ required:false
83
+ },
84
+ receiveMessage:{
85
+ type:Boolean,
86
+ required:false
87
+ },
88
+ qrUniqueCode:
89
+ {
90
+ type: String,
91
+ unique: true
92
+ },
93
+ disabled: {
94
+ type: Boolean,
95
+ required: true
96
+ }
97
+ },
98
+ ],
99
+ staff: [
100
+ {
101
+ no: {
102
+ type: Number,
103
+ required: true
104
+ },
105
+ name: {
106
+ type: String,
107
+ required: false,
108
+ },
109
+ phoneNumber: {
110
+ type: String,
111
+ required: false,
112
+ },
113
+ jobRole: {
114
+ type: String,
115
+ required: false,
116
+ },
117
+ qrCode: {
118
+ type: Boolean,
119
+ required: false
120
+ },
121
+ qrUniqueCode:
122
+ { type: String, unique: true },
123
+
124
+ disabled: {
125
+ type: Boolean,
126
+ required: true
127
+ },
128
+
129
+ },
130
+ ],
131
+ vehicles: [
132
+ {
133
+ no: {
134
+ type: Number,
135
+ required: true
136
+ },
137
+ registration: {
138
+ type: String,
139
+ required: false
140
+ },
141
+ name: {
142
+ type: String,
143
+ required: false
144
+ },
145
+ model: {
146
+ type: String,
147
+ required: false
148
+ },
149
+ plateNumber: {
150
+ type: String,
151
+ required: false
152
+ },
153
+ qrCode: {
154
+ type: Boolean,
155
+ required: false
156
+ },
157
+ qrUniqueCode: { type: String, unique: true }
158
+ ,
159
+ disabled: {
160
+ type: Boolean,
161
+ required: true
162
+ }
163
+ },
164
+ ],
165
+ });
166
+
167
+ const Customer = mongoose.model('Customer', CustomerSchema);
168
+
169
+ module.exports = Customer;
@@ -1,25 +1,25 @@
1
- const mongoose = require('mongoose');
2
- const EmailSchema = mongoose.Schema({
3
- user: {
4
- type: String,
5
- required: true
6
- },
7
- from: {
8
- type: String,
9
- required: true
10
- },
11
- host: {
12
- type: String,
13
- required: true
14
- },
15
- port: {
16
- type: Number,
17
- required: true
18
- },
19
- auth: {
20
- user: String,
21
- pass: String
22
- }
23
- })
24
- const Email = mongoose.model('Email', EmailSchema);
1
+ const mongoose = require('mongoose');
2
+ const EmailSchema = mongoose.Schema({
3
+ user: {
4
+ type: String,
5
+ required: true
6
+ },
7
+ from: {
8
+ type: String,
9
+ required: true
10
+ },
11
+ host: {
12
+ type: String,
13
+ required: true
14
+ },
15
+ port: {
16
+ type: Number,
17
+ required: true
18
+ },
19
+ auth: {
20
+ user: String,
21
+ pass: String
22
+ }
23
+ })
24
+ const Email = mongoose.model('Email', EmailSchema);
25
25
  module.exports = Email
@@ -1,43 +1,43 @@
1
- const mongoose = require('mongoose');
2
-
3
- const EntryExitSchema = mongoose.Schema({
4
- name: {
5
- type: String,
6
- required: true
7
- },
8
- location: {
9
- type: String,
10
- required: true,
11
- },
12
- gps: {
13
- lat: {
14
- type: Number,
15
- required: true
16
- },
17
- lng: {
18
- type: Number,
19
- required: true
20
- }
21
- },
22
- range:{
23
- type:Number,
24
- required:true
25
- },
26
- disabled:{
27
- type:Boolean,
28
- required:true
29
- },
30
- purpose: {
31
- type: String,
32
- required: true,
33
- enum: ['entry/exit', 'entry', 'exit', 'emergency exit']
34
- },
35
- facilityId: {
36
- type: mongoose.Schema.Types.ObjectId,
37
- ref: 'Facility',
38
- }
39
- });
40
-
41
- const EntryExit = mongoose.model('EntryExit', EntryExitSchema);
42
-
43
- module.exports = EntryExit;
1
+ const mongoose = require('mongoose');
2
+
3
+ const EntryExitSchema = mongoose.Schema({
4
+ name: {
5
+ type: String,
6
+ required: true
7
+ },
8
+ location: {
9
+ type: String,
10
+ required: true,
11
+ },
12
+ gps: {
13
+ lat: {
14
+ type: Number,
15
+ required: true
16
+ },
17
+ lng: {
18
+ type: Number,
19
+ required: true
20
+ }
21
+ },
22
+ range:{
23
+ type:Number,
24
+ required:true
25
+ },
26
+ disabled:{
27
+ type:Boolean,
28
+ required:true
29
+ },
30
+ purpose: {
31
+ type: String,
32
+ required: true,
33
+ enum: ['entry/exit', 'entry', 'exit', 'emergency exit']
34
+ },
35
+ facilityId: {
36
+ type: mongoose.Schema.Types.ObjectId,
37
+ ref: 'Facility',
38
+ }
39
+ });
40
+
41
+ const EntryExit = mongoose.model('EntryExit', EntryExitSchema);
42
+
43
+ module.exports = EntryExit;
@@ -1,39 +1,39 @@
1
- const mongoose = require('mongoose');
2
-
3
- // Define the schema for companies
4
- const facilitySchema = new mongoose.Schema({
5
- name: {
6
- type: String,
7
- required: [true, 'Facility name is required'],
8
- trim: true,
9
- minlength: [1, 'Facility name must be at least 1 character long']
10
- },
11
- location: {
12
- type: String,
13
- required: true
14
- },
15
- subDivision: { type: String, required: true },
16
- isEnabled: { type: Boolean, required: true },
17
- divisionArray: [],
18
- landReferenceNumbers: [],
19
- defaultMeasurement: { type: String, required: false },
20
- totalCommonArea: { type: String, required: false },
21
- totalLettableArea: { type: String, required: false },
22
-
23
- logo: {
24
- type: String,
25
- trim: false,
26
- default: null
27
- }
28
-
29
- }, {
30
- timestamps: true // Automatically add createdAt and updatedAt fields
31
- });
32
-
33
- // Indexes for improved performance
34
- facilitySchema.index({ name: 1 });
35
-
36
- // Compile the model from the schema
37
- const Facility = mongoose.model('Facility', facilitySchema);
38
-
39
- module.exports = Facility;
1
+ const mongoose = require('mongoose');
2
+
3
+ // Define the schema for companies
4
+ const facilitySchema = new mongoose.Schema({
5
+ name: {
6
+ type: String,
7
+ required: [true, 'Facility name is required'],
8
+ trim: true,
9
+ minlength: [1, 'Facility name must be at least 1 character long']
10
+ },
11
+ location: {
12
+ type: String,
13
+ required: true
14
+ },
15
+ subDivision: { type: String, required: true },
16
+ isEnabled: { type: Boolean, required: true },
17
+ divisionArray: [],
18
+ landReferenceNumbers: [],
19
+ defaultMeasurement: { type: String, required: false },
20
+ totalCommonArea: { type: String, required: false },
21
+ totalLettableArea: { type: String, required: false },
22
+
23
+ logo: {
24
+ type: String,
25
+ trim: false,
26
+ default: null
27
+ }
28
+
29
+ }, {
30
+ timestamps: true // Automatically add createdAt and updatedAt fields
31
+ });
32
+
33
+ // Indexes for improved performance
34
+ facilitySchema.index({ name: 1 });
35
+
36
+ // Compile the model from the schema
37
+ const Facility = mongoose.model('Facility', facilitySchema);
38
+
39
+ module.exports = Facility;
@@ -1,25 +1,25 @@
1
- const mongoose = require('mongoose');
2
-
3
- // Define the schema for companies
4
- const facilityassetSchema = new mongoose.Schema({
5
- name: {
6
- type: String,
7
- required:true
8
- },
9
- facilityId:{
10
- type: mongoose.Schema.Types.ObjectId,
11
- ref: 'Facility',
12
- }
13
-
14
-
15
- }, {
16
- timestamps: true // Automatically add createdAt and updatedAt fields
17
- });
18
-
19
- // Indexes for improved performance
20
- facilityassetSchema.index({ name: 1 });
21
-
22
- // Compile the model from the schema
23
- const FacilityAsset = mongoose.model('FacilityAsset', facilityassetSchema);
24
-
25
- module.exports = FacilityAsset;
1
+ const mongoose = require('mongoose');
2
+
3
+ // Define the schema for companies
4
+ const facilityassetSchema = new mongoose.Schema({
5
+ name: {
6
+ type: String,
7
+ required:true
8
+ },
9
+ facilityId:{
10
+ type: mongoose.Schema.Types.ObjectId,
11
+ ref: 'Facility',
12
+ }
13
+
14
+
15
+ }, {
16
+ timestamps: true // Automatically add createdAt and updatedAt fields
17
+ });
18
+
19
+ // Indexes for improved performance
20
+ facilityassetSchema.index({ name: 1 });
21
+
22
+ // Compile the model from the schema
23
+ const FacilityAsset = mongoose.model('FacilityAsset', facilityassetSchema);
24
+
25
+ module.exports = FacilityAsset;
@@ -1,47 +1,47 @@
1
- const mongoose = require('mongoose');
2
-
3
- // Define the schema for guards
4
- const guardSchema = new mongoose.Schema({
5
- firstName: {
6
- type: String,
7
- required: true
8
- },
9
- lastName: {
10
- type: String,
11
- required: true
12
- },
13
- phoneNumber: {
14
- type: String,
15
- required: true
16
- },
17
- email:{
18
- type:String,
19
- required:false
20
- },
21
- entryPoints: [],
22
- startTime: {
23
- type: String,
24
- required: true
25
- },
26
- endTime: {
27
- type: String,
28
- required: true
29
- },
30
- status: {
31
- type: String,
32
- required: true,
33
- enum: ["On Duty", "Off Duty", "On Break", "Absent", "Sick Leave", "Suspended"]
34
- },
35
- facilityId: {
36
- type: mongoose.Schema.Types.ObjectId,
37
- ref: 'Facility',
38
- required: true // Assuming facilityId is required
39
- }
40
- }, {
41
- timestamps: true // Automatically adds createdAt and updatedAt fields
42
- });
43
-
44
- // Compile the model from the schema
45
- const Guard = mongoose.model('Guard', guardSchema);
46
-
47
- module.exports = Guard;
1
+ const mongoose = require('mongoose');
2
+
3
+ // Define the schema for guards
4
+ const guardSchema = new mongoose.Schema({
5
+ firstName: {
6
+ type: String,
7
+ required: true
8
+ },
9
+ lastName: {
10
+ type: String,
11
+ required: true
12
+ },
13
+ phoneNumber: {
14
+ type: String,
15
+ required: true
16
+ },
17
+ email:{
18
+ type:String,
19
+ required:false
20
+ },
21
+ entryPoints: [],
22
+ startTime: {
23
+ type: String,
24
+ required: true
25
+ },
26
+ endTime: {
27
+ type: String,
28
+ required: true
29
+ },
30
+ status: {
31
+ type: String,
32
+ required: true,
33
+ enum: ["On Duty", "Off Duty", "On Break", "Absent", "Sick Leave", "Suspended"]
34
+ },
35
+ facilityId: {
36
+ type: mongoose.Schema.Types.ObjectId,
37
+ ref: 'Facility',
38
+ required: true // Assuming facilityId is required
39
+ }
40
+ }, {
41
+ timestamps: true // Automatically adds createdAt and updatedAt fields
42
+ });
43
+
44
+ // Compile the model from the schema
45
+ const Guard = mongoose.model('Guard', guardSchema);
46
+
47
+ module.exports = Guard;