payservedb 2.5.0 → 2.5.2
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/.env +2 -2
- package/index.js +102 -94
- package/package.json +16 -16
- package/src/models/apilog.js +18 -18
- package/src/models/archivedapilog.js +18 -18
- package/src/models/archivedauditlog.js +83 -83
- package/src/models/asset.js +35 -0
- package/src/models/audit.js +16 -16
- package/src/models/auditlog.js +83 -83
- package/src/models/bankdetails.js +40 -40
- package/src/models/combinedUnits.js +62 -62
- package/src/models/company.js +53 -53
- package/src/models/customer.js +174 -174
- package/src/models/dutyroster.js +33 -0
- package/src/models/email.js +24 -24
- package/src/models/entry_exit.js +53 -53
- package/src/models/facility.js +46 -46
- package/src/models/facilityasset.js +25 -25
- package/src/models/faq.js +18 -18
- package/src/models/guard.js +47 -47
- package/src/models/invoice.js +94 -94
- package/src/models/lease.js +25 -25
- package/src/models/leasetemplate.js +12 -12
- package/src/models/levy.js +63 -63
- package/src/models/levycontract.js +59 -59
- package/src/models/levytype.js +23 -23
- package/src/models/message.js +38 -38
- package/src/models/module.js +21 -21
- package/src/models/notification.js +24 -24
- package/src/models/penalty.js +49 -49
- package/src/models/refresh_token.js +23 -23
- package/src/models/reminder.js +61 -61
- package/src/models/report.js +13 -13
- package/src/models/resident.js +121 -121
- package/src/models/settings.js +19 -19
- package/src/models/sms_africastalking.js +20 -20
- package/src/models/sms_meliora.js +16 -16
- package/src/models/stocksandspare.js +46 -0
- package/src/models/tickets.js +38 -0
- package/src/models/unitasset.js +25 -25
- package/src/models/units.js +70 -70
- package/src/models/user.js +94 -94
- package/src/models/visitLog.js +86 -86
- package/src/models/visitor.js +54 -54
- package/src/models/waitlist.js +45 -45
package/src/models/faq.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
// models/apiLog.js
|
|
2
|
-
const mongoose = require('mongoose');
|
|
3
|
-
const { Schema } = mongoose;
|
|
4
|
-
|
|
5
|
-
const faqSchema = new Schema({
|
|
6
|
-
question:{type:String,required:true},
|
|
7
|
-
answer:{type:String,required:true},
|
|
8
|
-
facilityId: {
|
|
9
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
10
|
-
ref: 'Facility'
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const FAQ = mongoose.model('FAQ', faqSchema);
|
|
17
|
-
|
|
18
|
-
module.exports = FAQ;
|
|
1
|
+
// models/apiLog.js
|
|
2
|
+
const mongoose = require('mongoose');
|
|
3
|
+
const { Schema } = mongoose;
|
|
4
|
+
|
|
5
|
+
const faqSchema = new Schema({
|
|
6
|
+
question:{type:String,required:true},
|
|
7
|
+
answer:{type:String,required:true},
|
|
8
|
+
facilityId: {
|
|
9
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
10
|
+
ref: 'Facility'
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const FAQ = mongoose.model('FAQ', faqSchema);
|
|
17
|
+
|
|
18
|
+
module.exports = FAQ;
|
package/src/models/guard.js
CHANGED
|
@@ -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;
|
package/src/models/invoice.js
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
|
|
3
|
-
// Define the schema for Invoice
|
|
4
|
-
const invoiceSchema = new mongoose.Schema(
|
|
5
|
-
{
|
|
6
|
-
invoiceNumber: {
|
|
7
|
-
type: String,
|
|
8
|
-
required: true,
|
|
9
|
-
unique: true,
|
|
10
|
-
},
|
|
11
|
-
client: {
|
|
12
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
13
|
-
ref: "Customer",
|
|
14
|
-
required: true,
|
|
15
|
-
},
|
|
16
|
-
facility: {
|
|
17
|
-
id: {
|
|
18
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
19
|
-
ref: "Facility",
|
|
20
|
-
required: true,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
unit: {
|
|
24
|
-
id: { type: mongoose.Schema.Types.ObjectId, ref: "Unit", required: true },
|
|
25
|
-
name: { type: String, required: true },
|
|
26
|
-
},
|
|
27
|
-
items: [
|
|
28
|
-
{
|
|
29
|
-
description: { type: String, required: true },
|
|
30
|
-
quantity: { type: Number, required: true, min: 1 },
|
|
31
|
-
unitPrice: { type: Number, required: true, min: 0 },
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
subTotal: {
|
|
35
|
-
type: Number,
|
|
36
|
-
required: true,
|
|
37
|
-
},
|
|
38
|
-
tax: {
|
|
39
|
-
type: Number,
|
|
40
|
-
required: true,
|
|
41
|
-
},
|
|
42
|
-
totalAmount: {
|
|
43
|
-
type: Number,
|
|
44
|
-
required: true,
|
|
45
|
-
},
|
|
46
|
-
issueDate: {
|
|
47
|
-
type: Date,
|
|
48
|
-
required: true,
|
|
49
|
-
},
|
|
50
|
-
dueDate: {
|
|
51
|
-
type: Date,
|
|
52
|
-
required: true,
|
|
53
|
-
},
|
|
54
|
-
status: {
|
|
55
|
-
type: String,
|
|
56
|
-
required: true,
|
|
57
|
-
enum: ["Pending", "Paid", "Overdue"],
|
|
58
|
-
},
|
|
59
|
-
penalty: {
|
|
60
|
-
type: Number,
|
|
61
|
-
default: 0,
|
|
62
|
-
},
|
|
63
|
-
whatFor: {
|
|
64
|
-
invoiceType: { type: String, required: true },
|
|
65
|
-
description: { type: String },
|
|
66
|
-
},
|
|
67
|
-
invoiceNote: {
|
|
68
|
-
type: String,
|
|
69
|
-
default: null,
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
lastReminderSent: Date,
|
|
73
|
-
reminderHistory: [
|
|
74
|
-
{
|
|
75
|
-
sentAt: Date,
|
|
76
|
-
reminderId: mongoose.Schema.Types.ObjectId,
|
|
77
|
-
notificationTypes: [String],
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
paymentDetails: {
|
|
81
|
-
paymentStatus: { type: String, required: true },
|
|
82
|
-
paymentMethod: { type: String },
|
|
83
|
-
paymentDate: { type: Date },
|
|
84
|
-
transactionId: { type: String },
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
timestamps: true,
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
const Invoice = mongoose.model("Invoice", invoiceSchema);
|
|
93
|
-
|
|
94
|
-
module.exports = Invoice;
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
// Define the schema for Invoice
|
|
4
|
+
const invoiceSchema = new mongoose.Schema(
|
|
5
|
+
{
|
|
6
|
+
invoiceNumber: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
unique: true,
|
|
10
|
+
},
|
|
11
|
+
client: {
|
|
12
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
13
|
+
ref: "Customer",
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
facility: {
|
|
17
|
+
id: {
|
|
18
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
19
|
+
ref: "Facility",
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
unit: {
|
|
24
|
+
id: { type: mongoose.Schema.Types.ObjectId, ref: "Unit", required: true },
|
|
25
|
+
name: { type: String, required: true },
|
|
26
|
+
},
|
|
27
|
+
items: [
|
|
28
|
+
{
|
|
29
|
+
description: { type: String, required: true },
|
|
30
|
+
quantity: { type: Number, required: true, min: 1 },
|
|
31
|
+
unitPrice: { type: Number, required: true, min: 0 },
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
subTotal: {
|
|
35
|
+
type: Number,
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
tax: {
|
|
39
|
+
type: Number,
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
totalAmount: {
|
|
43
|
+
type: Number,
|
|
44
|
+
required: true,
|
|
45
|
+
},
|
|
46
|
+
issueDate: {
|
|
47
|
+
type: Date,
|
|
48
|
+
required: true,
|
|
49
|
+
},
|
|
50
|
+
dueDate: {
|
|
51
|
+
type: Date,
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
status: {
|
|
55
|
+
type: String,
|
|
56
|
+
required: true,
|
|
57
|
+
enum: ["Pending", "Paid", "Overdue"],
|
|
58
|
+
},
|
|
59
|
+
penalty: {
|
|
60
|
+
type: Number,
|
|
61
|
+
default: 0,
|
|
62
|
+
},
|
|
63
|
+
whatFor: {
|
|
64
|
+
invoiceType: { type: String, required: true },
|
|
65
|
+
description: { type: String },
|
|
66
|
+
},
|
|
67
|
+
invoiceNote: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: null,
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
lastReminderSent: Date,
|
|
73
|
+
reminderHistory: [
|
|
74
|
+
{
|
|
75
|
+
sentAt: Date,
|
|
76
|
+
reminderId: mongoose.Schema.Types.ObjectId,
|
|
77
|
+
notificationTypes: [String],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
paymentDetails: {
|
|
81
|
+
paymentStatus: { type: String, required: true },
|
|
82
|
+
paymentMethod: { type: String },
|
|
83
|
+
paymentDate: { type: Date },
|
|
84
|
+
transactionId: { type: String },
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
timestamps: true,
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const Invoice = mongoose.model("Invoice", invoiceSchema);
|
|
93
|
+
|
|
94
|
+
module.exports = Invoice;
|
package/src/models/lease.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
|
|
3
|
-
const LeaseSchema = new mongoose.Schema({
|
|
4
|
-
customerId: { type: mongoose.Schema.Types.ObjectId, ref: 'Customer', required: true },
|
|
5
|
-
startDate: { type: Date, required: true },
|
|
6
|
-
endDate: { type: Date, required: true },
|
|
7
|
-
facilityId: { type: mongoose.Schema.Types.ObjectId, ref: 'Facility', required: true },
|
|
8
|
-
rentValue: { type: Number, required: true, min: 0 },
|
|
9
|
-
paymentFrequency: {
|
|
10
|
-
type: String,
|
|
11
|
-
enum: ['monthly', 'quarterly', 'annually'],
|
|
12
|
-
required: true
|
|
13
|
-
},
|
|
14
|
-
levies: { type: [LevySchema], default: [] },
|
|
15
|
-
penalties: { type: [PenaltySchema], default: [] },
|
|
16
|
-
status: {
|
|
17
|
-
type: String,
|
|
18
|
-
enum: ['active', 'expired', 'terminated', 'draft'],
|
|
19
|
-
required: true
|
|
20
|
-
},
|
|
21
|
-
templateId: { type: mongoose.Schema.Types.ObjectId, ref: 'LeaseTemplate', required: true },
|
|
22
|
-
signedCopyUrl: { type: String, match: /^https?:\/\/.*/, required: false },
|
|
23
|
-
unsignedCopyUrl: { type: String, match: /^https?:\/\/.*/, required: false },
|
|
24
|
-
});
|
|
25
|
-
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const LeaseSchema = new mongoose.Schema({
|
|
4
|
+
customerId: { type: mongoose.Schema.Types.ObjectId, ref: 'Customer', required: true },
|
|
5
|
+
startDate: { type: Date, required: true },
|
|
6
|
+
endDate: { type: Date, required: true },
|
|
7
|
+
facilityId: { type: mongoose.Schema.Types.ObjectId, ref: 'Facility', required: true },
|
|
8
|
+
rentValue: { type: Number, required: true, min: 0 },
|
|
9
|
+
paymentFrequency: {
|
|
10
|
+
type: String,
|
|
11
|
+
enum: ['monthly', 'quarterly', 'annually'],
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
levies: { type: [LevySchema], default: [] },
|
|
15
|
+
penalties: { type: [PenaltySchema], default: [] },
|
|
16
|
+
status: {
|
|
17
|
+
type: String,
|
|
18
|
+
enum: ['active', 'expired', 'terminated', 'draft'],
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
templateId: { type: mongoose.Schema.Types.ObjectId, ref: 'LeaseTemplate', required: true },
|
|
22
|
+
signedCopyUrl: { type: String, match: /^https?:\/\/.*/, required: false },
|
|
23
|
+
unsignedCopyUrl: { type: String, match: /^https?:\/\/.*/, required: false },
|
|
24
|
+
});
|
|
25
|
+
|
|
26
26
|
module.exports = mongoose.model('Lease', LeaseSchema);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const LeaseTemplateSchema = new mongoose.Schema({
|
|
5
|
-
name: { type: String, required: true },
|
|
6
|
-
description: { type: String, required: true },
|
|
7
|
-
templateContent: { type: String, required: true },
|
|
8
|
-
createdBy: { type: String, required: true },
|
|
9
|
-
createdAt: { type: Date, default: Date.now },
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
module.exports = mongoose.model('LeaseTemplate', LeaseTemplateSchema);
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const LeaseTemplateSchema = new mongoose.Schema({
|
|
5
|
+
name: { type: String, required: true },
|
|
6
|
+
description: { type: String, required: true },
|
|
7
|
+
templateContent: { type: String, required: true },
|
|
8
|
+
createdBy: { type: String, required: true },
|
|
9
|
+
createdAt: { type: Date, default: Date.now },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
module.exports = mongoose.model('LeaseTemplate', LeaseTemplateSchema);
|
|
13
13
|
|
package/src/models/levy.js
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
|
|
3
|
-
// Define the schema for Levy
|
|
4
|
-
const levySchema = new mongoose.Schema(
|
|
5
|
-
{
|
|
6
|
-
levyName: {
|
|
7
|
-
type: String,
|
|
8
|
-
required: true,
|
|
9
|
-
trim: true,
|
|
10
|
-
minlength: [1, "Levy name must be at least 1 character long"],
|
|
11
|
-
},
|
|
12
|
-
levyType: {
|
|
13
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
14
|
-
ref: "LevyType",
|
|
15
|
-
required: true,
|
|
16
|
-
},
|
|
17
|
-
//Commented out Name field
|
|
18
|
-
// levyTypeName: {
|
|
19
|
-
// type: String,
|
|
20
|
-
// required: true,
|
|
21
|
-
// },
|
|
22
|
-
amount: {
|
|
23
|
-
type: Number,
|
|
24
|
-
required: true,
|
|
25
|
-
min: [0, "Amount must be a positive number"],
|
|
26
|
-
},
|
|
27
|
-
dueDate: {
|
|
28
|
-
type: Number,
|
|
29
|
-
required: true,
|
|
30
|
-
},
|
|
31
|
-
levyApplicant: {
|
|
32
|
-
type: String,
|
|
33
|
-
required: true,
|
|
34
|
-
trim: true,
|
|
35
|
-
},
|
|
36
|
-
collectionFrequency: {
|
|
37
|
-
type: String,
|
|
38
|
-
required: true,
|
|
39
|
-
trim: true,
|
|
40
|
-
},
|
|
41
|
-
invoiceDay: {
|
|
42
|
-
type: Number,
|
|
43
|
-
required: true,
|
|
44
|
-
},
|
|
45
|
-
disabled: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
required: false,
|
|
48
|
-
},
|
|
49
|
-
facilityId: {
|
|
50
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
51
|
-
ref: "Facility",
|
|
52
|
-
required: true,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
timestamps: true,
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
// Compile the model from the schema
|
|
61
|
-
const Levy = mongoose.model("Levy", levySchema);
|
|
62
|
-
|
|
63
|
-
module.exports = Levy;
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
// Define the schema for Levy
|
|
4
|
+
const levySchema = new mongoose.Schema(
|
|
5
|
+
{
|
|
6
|
+
levyName: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
trim: true,
|
|
10
|
+
minlength: [1, "Levy name must be at least 1 character long"],
|
|
11
|
+
},
|
|
12
|
+
levyType: {
|
|
13
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
14
|
+
ref: "LevyType",
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
//Commented out Name field
|
|
18
|
+
// levyTypeName: {
|
|
19
|
+
// type: String,
|
|
20
|
+
// required: true,
|
|
21
|
+
// },
|
|
22
|
+
amount: {
|
|
23
|
+
type: Number,
|
|
24
|
+
required: true,
|
|
25
|
+
min: [0, "Amount must be a positive number"],
|
|
26
|
+
},
|
|
27
|
+
dueDate: {
|
|
28
|
+
type: Number,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
levyApplicant: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: true,
|
|
34
|
+
trim: true,
|
|
35
|
+
},
|
|
36
|
+
collectionFrequency: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: true,
|
|
39
|
+
trim: true,
|
|
40
|
+
},
|
|
41
|
+
invoiceDay: {
|
|
42
|
+
type: Number,
|
|
43
|
+
required: true,
|
|
44
|
+
},
|
|
45
|
+
disabled: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
required: false,
|
|
48
|
+
},
|
|
49
|
+
facilityId: {
|
|
50
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
51
|
+
ref: "Facility",
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
timestamps: true,
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
// Compile the model from the schema
|
|
61
|
+
const Levy = mongoose.model("Levy", levySchema);
|
|
62
|
+
|
|
63
|
+
module.exports = Levy;
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for LevyContract
|
|
4
|
-
const levyContractSchema = new mongoose.Schema({
|
|
5
|
-
contractName: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: true,
|
|
8
|
-
trim: true
|
|
9
|
-
},
|
|
10
|
-
levyId: {
|
|
11
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
12
|
-
ref: 'Levy',
|
|
13
|
-
required: true
|
|
14
|
-
},
|
|
15
|
-
customerId: {
|
|
16
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
17
|
-
ref: 'Customer',
|
|
18
|
-
required: true
|
|
19
|
-
},
|
|
20
|
-
unitId: {
|
|
21
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
22
|
-
ref: 'Unit',
|
|
23
|
-
required: true
|
|
24
|
-
},
|
|
25
|
-
amount: {
|
|
26
|
-
type: Number,
|
|
27
|
-
required: true,
|
|
28
|
-
min: [0, 'Amount must be a positive number']
|
|
29
|
-
},
|
|
30
|
-
startDate: {
|
|
31
|
-
type: Date,
|
|
32
|
-
required: true
|
|
33
|
-
},
|
|
34
|
-
endDate: {
|
|
35
|
-
type: Date,
|
|
36
|
-
required: true
|
|
37
|
-
},
|
|
38
|
-
status: {
|
|
39
|
-
type: String,
|
|
40
|
-
required: true,
|
|
41
|
-
enum: ['Active', 'Inactive']
|
|
42
|
-
},
|
|
43
|
-
paymentFrequency: {
|
|
44
|
-
type: String,
|
|
45
|
-
required: true,
|
|
46
|
-
trim: true
|
|
47
|
-
},
|
|
48
|
-
facilityId: {
|
|
49
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
50
|
-
ref: 'Facility',
|
|
51
|
-
required: true
|
|
52
|
-
}
|
|
53
|
-
}, {
|
|
54
|
-
timestamps: true
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
const LevyContract = mongoose.model('LevyContract', levyContractSchema);
|
|
58
|
-
|
|
59
|
-
module.exports = LevyContract;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for LevyContract
|
|
4
|
+
const levyContractSchema = new mongoose.Schema({
|
|
5
|
+
contractName: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
trim: true
|
|
9
|
+
},
|
|
10
|
+
levyId: {
|
|
11
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
12
|
+
ref: 'Levy',
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
customerId: {
|
|
16
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
17
|
+
ref: 'Customer',
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
20
|
+
unitId: {
|
|
21
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
22
|
+
ref: 'Unit',
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
amount: {
|
|
26
|
+
type: Number,
|
|
27
|
+
required: true,
|
|
28
|
+
min: [0, 'Amount must be a positive number']
|
|
29
|
+
},
|
|
30
|
+
startDate: {
|
|
31
|
+
type: Date,
|
|
32
|
+
required: true
|
|
33
|
+
},
|
|
34
|
+
endDate: {
|
|
35
|
+
type: Date,
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
status: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: true,
|
|
41
|
+
enum: ['Active', 'Inactive']
|
|
42
|
+
},
|
|
43
|
+
paymentFrequency: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: true,
|
|
46
|
+
trim: true
|
|
47
|
+
},
|
|
48
|
+
facilityId: {
|
|
49
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
50
|
+
ref: 'Facility',
|
|
51
|
+
required: true
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
timestamps: true
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const LevyContract = mongoose.model('LevyContract', levyContractSchema);
|
|
58
|
+
|
|
59
|
+
module.exports = LevyContract;
|