payservedb 6.8.6 → 6.8.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/package.json
CHANGED
|
@@ -1,41 +1,47 @@
|
|
|
1
1
|
const mongoose = require("mongoose");
|
|
2
2
|
|
|
3
|
-
const FacilityContractPricingSchema = new mongoose.Schema(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const FacilityContractPricingSchema = new mongoose.Schema(
|
|
4
|
+
{
|
|
5
|
+
name: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
powerMetersPrice: {
|
|
10
|
+
type: Number,
|
|
11
|
+
required: true,
|
|
12
|
+
min: [0, "Power meters price cannot be negative"],
|
|
13
|
+
default: 0,
|
|
14
|
+
},
|
|
15
|
+
hotWaterMetersPrice: {
|
|
16
|
+
type: Number,
|
|
17
|
+
required: true,
|
|
18
|
+
min: [0, "Hot water meters price cannot be negative"],
|
|
19
|
+
default: 0,
|
|
20
|
+
},
|
|
21
|
+
coldWaterMetersPrice: {
|
|
22
|
+
type: Number,
|
|
23
|
+
required: true,
|
|
24
|
+
min: [0, "Cold water meters price cannot be negative"],
|
|
25
|
+
default: 0,
|
|
26
|
+
},
|
|
27
|
+
unitsPrice: {
|
|
28
|
+
type: Number,
|
|
29
|
+
required: true,
|
|
30
|
+
min: [0, "Units price cannot be negative"],
|
|
31
|
+
default: 0,
|
|
32
|
+
},
|
|
33
|
+
licensePrice: {
|
|
34
|
+
type: Number,
|
|
35
|
+
required: true,
|
|
36
|
+
min: [0, "License price cannot be negative"],
|
|
37
|
+
default: 0,
|
|
38
|
+
},
|
|
7
39
|
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
min: [0, "Power meters price cannot be negative"],
|
|
12
|
-
default: 0,
|
|
13
|
-
},
|
|
14
|
-
hotWaterMetersPrice: {
|
|
15
|
-
type: Number,
|
|
16
|
-
required: true,
|
|
17
|
-
min: [0, "Hot water meters price cannot be negative"],
|
|
18
|
-
default: 0,
|
|
19
|
-
},
|
|
20
|
-
coldWaterMetersPrice: {
|
|
21
|
-
type: Number,
|
|
22
|
-
required: true,
|
|
23
|
-
min: [0, "Cold water meters price cannot be negative"],
|
|
24
|
-
default: 0,
|
|
25
|
-
},
|
|
26
|
-
unitsPrice: {
|
|
27
|
-
type: Number,
|
|
28
|
-
required: true,
|
|
29
|
-
min: [0, "Units price cannot be negative"],
|
|
30
|
-
default: 0,
|
|
31
|
-
},
|
|
32
|
-
licensePrice: {
|
|
33
|
-
type: Number,
|
|
34
|
-
required: true,
|
|
35
|
-
min: [0, "License price cannot be negative"],
|
|
36
|
-
default: 0,
|
|
40
|
+
|
|
41
|
+
{
|
|
42
|
+
timestamps: true,
|
|
37
43
|
},
|
|
38
|
-
|
|
44
|
+
);
|
|
39
45
|
|
|
40
46
|
const FacilityContractPricing = mongoose.model(
|
|
41
47
|
"FacilityContractPricing",
|
|
@@ -1,245 +1,250 @@
|
|
|
1
1
|
const mongoose = require("mongoose");
|
|
2
2
|
|
|
3
|
-
const facilityInvoiceContractSchema = new mongoose.Schema(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
pricing: {
|
|
10
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
-
ref: "FacilityContractPricing",
|
|
12
|
-
required: true,
|
|
13
|
-
},
|
|
14
|
-
name: {
|
|
15
|
-
type: String,
|
|
16
|
-
required: true,
|
|
17
|
-
trim: true,
|
|
18
|
-
},
|
|
19
|
-
phone: {
|
|
20
|
-
type: String,
|
|
21
|
-
required: true,
|
|
22
|
-
trim: true,
|
|
23
|
-
},
|
|
24
|
-
email: {
|
|
25
|
-
type: String,
|
|
26
|
-
required: true,
|
|
27
|
-
trim: true,
|
|
28
|
-
lowercase: true,
|
|
29
|
-
match: [/^\S+@\S+\.\S+$/, "Please enter a valid email address"],
|
|
30
|
-
},
|
|
31
|
-
paymentInterval: {
|
|
32
|
-
type: String,
|
|
33
|
-
enum: ["monthly", "quarterly", "yearly"],
|
|
34
|
-
default: "monthly",
|
|
35
|
-
},
|
|
36
|
-
paymentType: {
|
|
37
|
-
type: String,
|
|
38
|
-
enum: ["prepaid", "postpaid", "cash"],
|
|
39
|
-
default: "cash",
|
|
40
|
-
},
|
|
41
|
-
invoiceDueAfterDays: {
|
|
42
|
-
type: Number,
|
|
43
|
-
required: true,
|
|
44
|
-
min: [0, "Invoice due days cannot be negative"],
|
|
45
|
-
},
|
|
46
|
-
overdueAfterDays: {
|
|
47
|
-
type: Number,
|
|
48
|
-
required: true,
|
|
49
|
-
min: [0, "Overdue days cannot be negative"],
|
|
50
|
-
default: 7,
|
|
51
|
-
},
|
|
52
|
-
prorate: {
|
|
53
|
-
type: Boolean,
|
|
54
|
-
default: false,
|
|
55
|
-
},
|
|
56
|
-
items: [
|
|
57
|
-
{
|
|
58
|
-
itemType: {
|
|
59
|
-
type: String,
|
|
60
|
-
required: true,
|
|
61
|
-
enum: [
|
|
62
|
-
"unit",
|
|
63
|
-
"license",
|
|
64
|
-
"powerMeters",
|
|
65
|
-
"hotWaterMeters",
|
|
66
|
-
"coldWaterMeters",
|
|
67
|
-
],
|
|
68
|
-
trim: true,
|
|
69
|
-
},
|
|
70
|
-
name: {
|
|
71
|
-
type: String,
|
|
72
|
-
required: true,
|
|
73
|
-
trim: true,
|
|
74
|
-
},
|
|
75
|
-
description: {
|
|
76
|
-
type: String,
|
|
77
|
-
required: true,
|
|
78
|
-
trim: true,
|
|
79
|
-
},
|
|
80
|
-
price: {
|
|
81
|
-
type: Number,
|
|
82
|
-
required: true,
|
|
83
|
-
min: [0, "Price cannot be negative"],
|
|
84
|
-
},
|
|
85
|
-
quantity: {
|
|
86
|
-
type: Number,
|
|
87
|
-
required: true,
|
|
88
|
-
min: [1, "Quantity must be at least 1"],
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
reminders: [
|
|
93
|
-
{
|
|
94
|
-
frequency: {
|
|
95
|
-
type: String,
|
|
96
|
-
required: true,
|
|
97
|
-
enum: ["daily", "custom"],
|
|
98
|
-
default: "daily",
|
|
99
|
-
},
|
|
100
|
-
customDays: {
|
|
101
|
-
type: Number,
|
|
102
|
-
required: function () {
|
|
103
|
-
return this.frequency === "custom";
|
|
104
|
-
},
|
|
105
|
-
min: [1, "Custom days must be at least 1"],
|
|
106
|
-
default: null,
|
|
107
|
-
},
|
|
108
|
-
startDate: {
|
|
109
|
-
type: Date,
|
|
110
|
-
required: true,
|
|
111
|
-
},
|
|
112
|
-
status: {
|
|
113
|
-
type: String,
|
|
114
|
-
enum: ["sent", "pending"],
|
|
115
|
-
default: "pending",
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
dates: {
|
|
120
|
-
startDate: {
|
|
121
|
-
type: Date,
|
|
122
|
-
required: true,
|
|
123
|
-
},
|
|
124
|
-
endDate: {
|
|
125
|
-
type: Date,
|
|
126
|
-
required: true,
|
|
127
|
-
},
|
|
128
|
-
invoiceGeneratedDate: {
|
|
129
|
-
type: Date,
|
|
3
|
+
const facilityInvoiceContractSchema = new mongoose.Schema(
|
|
4
|
+
{
|
|
5
|
+
facility: {
|
|
6
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
7
|
+
ref: "Facility",
|
|
130
8
|
required: true,
|
|
131
9
|
},
|
|
132
|
-
|
|
133
|
-
type:
|
|
10
|
+
pricing: {
|
|
11
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
12
|
+
ref: "FacilityContractPricing",
|
|
134
13
|
required: true,
|
|
135
14
|
},
|
|
136
|
-
|
|
137
|
-
signedContractDocument: {
|
|
138
|
-
type: String,
|
|
139
|
-
required: true,
|
|
140
|
-
},
|
|
141
|
-
status: {
|
|
142
|
-
type: String,
|
|
143
|
-
enum: ["pending", "signed", "rejected"],
|
|
144
|
-
default: "pending",
|
|
145
|
-
},
|
|
146
|
-
active: {
|
|
147
|
-
type: Boolean,
|
|
148
|
-
default: true,
|
|
149
|
-
},
|
|
150
|
-
header: {
|
|
151
|
-
companyName: {
|
|
15
|
+
name: {
|
|
152
16
|
type: String,
|
|
153
17
|
required: true,
|
|
154
18
|
trim: true,
|
|
155
19
|
},
|
|
156
|
-
|
|
20
|
+
phone: {
|
|
157
21
|
type: String,
|
|
158
22
|
required: true,
|
|
159
23
|
trim: true,
|
|
160
24
|
},
|
|
161
|
-
|
|
162
|
-
type: String,
|
|
163
|
-
trim: true,
|
|
164
|
-
},
|
|
165
|
-
companyEmail: {
|
|
25
|
+
email: {
|
|
166
26
|
type: String,
|
|
27
|
+
required: true,
|
|
167
28
|
trim: true,
|
|
168
29
|
lowercase: true,
|
|
169
30
|
match: [/^\S+@\S+\.\S+$/, "Please enter a valid email address"],
|
|
170
31
|
},
|
|
171
|
-
|
|
172
|
-
type: String,
|
|
173
|
-
trim: true,
|
|
174
|
-
match: [/^https?:\/\/[^\s$.?#].[^\s]*$/, "Please enter a valid URL"],
|
|
175
|
-
},
|
|
176
|
-
taxNumber: {
|
|
32
|
+
paymentInterval: {
|
|
177
33
|
type: String,
|
|
178
|
-
|
|
34
|
+
enum: ["monthly", "quarterly", "yearly"],
|
|
35
|
+
default: "monthly",
|
|
179
36
|
},
|
|
180
|
-
|
|
37
|
+
paymentType: {
|
|
181
38
|
type: String,
|
|
182
|
-
|
|
39
|
+
enum: ["prepaid", "postpaid", "cash"],
|
|
40
|
+
default: "cash",
|
|
183
41
|
},
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
trim: true,
|
|
189
|
-
},
|
|
190
|
-
accountName: {
|
|
191
|
-
type: String,
|
|
192
|
-
trim: true,
|
|
193
|
-
},
|
|
194
|
-
accountNumber: {
|
|
195
|
-
type: String,
|
|
196
|
-
trim: true,
|
|
42
|
+
invoiceDueAfterDays: {
|
|
43
|
+
type: Number,
|
|
44
|
+
required: true,
|
|
45
|
+
min: [0, "Invoice due days cannot be negative"],
|
|
197
46
|
},
|
|
198
|
-
|
|
199
|
-
type:
|
|
200
|
-
|
|
47
|
+
overdueAfterDays: {
|
|
48
|
+
type: Number,
|
|
49
|
+
required: true,
|
|
50
|
+
min: [0, "Overdue days cannot be negative"],
|
|
51
|
+
default: 7,
|
|
52
|
+
},
|
|
53
|
+
prorate: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
items: [
|
|
58
|
+
{
|
|
59
|
+
itemType: {
|
|
60
|
+
type: String,
|
|
61
|
+
required: true,
|
|
62
|
+
enum: [
|
|
63
|
+
"unit",
|
|
64
|
+
"license",
|
|
65
|
+
"powerMeters",
|
|
66
|
+
"hotWaterMeters",
|
|
67
|
+
"coldWaterMeters",
|
|
68
|
+
],
|
|
69
|
+
trim: true,
|
|
70
|
+
},
|
|
71
|
+
name: {
|
|
72
|
+
type: String,
|
|
73
|
+
required: true,
|
|
74
|
+
trim: true,
|
|
75
|
+
},
|
|
76
|
+
description: {
|
|
77
|
+
type: String,
|
|
78
|
+
required: true,
|
|
79
|
+
trim: true,
|
|
80
|
+
},
|
|
81
|
+
price: {
|
|
82
|
+
type: Number,
|
|
83
|
+
required: true,
|
|
84
|
+
min: [0, "Price cannot be negative"],
|
|
85
|
+
},
|
|
86
|
+
quantity: {
|
|
87
|
+
type: Number,
|
|
88
|
+
required: true,
|
|
89
|
+
min: [1, "Quantity must be at least 1"],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
reminders: [
|
|
94
|
+
{
|
|
95
|
+
frequency: {
|
|
96
|
+
type: String,
|
|
97
|
+
required: true,
|
|
98
|
+
enum: ["daily", "custom"],
|
|
99
|
+
default: "daily",
|
|
100
|
+
},
|
|
101
|
+
customDays: {
|
|
102
|
+
type: Number,
|
|
103
|
+
required: function () {
|
|
104
|
+
return this.frequency === "custom";
|
|
105
|
+
},
|
|
106
|
+
min: [1, "Custom days must be at least 1"],
|
|
107
|
+
default: null,
|
|
108
|
+
},
|
|
109
|
+
startDate: {
|
|
110
|
+
type: Date,
|
|
111
|
+
required: true,
|
|
112
|
+
},
|
|
113
|
+
status: {
|
|
114
|
+
type: String,
|
|
115
|
+
enum: ["sent", "pending"],
|
|
116
|
+
default: "pending",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
dates: {
|
|
121
|
+
startDate: {
|
|
122
|
+
type: Date,
|
|
123
|
+
required: true,
|
|
124
|
+
},
|
|
125
|
+
endDate: {
|
|
126
|
+
type: Date,
|
|
127
|
+
required: true,
|
|
128
|
+
},
|
|
129
|
+
invoiceGeneratedDate: {
|
|
130
|
+
type: Date,
|
|
131
|
+
required: true,
|
|
132
|
+
},
|
|
133
|
+
invoiceDueDate: {
|
|
134
|
+
type: Date,
|
|
135
|
+
required: true,
|
|
136
|
+
},
|
|
201
137
|
},
|
|
202
|
-
|
|
138
|
+
signedContractDocument: {
|
|
203
139
|
type: String,
|
|
204
|
-
|
|
205
|
-
default: "Net 30 days",
|
|
140
|
+
required: true,
|
|
206
141
|
},
|
|
207
|
-
|
|
142
|
+
status: {
|
|
208
143
|
type: String,
|
|
209
|
-
|
|
144
|
+
enum: ["pending", "signed", "rejected"],
|
|
145
|
+
default: "pending",
|
|
210
146
|
},
|
|
211
|
-
|
|
212
|
-
type:
|
|
213
|
-
|
|
147
|
+
active: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
default: true,
|
|
214
150
|
},
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
151
|
+
header: {
|
|
152
|
+
companyName: {
|
|
153
|
+
type: String,
|
|
154
|
+
required: true,
|
|
155
|
+
trim: true,
|
|
156
|
+
},
|
|
157
|
+
companyAddress: {
|
|
158
|
+
type: String,
|
|
159
|
+
required: true,
|
|
160
|
+
trim: true,
|
|
161
|
+
},
|
|
162
|
+
companyPhone: {
|
|
163
|
+
type: String,
|
|
164
|
+
trim: true,
|
|
165
|
+
},
|
|
166
|
+
companyEmail: {
|
|
167
|
+
type: String,
|
|
168
|
+
trim: true,
|
|
169
|
+
lowercase: true,
|
|
170
|
+
match: [/^\S+@\S+\.\S+$/, "Please enter a valid email address"],
|
|
171
|
+
},
|
|
172
|
+
companyWebsite: {
|
|
173
|
+
type: String,
|
|
174
|
+
trim: true,
|
|
175
|
+
match: [/^https?:\/\/[^\s$.?#].[^\s]*$/, "Please enter a valid URL"],
|
|
176
|
+
},
|
|
177
|
+
taxNumber: {
|
|
178
|
+
type: String,
|
|
179
|
+
trim: true,
|
|
180
|
+
},
|
|
181
|
+
logo: {
|
|
182
|
+
type: String,
|
|
183
|
+
default: null,
|
|
184
|
+
},
|
|
218
185
|
},
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
186
|
+
footer: {
|
|
187
|
+
bankName: {
|
|
188
|
+
type: String,
|
|
189
|
+
trim: true,
|
|
190
|
+
},
|
|
191
|
+
accountName: {
|
|
192
|
+
type: String,
|
|
193
|
+
trim: true,
|
|
194
|
+
},
|
|
195
|
+
accountNumber: {
|
|
196
|
+
type: String,
|
|
197
|
+
trim: true,
|
|
198
|
+
},
|
|
199
|
+
swiftCode: {
|
|
200
|
+
type: String,
|
|
201
|
+
trim: true,
|
|
202
|
+
},
|
|
203
|
+
paymentTerms: {
|
|
204
|
+
type: String,
|
|
205
|
+
trim: true,
|
|
206
|
+
default: "Net 30 days",
|
|
207
|
+
},
|
|
208
|
+
latePaymentFee: {
|
|
209
|
+
type: String,
|
|
210
|
+
trim: true,
|
|
211
|
+
},
|
|
212
|
+
taxRate: {
|
|
213
|
+
type: String,
|
|
214
|
+
trim: true,
|
|
215
|
+
},
|
|
216
|
+
additionalNotes: {
|
|
217
|
+
type: String,
|
|
218
|
+
trim: true,
|
|
219
|
+
},
|
|
220
|
+
supportEmail: {
|
|
221
|
+
type: String,
|
|
222
|
+
trim: true,
|
|
223
|
+
lowercase: true,
|
|
224
|
+
match: [/^\S+@\S+\.\S+$/, "Please enter a valid email address"],
|
|
225
|
+
},
|
|
226
|
+
supportPhone: {
|
|
227
|
+
type: String,
|
|
228
|
+
trim: true,
|
|
229
|
+
},
|
|
230
|
+
termsAndConditions: {
|
|
231
|
+
type: String,
|
|
232
|
+
trim: true,
|
|
233
|
+
},
|
|
224
234
|
},
|
|
225
|
-
|
|
226
|
-
type:
|
|
227
|
-
|
|
235
|
+
createdAt: {
|
|
236
|
+
type: Date,
|
|
237
|
+
default: Date.now,
|
|
228
238
|
},
|
|
229
|
-
|
|
230
|
-
type:
|
|
231
|
-
|
|
239
|
+
updatedAt: {
|
|
240
|
+
type: Date,
|
|
241
|
+
default: Date.now,
|
|
232
242
|
},
|
|
233
243
|
},
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
default: Date.now,
|
|
244
|
+
{
|
|
245
|
+
timestamps: true,
|
|
237
246
|
},
|
|
238
|
-
|
|
239
|
-
type: Date,
|
|
240
|
-
default: Date.now,
|
|
241
|
-
},
|
|
242
|
-
});
|
|
247
|
+
);
|
|
243
248
|
|
|
244
249
|
const FacilityInvoiceContract = mongoose.model(
|
|
245
250
|
"FacilityInvoiceContract",
|