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/levytype.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for LevyType
|
|
4
|
-
const levyTypeSchema = new mongoose.Schema({
|
|
5
|
-
name: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: true,
|
|
8
|
-
trim: true,
|
|
9
|
-
minlength: [1, 'Levy type name must be at least 1 character long']
|
|
10
|
-
},
|
|
11
|
-
facilityId: {
|
|
12
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
13
|
-
ref: 'Facility',
|
|
14
|
-
required: [true, 'Facility ID is required']
|
|
15
|
-
}
|
|
16
|
-
}, {
|
|
17
|
-
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// Compile the model from the schema
|
|
21
|
-
const LevyType = mongoose.model('LevyType', levyTypeSchema);
|
|
22
|
-
|
|
23
|
-
module.exports = LevyType;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for LevyType
|
|
4
|
+
const levyTypeSchema = new mongoose.Schema({
|
|
5
|
+
name: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
trim: true,
|
|
9
|
+
minlength: [1, 'Levy type name must be at least 1 character long']
|
|
10
|
+
},
|
|
11
|
+
facilityId: {
|
|
12
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
13
|
+
ref: 'Facility',
|
|
14
|
+
required: [true, 'Facility ID is required']
|
|
15
|
+
}
|
|
16
|
+
}, {
|
|
17
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Compile the model from the schema
|
|
21
|
+
const LevyType = mongoose.model('LevyType', levyTypeSchema);
|
|
22
|
+
|
|
23
|
+
module.exports = LevyType;
|
package/src/models/message.js
CHANGED
|
@@ -1,39 +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);
|
|
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
39
|
module.exports = Message
|
package/src/models/module.js
CHANGED
|
@@ -1,21 +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;
|
|
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;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for Notifications
|
|
4
|
-
const notificationSchema = new mongoose.Schema({
|
|
5
|
-
userId: {
|
|
6
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
7
|
-
ref: 'User',
|
|
8
|
-
required: true
|
|
9
|
-
},
|
|
10
|
-
message: {
|
|
11
|
-
type: String,
|
|
12
|
-
required: true
|
|
13
|
-
},
|
|
14
|
-
dateSent: {
|
|
15
|
-
type: Date,
|
|
16
|
-
required: true
|
|
17
|
-
}
|
|
18
|
-
}, {
|
|
19
|
-
timestamps: true
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const Notification = mongoose.model('Notification', notificationSchema);
|
|
23
|
-
|
|
24
|
-
module.exports = Notification;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for Notifications
|
|
4
|
+
const notificationSchema = new mongoose.Schema({
|
|
5
|
+
userId: {
|
|
6
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
7
|
+
ref: 'User',
|
|
8
|
+
required: true
|
|
9
|
+
},
|
|
10
|
+
message: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
dateSent: {
|
|
15
|
+
type: Date,
|
|
16
|
+
required: true
|
|
17
|
+
}
|
|
18
|
+
}, {
|
|
19
|
+
timestamps: true
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const Notification = mongoose.model('Notification', notificationSchema);
|
|
23
|
+
|
|
24
|
+
module.exports = Notification;
|
package/src/models/penalty.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
|
|
3
|
-
// Define the schema for Penalty
|
|
4
|
-
const penaltySchema = new mongoose.Schema(
|
|
5
|
-
{
|
|
6
|
-
name: {
|
|
7
|
-
type: String,
|
|
8
|
-
required: true,
|
|
9
|
-
},
|
|
10
|
-
type: {
|
|
11
|
-
type: String,
|
|
12
|
-
required: true,
|
|
13
|
-
},
|
|
14
|
-
effectDays: {
|
|
15
|
-
type: Number,
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
percentage: {
|
|
19
|
-
type: Number,
|
|
20
|
-
required: false,
|
|
21
|
-
min: [0, "Percentage must be at least 0"],
|
|
22
|
-
},
|
|
23
|
-
amount: {
|
|
24
|
-
type: Number,
|
|
25
|
-
required: true,
|
|
26
|
-
min: [0, "Amount must be a positive number"],
|
|
27
|
-
},
|
|
28
|
-
module: {
|
|
29
|
-
type: String,
|
|
30
|
-
required: true,
|
|
31
|
-
},
|
|
32
|
-
isActive: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: true,
|
|
35
|
-
},
|
|
36
|
-
facilityId: {
|
|
37
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
38
|
-
ref: "Facility",
|
|
39
|
-
required: true,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
timestamps: true,
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const Penalty = mongoose.model("Penalty", penaltySchema);
|
|
48
|
-
|
|
49
|
-
module.exports = Penalty;
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
// Define the schema for Penalty
|
|
4
|
+
const penaltySchema = new mongoose.Schema(
|
|
5
|
+
{
|
|
6
|
+
name: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
type: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
effectDays: {
|
|
15
|
+
type: Number,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
percentage: {
|
|
19
|
+
type: Number,
|
|
20
|
+
required: false,
|
|
21
|
+
min: [0, "Percentage must be at least 0"],
|
|
22
|
+
},
|
|
23
|
+
amount: {
|
|
24
|
+
type: Number,
|
|
25
|
+
required: true,
|
|
26
|
+
min: [0, "Amount must be a positive number"],
|
|
27
|
+
},
|
|
28
|
+
module: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
isActive: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: true,
|
|
35
|
+
},
|
|
36
|
+
facilityId: {
|
|
37
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
38
|
+
ref: "Facility",
|
|
39
|
+
required: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
timestamps: true,
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const Penalty = mongoose.model("Penalty", penaltySchema);
|
|
48
|
+
|
|
49
|
+
module.exports = Penalty;
|
|
@@ -1,23 +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;
|
|
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;
|
package/src/models/reminder.js
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
|
|
3
|
-
// Define the schema for Reminder
|
|
4
|
-
const reminderSchema = new mongoose.Schema(
|
|
5
|
-
{
|
|
6
|
-
name: {
|
|
7
|
-
type: String,
|
|
8
|
-
required: true,
|
|
9
|
-
trim: true,
|
|
10
|
-
},
|
|
11
|
-
type: {
|
|
12
|
-
type: String,
|
|
13
|
-
enum: ['onetime', 'recurring'],
|
|
14
|
-
required: true,
|
|
15
|
-
},
|
|
16
|
-
frequency: {
|
|
17
|
-
type: String,
|
|
18
|
-
enum: ['daily', 'weekly', 'biweekly', 'monthly'],
|
|
19
|
-
required: function() { return this.type === 'recurring'; },
|
|
20
|
-
},
|
|
21
|
-
scheduledDate: {
|
|
22
|
-
type: Date,
|
|
23
|
-
required: function() { return this.type === 'onetime'; },
|
|
24
|
-
},
|
|
25
|
-
time: {
|
|
26
|
-
type: String,
|
|
27
|
-
required: true,
|
|
28
|
-
},
|
|
29
|
-
day: {
|
|
30
|
-
type: String,
|
|
31
|
-
},
|
|
32
|
-
module: {
|
|
33
|
-
type: String,
|
|
34
|
-
required: true,
|
|
35
|
-
},
|
|
36
|
-
isActive: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
required: true,
|
|
39
|
-
default: true,
|
|
40
|
-
},
|
|
41
|
-
processed: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
required: true,
|
|
44
|
-
default: false,
|
|
45
|
-
},
|
|
46
|
-
notificationTypes: [String],
|
|
47
|
-
message: String,
|
|
48
|
-
levyId: String,
|
|
49
|
-
facilityId: {
|
|
50
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
51
|
-
ref: "Facility",
|
|
52
|
-
required: true,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
timestamps: true,
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
const Reminder = mongoose.model("Reminder", reminderSchema);
|
|
61
|
-
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
// Define the schema for Reminder
|
|
4
|
+
const reminderSchema = new mongoose.Schema(
|
|
5
|
+
{
|
|
6
|
+
name: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
trim: true,
|
|
10
|
+
},
|
|
11
|
+
type: {
|
|
12
|
+
type: String,
|
|
13
|
+
enum: ['onetime', 'recurring'],
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
frequency: {
|
|
17
|
+
type: String,
|
|
18
|
+
enum: ['daily', 'weekly', 'biweekly', 'monthly'],
|
|
19
|
+
required: function() { return this.type === 'recurring'; },
|
|
20
|
+
},
|
|
21
|
+
scheduledDate: {
|
|
22
|
+
type: Date,
|
|
23
|
+
required: function() { return this.type === 'onetime'; },
|
|
24
|
+
},
|
|
25
|
+
time: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
day: {
|
|
30
|
+
type: String,
|
|
31
|
+
},
|
|
32
|
+
module: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
isActive: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
required: true,
|
|
39
|
+
default: true,
|
|
40
|
+
},
|
|
41
|
+
processed: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
required: true,
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
46
|
+
notificationTypes: [String],
|
|
47
|
+
message: String,
|
|
48
|
+
levyId: String,
|
|
49
|
+
facilityId: {
|
|
50
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
51
|
+
ref: "Facility",
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
timestamps: true,
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const Reminder = mongoose.model("Reminder", reminderSchema);
|
|
61
|
+
|
|
62
62
|
module.exports = Reminder;
|
package/src/models/report.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
|
|
3
|
-
const ReportSchema = new mongoose.Schema({
|
|
4
|
-
type: {
|
|
5
|
-
type: String,
|
|
6
|
-
enum: ['revenue', 'leasePerformance', 'expiredLeases'],
|
|
7
|
-
required: true
|
|
8
|
-
},
|
|
9
|
-
data: { type: mongoose.Schema.Types.Mixed, required: true },
|
|
10
|
-
generatedAt: { type: Date, default: Date.now },
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
module.exports = mongoose.model('Report', ReportSchema);
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const ReportSchema = new mongoose.Schema({
|
|
4
|
+
type: {
|
|
5
|
+
type: String,
|
|
6
|
+
enum: ['revenue', 'leasePerformance', 'expiredLeases'],
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
data: { type: mongoose.Schema.Types.Mixed, required: true },
|
|
10
|
+
generatedAt: { type: Date, default: Date.now },
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
module.exports = mongoose.model('Report', ReportSchema);
|
|
14
14
|
|