lfra_db 1.0.0
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 +3 -0
- package/index.js +100 -0
- package/package.json +16 -0
- package/src/models/apilog.js +18 -0
- package/src/models/archivedapilog.js +18 -0
- package/src/models/archivedauditlog.js +83 -0
- package/src/models/auditlog.js +83 -0
- package/src/models/bankdetails.js +40 -0
- package/src/models/combinedUnits.js +62 -0
- package/src/models/company.js +52 -0
- package/src/models/contract.js +42 -0
- package/src/models/customer.js +174 -0
- package/src/models/email.js +25 -0
- package/src/models/entry_exit.js +53 -0
- package/src/models/facility.js +39 -0
- package/src/models/facilityasset.js +25 -0
- package/src/models/faq.js +18 -0
- package/src/models/guard.js +47 -0
- package/src/models/invoice.js +105 -0
- package/src/models/invoiceBillingSetting.js +29 -0
- package/src/models/john.js +9 -0
- package/src/models/levy.js +49 -0
- package/src/models/levytype.js +19 -0
- package/src/models/message.js +39 -0
- package/src/models/module.js +21 -0
- package/src/models/penalty.js +51 -0
- package/src/models/refresh_token.js +23 -0
- package/src/models/reminder.js +47 -0
- package/src/models/settings.js +19 -0
- package/src/models/sms_africastalking.js +21 -0
- package/src/models/sms_meliora.js +17 -0
- package/src/models/tax.js +35 -0
- package/src/models/unitasset.js +25 -0
- package/src/models/units.js +70 -0
- package/src/models/user.js +94 -0
- package/src/models/visitLog.js +86 -0
- package/src/models/visitor.js +54 -0
- package/src/models/waitlist.js +45 -0
- package/src/models/waterConcentrator.js +50 -0
- package/src/models/waterMeter.js +50 -0
- package/src/models/waterMeterSetting.js +29 -0
|
@@ -0,0 +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);
|
|
25
|
+
module.exports = Email
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
enum: ['Point'],
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
coordinates: {
|
|
19
|
+
type: [Number], // [longitude, latitude] format
|
|
20
|
+
required: true,
|
|
21
|
+
validate: {
|
|
22
|
+
validator: function (value) {
|
|
23
|
+
return value.length === 2;
|
|
24
|
+
},
|
|
25
|
+
message: 'Coordinates must have longitude and latitude'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
range: {
|
|
30
|
+
type: Number,
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
33
|
+
disabled: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
required: true
|
|
36
|
+
},
|
|
37
|
+
purpose: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: true,
|
|
40
|
+
enum: ['entry/exit', 'entry', 'exit', 'emergency exit']
|
|
41
|
+
},
|
|
42
|
+
facilityId: {
|
|
43
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
44
|
+
ref: 'Facility',
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Create a 2dsphere index on the gps field to support geospatial queries
|
|
49
|
+
EntryExitSchema.index({ gps: '2dsphere' });
|
|
50
|
+
|
|
51
|
+
const EntryExit = mongoose.model('EntryExit', EntryExitSchema);
|
|
52
|
+
|
|
53
|
+
module.exports = EntryExit;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const Schema = mongoose.Schema;
|
|
3
|
+
|
|
4
|
+
const InvoiceSchema = new Schema({
|
|
5
|
+
invoiceNumber: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
unique: true,
|
|
9
|
+
},
|
|
10
|
+
client: {
|
|
11
|
+
_id: {
|
|
12
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
13
|
+
ref: 'Customer',
|
|
14
|
+
},
|
|
15
|
+
name: { type: String, required: true },
|
|
16
|
+
email: { type: String, required: true },
|
|
17
|
+
address: { type: String },
|
|
18
|
+
},
|
|
19
|
+
facility: {
|
|
20
|
+
_id: {
|
|
21
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
22
|
+
ref: 'Facility',
|
|
23
|
+
},
|
|
24
|
+
name: { type: String, required: true },
|
|
25
|
+
imageURL: { type: String, required: true }
|
|
26
|
+
},
|
|
27
|
+
unit: {
|
|
28
|
+
_id: {
|
|
29
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
30
|
+
ref: 'Unit',
|
|
31
|
+
},
|
|
32
|
+
name: { type: String, required: true }
|
|
33
|
+
},
|
|
34
|
+
items: [
|
|
35
|
+
{
|
|
36
|
+
description: { type: String, required: true },
|
|
37
|
+
quantity: { type: Number, required: true },
|
|
38
|
+
unitPrice: { type: Number, required: true },
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
subTotal: {
|
|
42
|
+
type: Number,
|
|
43
|
+
required: true,
|
|
44
|
+
default: 0,
|
|
45
|
+
},
|
|
46
|
+
tax: {
|
|
47
|
+
type: Number,
|
|
48
|
+
required: true,
|
|
49
|
+
default: 0,
|
|
50
|
+
},
|
|
51
|
+
totalAmount: {
|
|
52
|
+
type: Number,
|
|
53
|
+
required: true,
|
|
54
|
+
default: 0,
|
|
55
|
+
},
|
|
56
|
+
issueDate: {
|
|
57
|
+
type: Date,
|
|
58
|
+
required: true,
|
|
59
|
+
default: Date.now,
|
|
60
|
+
},
|
|
61
|
+
dueDate: {
|
|
62
|
+
type: Date,
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
|
+
status: {
|
|
66
|
+
type: String,
|
|
67
|
+
enum: ['Pending', 'Paid', 'Cancelled', 'Overdue', 'Partially Paid'],
|
|
68
|
+
default: 'Pending',
|
|
69
|
+
},
|
|
70
|
+
penalty: {
|
|
71
|
+
isApplied: { type: Boolean, default: false },
|
|
72
|
+
penaltyAmount: { type: Number, default: 0 },
|
|
73
|
+
penaltyDate: { type: Date },
|
|
74
|
+
penaltyReason: { type: String },
|
|
75
|
+
},
|
|
76
|
+
whatFor: {
|
|
77
|
+
invoiceType: { type: String, required: true },
|
|
78
|
+
description: { type: String, required: true }
|
|
79
|
+
},
|
|
80
|
+
invoiceNote: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: ''
|
|
83
|
+
},
|
|
84
|
+
paymentDetails: {
|
|
85
|
+
paymentStatus: {
|
|
86
|
+
type: String,
|
|
87
|
+
enum: ['Pending', 'Completed', 'Failed'],
|
|
88
|
+
default: 'Pending'
|
|
89
|
+
},
|
|
90
|
+
paymentMethod: {
|
|
91
|
+
type: String,
|
|
92
|
+
enum: ['Credit Card', 'Bank Transfer', 'PayPal', 'Cash'],
|
|
93
|
+
},
|
|
94
|
+
paymentDate: {
|
|
95
|
+
type: Date,
|
|
96
|
+
},
|
|
97
|
+
transactionId: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: ''
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const Invoice = mongoose.model('Invoice', InvoiceSchema);
|
|
105
|
+
module.exports = Invoice
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for companies
|
|
4
|
+
const InvoiceBillingSettingSchema = new mongoose.Schema({
|
|
5
|
+
dueDays: {
|
|
6
|
+
type: Number,
|
|
7
|
+
required: true,
|
|
8
|
+
min: 1 // Ensures dueDays is at least 1
|
|
9
|
+
},
|
|
10
|
+
levyNote: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
facilityId: {
|
|
15
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
16
|
+
ref: 'Facility',
|
|
17
|
+
required: true // Consider making this required if every setting must be linked to a facility
|
|
18
|
+
}
|
|
19
|
+
}, {
|
|
20
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Indexes for improved performance
|
|
24
|
+
InvoiceBillingSettingSchema.index({ facilityId: 1 }); // Index on facilityId
|
|
25
|
+
|
|
26
|
+
// Compile the model from the schema
|
|
27
|
+
const InvoiceBillingSetting = mongoose.model('InvoiceBillingSetting', InvoiceBillingSettingSchema);
|
|
28
|
+
|
|
29
|
+
module.exports = InvoiceBillingSetting;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
const mongoose = require('mongoose');
|
|
3
|
+
|
|
4
|
+
const LevySchema = new mongoose.Schema({
|
|
5
|
+
levyName: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: [true, 'Levy name is required'],
|
|
8
|
+
trim: true,
|
|
9
|
+
},
|
|
10
|
+
amount: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: [true, 'amount is required'],
|
|
13
|
+
},
|
|
14
|
+
levyType: {
|
|
15
|
+
type: mongoose.Schema.Types.ObjectId, // Update this to reference LevyType
|
|
16
|
+
ref: 'LevyType',
|
|
17
|
+
required: [true, 'Levy type is required'],
|
|
18
|
+
},
|
|
19
|
+
levyApplicant: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: [true, 'Levy applicant is required'],
|
|
22
|
+
trim: true,
|
|
23
|
+
},
|
|
24
|
+
collectionFrequency: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: [true, 'Collection Frequency is required'],
|
|
27
|
+
trim: true,
|
|
28
|
+
enum: ['Monthly', 'Quarterly', 'Annually', 'Semi-annually', 'Weekly']
|
|
29
|
+
},
|
|
30
|
+
invoiceDate: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: [true, 'Invoice Date is required'],
|
|
33
|
+
trim: true,
|
|
34
|
+
},
|
|
35
|
+
disabled: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
facilityId: {
|
|
40
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
41
|
+
ref: 'Facility',
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
timestamps: true, // Automatically add createdAt and updatedAt fields
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const Levy = mongoose.model('Levy', LevySchema);
|
|
48
|
+
|
|
49
|
+
module.exports = Levy;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const LevyTypeSchema = new mongoose.Schema({
|
|
4
|
+
levyType: {
|
|
5
|
+
type: String,
|
|
6
|
+
required: [true, 'Levy type is required'],
|
|
7
|
+
trim: true,
|
|
8
|
+
},
|
|
9
|
+
facilityId: {
|
|
10
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
+
ref: 'Facility',
|
|
12
|
+
}
|
|
13
|
+
}, {
|
|
14
|
+
timestamps: true, // Automatically add createdAt and updatedAt fields
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const LevyType = mongoose.model('LevyType', LevyTypeSchema);
|
|
18
|
+
|
|
19
|
+
module.exports = LevyType;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const MessageSchema = mongoose.Schema({
|
|
3
|
+
type: {
|
|
4
|
+
type: String,
|
|
5
|
+
required: true
|
|
6
|
+
},
|
|
7
|
+
recipient: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
subject: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: false
|
|
14
|
+
},
|
|
15
|
+
body: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true
|
|
18
|
+
},
|
|
19
|
+
sentOn: {
|
|
20
|
+
type: Date,
|
|
21
|
+
required: false
|
|
22
|
+
},
|
|
23
|
+
createdOn:{
|
|
24
|
+
type:Date,
|
|
25
|
+
required:true
|
|
26
|
+
},
|
|
27
|
+
status: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
enum: ['Not Sent', 'In Queue', 'Sent']
|
|
31
|
+
},
|
|
32
|
+
messageId: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: false
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
})
|
|
38
|
+
const Message = mongoose.model('Message', MessageSchema);
|
|
39
|
+
module.exports = Message
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for modules
|
|
4
|
+
const moduleSchema = new mongoose.Schema({
|
|
5
|
+
name: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: [true, 'Module name is required'],
|
|
8
|
+
trim: true,
|
|
9
|
+
unique: true // Ensure module name is unique
|
|
10
|
+
}
|
|
11
|
+
}, {
|
|
12
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// Indexes for improved performance
|
|
16
|
+
moduleSchema.index({ name: 1 });
|
|
17
|
+
|
|
18
|
+
// Compile the model from the schema
|
|
19
|
+
const Module = mongoose.model('Module', moduleSchema);
|
|
20
|
+
|
|
21
|
+
module.exports = Module;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for companies
|
|
4
|
+
const penaltySchema = new mongoose.Schema({
|
|
5
|
+
title: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
module: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
effectDays: {
|
|
18
|
+
type: Number,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
percentage: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
amount: {
|
|
26
|
+
type: Number,
|
|
27
|
+
required: true
|
|
28
|
+
},
|
|
29
|
+
isActive: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
33
|
+
disabled:{
|
|
34
|
+
type:Boolean,
|
|
35
|
+
required:true
|
|
36
|
+
},
|
|
37
|
+
facilityId: {
|
|
38
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
39
|
+
ref: 'Facility',
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Indexes for improved performance
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// Compile the model from the schema
|
|
49
|
+
const Penalty = mongoose.model('Penalty', penaltySchema);
|
|
50
|
+
|
|
51
|
+
module.exports = Penalty;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const refreshTokenSchema = new mongoose.Schema({
|
|
4
|
+
userId: {
|
|
5
|
+
type: String,
|
|
6
|
+
required: true,
|
|
7
|
+
index: true, // Index for faster lookup by userId
|
|
8
|
+
},
|
|
9
|
+
token: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
createdAt: {
|
|
14
|
+
type: Date,
|
|
15
|
+
required: true,
|
|
16
|
+
default: Date.now,
|
|
17
|
+
expires: '30d', // Example: Token expires after 30 days
|
|
18
|
+
},
|
|
19
|
+
},{timestamps: true});
|
|
20
|
+
|
|
21
|
+
const RefreshToken = mongoose.model('RefreshToken', refreshTokenSchema);
|
|
22
|
+
|
|
23
|
+
module.exports = RefreshToken;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for companies
|
|
4
|
+
const reminderSchema = new mongoose.Schema({
|
|
5
|
+
title: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
module: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
time: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
day: {
|
|
22
|
+
type: Number,
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
isActive: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
required: true
|
|
28
|
+
},
|
|
29
|
+
disabled:{
|
|
30
|
+
type:Boolean,
|
|
31
|
+
required:true
|
|
32
|
+
},
|
|
33
|
+
facilityId: {
|
|
34
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
35
|
+
ref: 'Facility',
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Indexes for improved performance
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
// Compile the model from the schema
|
|
45
|
+
const Reminder = mongoose.model('Reminder', reminderSchema);
|
|
46
|
+
|
|
47
|
+
module.exports = Reminder;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const SettingsSchema = new mongoose.Schema({
|
|
4
|
+
name: {
|
|
5
|
+
type: String,
|
|
6
|
+
required:true
|
|
7
|
+
},
|
|
8
|
+
size: {
|
|
9
|
+
type: String,
|
|
10
|
+
required:true
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
}, {
|
|
14
|
+
timestamps: true, // Automatically add createdAt and updatedAt fields
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const Settings = mongoose.model('Settings', SettingsSchema);
|
|
18
|
+
|
|
19
|
+
module.exports = Settings;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const SMSAfricastalkingSchema = mongoose.Schema({
|
|
3
|
+
user: {
|
|
4
|
+
type: String,
|
|
5
|
+
required: true
|
|
6
|
+
},
|
|
7
|
+
senderId: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true
|
|
10
|
+
},
|
|
11
|
+
userName: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
apiKey: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
const SMSAfricastalking = mongoose.model('SMSAfricastalking', SMSAfricastalkingSchema);
|
|
21
|
+
module.exports = SMSAfricastalking
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const SMSMelioraSchema = mongoose.Schema({
|
|
3
|
+
user: {
|
|
4
|
+
type: String,
|
|
5
|
+
required: true
|
|
6
|
+
},
|
|
7
|
+
senderId: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true
|
|
10
|
+
},
|
|
11
|
+
apiKey: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
const SMSMeliora = mongoose.model('SMSMeliora', SMSMelioraSchema);
|
|
17
|
+
module.exports = SMSMeliora
|