payservedb 8.4.5 → 8.4.7
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 +2 -0
- package/package.json +1 -1
- package/src/models/customer.js +189 -189
- package/src/models/facility.js +44 -36
- package/src/models/invoice.js +192 -100
- package/src/models/invoicing_schedule.js +6 -1
- package/src/models/zohoAccount.js +453 -0
- package/src/models/zohoItem.js +504 -0
package/index.js
CHANGED
|
@@ -236,6 +236,8 @@ const models = {
|
|
|
236
236
|
DocumentType: require("./src/models/document_type"),
|
|
237
237
|
Counter: require("./src/models/counter_schema"),
|
|
238
238
|
ZohoIntegration: require("./src/models/zohoIntegration"),
|
|
239
|
+
ZohoItem: require("./src/models/zohoItem"),
|
|
240
|
+
ZohoAccount: require("./src/models/zohoAccount"),
|
|
239
241
|
PrivacyPolicy: require("./src/models/privacy_policy"),
|
|
240
242
|
TermsAndConditions: require("./src/models/terms_and_conditions"),
|
|
241
243
|
CommunityGuidelines: require("./src/models/community_guidelines")
|
package/package.json
CHANGED
package/src/models/customer.js
CHANGED
|
@@ -1,210 +1,210 @@
|
|
|
1
|
-
const mongoose = require(
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
2
|
|
|
3
3
|
const CustomerSchema = new mongoose.Schema({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
kraPin: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: null,
|
|
31
|
+
description: "KRA PIN for tax identification (eTims integration)",
|
|
32
|
+
},
|
|
33
|
+
nextOfKin: [
|
|
34
|
+
{
|
|
35
|
+
name: {
|
|
9
36
|
type: String,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
lastName: {
|
|
37
|
+
},
|
|
38
|
+
relationship: {
|
|
13
39
|
type: String,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
phoneNumber: {
|
|
40
|
+
},
|
|
41
|
+
phoneNumber: {
|
|
17
42
|
type: String,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
idNumber: {
|
|
43
|
+
},
|
|
44
|
+
email: {
|
|
21
45
|
type: String,
|
|
22
|
-
|
|
46
|
+
},
|
|
47
|
+
canReceiveInvoice: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false,
|
|
50
|
+
},
|
|
23
51
|
},
|
|
24
|
-
|
|
52
|
+
],
|
|
53
|
+
customerType: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
residentType: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: true,
|
|
60
|
+
},
|
|
61
|
+
facilityId: {
|
|
62
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
63
|
+
ref: "Facility",
|
|
64
|
+
},
|
|
65
|
+
status: {
|
|
66
|
+
type: String,
|
|
67
|
+
required: false,
|
|
68
|
+
enum: ["Active", "Inactive"],
|
|
69
|
+
},
|
|
70
|
+
quickBooksId: {
|
|
71
|
+
type: String,
|
|
72
|
+
},
|
|
73
|
+
nonResidentUsage: {
|
|
74
|
+
type: String,
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
familyMembers: [
|
|
78
|
+
{
|
|
79
|
+
no: {
|
|
80
|
+
type: Number,
|
|
81
|
+
required: false,
|
|
82
|
+
},
|
|
83
|
+
name: {
|
|
25
84
|
type: String,
|
|
26
|
-
required:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
name: {
|
|
31
|
-
type: String,
|
|
32
|
-
},
|
|
33
|
-
relationship: {
|
|
34
|
-
type: String,
|
|
35
|
-
},
|
|
36
|
-
phoneNumber: {
|
|
37
|
-
type: String,
|
|
38
|
-
},
|
|
39
|
-
email: {
|
|
40
|
-
type: String,
|
|
41
|
-
},
|
|
42
|
-
canReceiveInvoice: {
|
|
43
|
-
type: Boolean,
|
|
44
|
-
default: false
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
customerType: {
|
|
49
|
-
type: String,
|
|
50
|
-
required: true
|
|
51
|
-
},
|
|
52
|
-
residentType: {
|
|
85
|
+
required: false,
|
|
86
|
+
},
|
|
87
|
+
phoneNumber: {
|
|
53
88
|
type: String,
|
|
54
|
-
required:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
type:
|
|
58
|
-
|
|
89
|
+
required: false,
|
|
90
|
+
},
|
|
91
|
+
email: {
|
|
92
|
+
type: String,
|
|
93
|
+
required: false,
|
|
94
|
+
},
|
|
95
|
+
relation: {
|
|
96
|
+
type: String,
|
|
97
|
+
required: false,
|
|
98
|
+
},
|
|
99
|
+
qrCode: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
required: false,
|
|
102
|
+
},
|
|
103
|
+
addVisitor: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
required: false,
|
|
106
|
+
},
|
|
107
|
+
receiveMessage: {
|
|
108
|
+
type: Boolean,
|
|
109
|
+
required: false,
|
|
110
|
+
},
|
|
111
|
+
qrUniqueCode: {
|
|
112
|
+
type: String,
|
|
113
|
+
unique: false,
|
|
114
|
+
},
|
|
115
|
+
disabled: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
required: false,
|
|
118
|
+
},
|
|
59
119
|
},
|
|
60
|
-
|
|
120
|
+
],
|
|
121
|
+
staff: [
|
|
122
|
+
{
|
|
123
|
+
no: {
|
|
124
|
+
type: Number,
|
|
125
|
+
required: false,
|
|
126
|
+
},
|
|
127
|
+
name: {
|
|
128
|
+
type: String,
|
|
129
|
+
required: false,
|
|
130
|
+
},
|
|
131
|
+
phoneNumber: {
|
|
132
|
+
type: String,
|
|
133
|
+
required: false,
|
|
134
|
+
},
|
|
135
|
+
jobRole: {
|
|
61
136
|
type: String,
|
|
62
137
|
required: false,
|
|
63
|
-
|
|
138
|
+
},
|
|
139
|
+
qrCode: {
|
|
140
|
+
type: Boolean,
|
|
141
|
+
required: false,
|
|
142
|
+
},
|
|
143
|
+
qrUniqueCode: { type: String, unique: false },
|
|
144
|
+
|
|
145
|
+
disabled: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
required: false,
|
|
148
|
+
},
|
|
64
149
|
},
|
|
65
|
-
|
|
150
|
+
],
|
|
151
|
+
vehicles: [
|
|
152
|
+
{
|
|
153
|
+
no: {
|
|
154
|
+
type: Number,
|
|
155
|
+
required: false,
|
|
156
|
+
},
|
|
157
|
+
registration: {
|
|
158
|
+
type: String,
|
|
159
|
+
required: false,
|
|
160
|
+
},
|
|
161
|
+
name: {
|
|
162
|
+
type: String,
|
|
163
|
+
required: false,
|
|
164
|
+
},
|
|
165
|
+
model: {
|
|
166
|
+
type: String,
|
|
167
|
+
required: false,
|
|
168
|
+
},
|
|
169
|
+
color: {
|
|
170
|
+
type: String,
|
|
171
|
+
required: false,
|
|
172
|
+
},
|
|
173
|
+
plateNumber: {
|
|
66
174
|
type: String,
|
|
175
|
+
required: false,
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
qrCode: {
|
|
179
|
+
type: Boolean,
|
|
180
|
+
required: false,
|
|
181
|
+
},
|
|
182
|
+
qrUniqueCode: { type: String, unique: false },
|
|
183
|
+
disabled: {
|
|
184
|
+
type: Boolean,
|
|
185
|
+
required: false,
|
|
186
|
+
},
|
|
67
187
|
},
|
|
68
|
-
|
|
188
|
+
],
|
|
189
|
+
customerDocuments: [
|
|
190
|
+
{
|
|
191
|
+
documentName: {
|
|
69
192
|
type: String,
|
|
193
|
+
required: true,
|
|
194
|
+
},
|
|
195
|
+
documentType: {
|
|
196
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
197
|
+
ref: "DocumentType",
|
|
198
|
+
required: true,
|
|
199
|
+
},
|
|
200
|
+
document: {
|
|
201
|
+
type: String,
|
|
202
|
+
required: true,
|
|
203
|
+
},
|
|
70
204
|
},
|
|
71
|
-
|
|
72
|
-
familyMembers: [
|
|
73
|
-
{
|
|
74
|
-
no: {
|
|
75
|
-
type: Number,
|
|
76
|
-
required: false
|
|
77
|
-
},
|
|
78
|
-
name: {
|
|
79
|
-
type: String,
|
|
80
|
-
required: false,
|
|
81
|
-
},
|
|
82
|
-
phoneNumber: {
|
|
83
|
-
type: String,
|
|
84
|
-
required: false,
|
|
85
|
-
},
|
|
86
|
-
email: {
|
|
87
|
-
type: String,
|
|
88
|
-
required: false
|
|
89
|
-
},
|
|
90
|
-
relation: {
|
|
91
|
-
type: String,
|
|
92
|
-
required: false,
|
|
93
|
-
},
|
|
94
|
-
qrCode: {
|
|
95
|
-
type: Boolean,
|
|
96
|
-
required: false
|
|
97
|
-
},
|
|
98
|
-
addVisitor: {
|
|
99
|
-
type: Boolean,
|
|
100
|
-
required: false
|
|
101
|
-
},
|
|
102
|
-
receiveMessage: {
|
|
103
|
-
type: Boolean,
|
|
104
|
-
required: false
|
|
105
|
-
},
|
|
106
|
-
qrUniqueCode:
|
|
107
|
-
{
|
|
108
|
-
type: String,
|
|
109
|
-
unique: false
|
|
110
|
-
},
|
|
111
|
-
disabled: {
|
|
112
|
-
type: Boolean,
|
|
113
|
-
required: false
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
staff: [
|
|
118
|
-
{
|
|
119
|
-
no: {
|
|
120
|
-
type: Number,
|
|
121
|
-
required: false
|
|
122
|
-
},
|
|
123
|
-
name: {
|
|
124
|
-
type: String,
|
|
125
|
-
required: false,
|
|
126
|
-
},
|
|
127
|
-
phoneNumber: {
|
|
128
|
-
type: String,
|
|
129
|
-
required: false,
|
|
130
|
-
},
|
|
131
|
-
jobRole: {
|
|
132
|
-
type: String,
|
|
133
|
-
required: false,
|
|
134
|
-
},
|
|
135
|
-
qrCode: {
|
|
136
|
-
type: Boolean,
|
|
137
|
-
required: false
|
|
138
|
-
},
|
|
139
|
-
qrUniqueCode:
|
|
140
|
-
{ type: String, unique: false },
|
|
141
|
-
|
|
142
|
-
disabled: {
|
|
143
|
-
type: Boolean,
|
|
144
|
-
required: false
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
vehicles: [
|
|
150
|
-
{
|
|
151
|
-
no: {
|
|
152
|
-
type: Number,
|
|
153
|
-
required: false
|
|
154
|
-
},
|
|
155
|
-
registration: {
|
|
156
|
-
type: String,
|
|
157
|
-
required: false
|
|
158
|
-
},
|
|
159
|
-
name: {
|
|
160
|
-
type: String,
|
|
161
|
-
required: false
|
|
162
|
-
},
|
|
163
|
-
model: {
|
|
164
|
-
type: String,
|
|
165
|
-
required: false
|
|
166
|
-
},
|
|
167
|
-
color: {
|
|
168
|
-
type: String,
|
|
169
|
-
required: false
|
|
170
|
-
},
|
|
171
|
-
plateNumber: {
|
|
172
|
-
type: String,
|
|
173
|
-
required: false
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
qrCode: {
|
|
177
|
-
type: Boolean,
|
|
178
|
-
required: false
|
|
179
|
-
},
|
|
180
|
-
qrUniqueCode: { type: String, unique: false }
|
|
181
|
-
,
|
|
182
|
-
disabled: {
|
|
183
|
-
type: Boolean,
|
|
184
|
-
required: false
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
customerDocuments: [
|
|
189
|
-
{
|
|
190
|
-
documentName: {
|
|
191
|
-
type: String,
|
|
192
|
-
required: true
|
|
193
|
-
},
|
|
194
|
-
documentType: {
|
|
195
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
196
|
-
ref: "DocumentType",
|
|
197
|
-
required: true,
|
|
198
|
-
},
|
|
199
|
-
document: {
|
|
200
|
-
type: String,
|
|
201
|
-
required: true
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
]
|
|
205
|
-
|
|
205
|
+
],
|
|
206
206
|
});
|
|
207
207
|
|
|
208
|
-
const Customer = mongoose.model(
|
|
208
|
+
const Customer = mongoose.model("Customer", CustomerSchema);
|
|
209
209
|
|
|
210
210
|
module.exports = Customer;
|
package/src/models/facility.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
const mongoose = require(
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
2
|
|
|
3
3
|
// Define the schema for facilities
|
|
4
|
-
const facilitySchema = new mongoose.Schema(
|
|
4
|
+
const facilitySchema = new mongoose.Schema(
|
|
5
|
+
{
|
|
5
6
|
name: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
type: String,
|
|
8
|
+
required: [true, "Facility name is required"],
|
|
9
|
+
trim: true,
|
|
10
|
+
minlength: [1, "Facility name must be at least 1 character long"],
|
|
10
11
|
},
|
|
11
12
|
location: {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
type: String,
|
|
14
|
+
required: true,
|
|
14
15
|
},
|
|
15
16
|
isOnboarded: { type: Boolean, default: false },
|
|
16
17
|
subDivision: { type: String, required: true },
|
|
@@ -21,43 +22,50 @@ const facilitySchema = new mongoose.Schema({
|
|
|
21
22
|
totalCommonArea: { type: String, required: false },
|
|
22
23
|
totalLettableArea: { type: String, required: false },
|
|
23
24
|
modules: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
visitor: { type: Boolean },
|
|
26
|
+
levy: { type: Boolean },
|
|
27
|
+
maintenance: { type: Boolean },
|
|
28
|
+
propertyManagement: { type: Boolean },
|
|
29
|
+
lease: { type: Boolean },
|
|
30
|
+
vas: { type: Boolean },
|
|
31
|
+
tickets: { type: Boolean },
|
|
32
|
+
utility: { type: Boolean },
|
|
33
|
+
booking: { type: Boolean },
|
|
34
|
+
handover: { type: Boolean },
|
|
35
|
+
expense: { type: Boolean },
|
|
36
|
+
campaign: { type: Boolean },
|
|
37
|
+
procurement: { type: Boolean },
|
|
38
|
+
accounts: { type: Boolean },
|
|
38
39
|
},
|
|
39
40
|
|
|
40
41
|
logo: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
type: String,
|
|
43
|
+
trim: false,
|
|
44
|
+
default: null,
|
|
45
|
+
},
|
|
46
|
+
taxNumber: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: null,
|
|
49
|
+
trim: true,
|
|
50
|
+
description: "KRA Tax Identification Number (TIN) for eTims integration",
|
|
44
51
|
},
|
|
45
52
|
dbName: {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
54
|
-
}
|
|
53
|
+
type: String,
|
|
54
|
+
required: [true, "Database name is required"],
|
|
55
|
+
unique: true,
|
|
56
|
+
trim: true,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
timestamps: true, // Automatically add createdAt and updatedAt fields
|
|
61
|
+
},
|
|
62
|
+
);
|
|
55
63
|
|
|
56
64
|
// Indexes for improved performance
|
|
57
65
|
facilitySchema.index({ name: 1 });
|
|
58
66
|
facilitySchema.index({ dbName: 1 });
|
|
59
67
|
|
|
60
68
|
// Compile the model from the schema
|
|
61
|
-
const Facility = mongoose.model(
|
|
69
|
+
const Facility = mongoose.model("Facility", facilitySchema);
|
|
62
70
|
|
|
63
|
-
module.exports = Facility;
|
|
71
|
+
module.exports = Facility;
|