payservedb 4.9.3 → 4.9.5
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 +171 -171
- package/package.json +17 -17
- package/src/models/account.js +35 -35
- package/src/models/analog_water_billing.js +58 -58
- package/src/models/apilog.js +18 -18
- package/src/models/approvalsWorkflows.js +49 -49
- package/src/models/archivedapilog.js +18 -18
- package/src/models/archivedauditlog.js +83 -83
- package/src/models/asset.js +34 -34
- package/src/models/auditlog.js +83 -83
- package/src/models/bankdetails.js +40 -40
- package/src/models/bookinganalytics.js +63 -63
- package/src/models/bookingconfig.js +45 -45
- package/src/models/bookingproperty.js +112 -112
- package/src/models/bookingreservation.js +192 -192
- package/src/models/bookingrevenuerecord.js +84 -84
- package/src/models/budget.js +33 -33
- package/src/models/budgetCategory.js +19 -19
- package/src/models/campaigns.js +72 -72
- package/src/models/cashpayment.js +262 -262
- package/src/models/combinedUnits.js +62 -62
- package/src/models/common_area_electricity.js +38 -38
- package/src/models/common_area_generator.js +38 -38
- package/src/models/common_area_utility_alert.js +37 -37
- package/src/models/common_area_water.js +39 -39
- package/src/models/company.js +53 -53
- package/src/models/country_tax.js +42 -42
- package/src/models/currency_settings.js +39 -39
- package/src/models/customer.js +200 -200
- package/src/models/default_payment_details.js +17 -17
- package/src/models/dutyroster.js +129 -129
- package/src/models/email.js +24 -24
- package/src/models/entry_exit.js +53 -53
- package/src/models/expense.js +55 -55
- package/src/models/facility.js +61 -61
- package/src/models/facility_payment_details.js +20 -20
- package/src/models/facilityasset.js +25 -25
- package/src/models/faq.js +18 -18
- package/src/models/gl_accounts.js +56 -56
- package/src/models/gl_entries.js +51 -55
- package/src/models/guard.js +47 -47
- package/src/models/handover.js +241 -241
- package/src/models/invoice.js +291 -291
- package/src/models/item_inspection.js +67 -67
- package/src/models/leaseagreement.js +168 -168
- package/src/models/leasetemplate.js +17 -17
- package/src/models/levy.js +84 -84
- package/src/models/levy_invoice_settings.js +26 -26
- package/src/models/levycontract.js +77 -77
- package/src/models/levytype.js +23 -23
- package/src/models/maintenance_service_vendor.js +38 -38
- package/src/models/maintenance_services.js +17 -17
- package/src/models/maintenancerequisition.js +31 -31
- 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 +76 -76
- package/src/models/purchase_order.js +190 -190
- package/src/models/purchase_request.js +65 -65
- package/src/models/refresh_token.js +23 -23
- package/src/models/reminder.js +161 -161
- package/src/models/report.js +13 -13
- package/src/models/resident.js +121 -121
- package/src/models/rfq_details.js +87 -87
- package/src/models/rfq_response.js +109 -109
- package/src/models/service_charge_invoice_upload.js +42 -42
- package/src/models/service_charge_payments.js +27 -27
- package/src/models/servicerequest.js +55 -55
- package/src/models/settings.js +62 -62
- package/src/models/smart_meter_daily_consumption.js +44 -44
- package/src/models/sms_africastalking.js +20 -20
- package/src/models/sms_meliora.js +16 -16
- package/src/models/staff.js +36 -36
- package/src/models/stocksandspare.js +34 -34
- package/src/models/suppliers.js +68 -68
- package/src/models/tickets.js +109 -109
- package/src/models/unitasset.js +25 -25
- package/src/models/units.js +86 -86
- package/src/models/user.js +183 -183
- package/src/models/valueaddedservices.js +36 -36
- package/src/models/vas_invoices_upload.js +50 -50
- package/src/models/vas_payments.js +24 -24
- package/src/models/vasinvoice.js +159 -159
- package/src/models/vasvendor.js +57 -57
- package/src/models/visitLog.js +86 -86
- package/src/models/visitor.js +63 -63
- package/src/models/waitlist.js +45 -45
- package/src/models/water_invoice.js +192 -192
- package/src/models/water_meter_account.js +74 -74
- package/src/models/water_meter_communication.js +17 -17
- package/src/models/water_meter_concentrator.js +59 -59
- package/src/models/water_meter_daily_history.js +31 -31
- package/src/models/water_meter_iot_cards.js +34 -34
- package/src/models/water_meter_manufacturer.js +35 -35
- package/src/models/water_meter_monthly_history.js +37 -37
- package/src/models/water_meter_settings.js +88 -88
- package/src/models/water_meter_single_day_history.js +31 -31
- package/src/models/water_meter_size.js +15 -15
- package/src/models/water_meters.js +103 -103
- package/src/models/water_meters_delivery.js +76 -76
- package/src/models/workorder.js +49 -49
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const InvoiceSettingsSchema = new mongoose.Schema({
|
|
4
|
-
facilityId: {
|
|
5
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
-
ref: 'Facility',
|
|
7
|
-
required: [true, 'Facility ID is required']
|
|
8
|
-
},
|
|
9
|
-
termsAndConditions: {
|
|
10
|
-
type: String,
|
|
11
|
-
default: 'Payment is due within 15 days'
|
|
12
|
-
},
|
|
13
|
-
bankName: {
|
|
14
|
-
type: String,
|
|
15
|
-
required: [true, 'Bank name is required']
|
|
16
|
-
},
|
|
17
|
-
accountNumber: {
|
|
18
|
-
type: String,
|
|
19
|
-
required: [true, 'Account number is required']
|
|
20
|
-
}
|
|
21
|
-
}, {
|
|
22
|
-
timestamps: true
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const InvoiceSettings = mongoose.model('InvoiceSettings', InvoiceSettingsSchema);
|
|
26
|
-
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const InvoiceSettingsSchema = new mongoose.Schema({
|
|
4
|
+
facilityId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'Facility',
|
|
7
|
+
required: [true, 'Facility ID is required']
|
|
8
|
+
},
|
|
9
|
+
termsAndConditions: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'Payment is due within 15 days'
|
|
12
|
+
},
|
|
13
|
+
bankName: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: [true, 'Bank name is required']
|
|
16
|
+
},
|
|
17
|
+
accountNumber: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: [true, 'Account number is required']
|
|
20
|
+
}
|
|
21
|
+
}, {
|
|
22
|
+
timestamps: true
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const InvoiceSettings = mongoose.model('InvoiceSettings', InvoiceSettingsSchema);
|
|
26
|
+
|
|
27
27
|
module.exports = InvoiceSettings;
|
|
@@ -1,78 +1,78 @@
|
|
|
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
|
-
// We keep paymentFrequency in the schema for backward compatibility
|
|
44
|
-
// But it will now be populated from the levy's collectionFrequency
|
|
45
|
-
paymentFrequency: {
|
|
46
|
-
type: String,
|
|
47
|
-
required: true,
|
|
48
|
-
trim: true
|
|
49
|
-
},
|
|
50
|
-
// New field for balance brought forward
|
|
51
|
-
balanceBroughtForward: {
|
|
52
|
-
type: Number,
|
|
53
|
-
default: 0,
|
|
54
|
-
},
|
|
55
|
-
facilityId: {
|
|
56
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
57
|
-
ref: 'Facility',
|
|
58
|
-
required: true
|
|
59
|
-
},
|
|
60
|
-
// New field to track edit history
|
|
61
|
-
editHistory: [
|
|
62
|
-
{
|
|
63
|
-
editedBy: {
|
|
64
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
65
|
-
ref: 'User'
|
|
66
|
-
},
|
|
67
|
-
editedAt: { type: Date, default: Date.now },
|
|
68
|
-
reason: { type: String, required: true },
|
|
69
|
-
changes: { type: Object } // Store what fields were changed
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
}, {
|
|
73
|
-
timestamps: true
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
const LevyContract = mongoose.model('LevyContract', levyContractSchema);
|
|
77
|
-
|
|
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
|
+
// We keep paymentFrequency in the schema for backward compatibility
|
|
44
|
+
// But it will now be populated from the levy's collectionFrequency
|
|
45
|
+
paymentFrequency: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: true,
|
|
48
|
+
trim: true
|
|
49
|
+
},
|
|
50
|
+
// New field for balance brought forward
|
|
51
|
+
balanceBroughtForward: {
|
|
52
|
+
type: Number,
|
|
53
|
+
default: 0,
|
|
54
|
+
},
|
|
55
|
+
facilityId: {
|
|
56
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
57
|
+
ref: 'Facility',
|
|
58
|
+
required: true
|
|
59
|
+
},
|
|
60
|
+
// New field to track edit history
|
|
61
|
+
editHistory: [
|
|
62
|
+
{
|
|
63
|
+
editedBy: {
|
|
64
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
65
|
+
ref: 'User'
|
|
66
|
+
},
|
|
67
|
+
editedAt: { type: Date, default: Date.now },
|
|
68
|
+
reason: { type: String, required: true },
|
|
69
|
+
changes: { type: Object } // Store what fields were changed
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}, {
|
|
73
|
+
timestamps: true
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const LevyContract = mongoose.model('LevyContract', levyContractSchema);
|
|
77
|
+
|
|
78
78
|
module.exports = LevyContract;
|
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;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const serviceVendorSchema = new mongoose.Schema({
|
|
4
|
-
name: {
|
|
5
|
-
type: String,
|
|
6
|
-
required: true,
|
|
7
|
-
},
|
|
8
|
-
service: {
|
|
9
|
-
type: String,
|
|
10
|
-
required: true,
|
|
11
|
-
},
|
|
12
|
-
agreement: {
|
|
13
|
-
type: String,
|
|
14
|
-
},
|
|
15
|
-
dates: {
|
|
16
|
-
type: [Date],
|
|
17
|
-
},
|
|
18
|
-
assignedAssets: [{
|
|
19
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
20
|
-
ref: 'Asset',
|
|
21
|
-
}],
|
|
22
|
-
facilityId: {
|
|
23
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
24
|
-
ref: 'Facility',
|
|
25
|
-
required: true,
|
|
26
|
-
},
|
|
27
|
-
phone: {
|
|
28
|
-
type: String,
|
|
29
|
-
required: true,
|
|
30
|
-
},
|
|
31
|
-
email: {
|
|
32
|
-
type: String,
|
|
33
|
-
},
|
|
34
|
-
}, {
|
|
35
|
-
timestamps: true,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
module.exports = mongoose.model('ServiceVendor', serviceVendorSchema);
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const serviceVendorSchema = new mongoose.Schema({
|
|
4
|
+
name: {
|
|
5
|
+
type: String,
|
|
6
|
+
required: true,
|
|
7
|
+
},
|
|
8
|
+
service: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
agreement: {
|
|
13
|
+
type: String,
|
|
14
|
+
},
|
|
15
|
+
dates: {
|
|
16
|
+
type: [Date],
|
|
17
|
+
},
|
|
18
|
+
assignedAssets: [{
|
|
19
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
20
|
+
ref: 'Asset',
|
|
21
|
+
}],
|
|
22
|
+
facilityId: {
|
|
23
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
24
|
+
ref: 'Facility',
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
phone: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
email: {
|
|
32
|
+
type: String,
|
|
33
|
+
},
|
|
34
|
+
}, {
|
|
35
|
+
timestamps: true,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
module.exports = mongoose.model('ServiceVendor', serviceVendorSchema);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const maintenanceServicesSchema = new mongoose.Schema({
|
|
4
|
-
name: {
|
|
5
|
-
type: String,
|
|
6
|
-
required: true,
|
|
7
|
-
},
|
|
8
|
-
facilityId: {
|
|
9
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
10
|
-
ref: 'Facility',
|
|
11
|
-
required: true,
|
|
12
|
-
},
|
|
13
|
-
}, {
|
|
14
|
-
timestamps: true,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
module.exports = mongoose.model('MaintenanceServices', maintenanceServicesSchema);
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const maintenanceServicesSchema = new mongoose.Schema({
|
|
4
|
+
name: {
|
|
5
|
+
type: String,
|
|
6
|
+
required: true,
|
|
7
|
+
},
|
|
8
|
+
facilityId: {
|
|
9
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
10
|
+
ref: 'Facility',
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
}, {
|
|
14
|
+
timestamps: true,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
module.exports = mongoose.model('MaintenanceServices', maintenanceServicesSchema);
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const requisitionSchema = new mongoose.Schema({
|
|
4
|
-
facilityId: {
|
|
5
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
-
ref: 'Facility',
|
|
7
|
-
required: [true, 'Facility ID is required']
|
|
8
|
-
},
|
|
9
|
-
stockId: {
|
|
10
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
-
ref: 'Stocksandspare',
|
|
12
|
-
required: [true, 'stock ID is required']
|
|
13
|
-
},
|
|
14
|
-
workId: {
|
|
15
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
16
|
-
ref: 'WorkOrder'
|
|
17
|
-
},
|
|
18
|
-
description: {
|
|
19
|
-
type: String,
|
|
20
|
-
required: true,
|
|
21
|
-
},
|
|
22
|
-
quantity: {
|
|
23
|
-
type: Number,
|
|
24
|
-
required: true,
|
|
25
|
-
min: 1,
|
|
26
|
-
}
|
|
27
|
-
}, {
|
|
28
|
-
timestamps: true,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
module.exports = mongoose.model('StockRequisition', requisitionSchema);
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const requisitionSchema = new mongoose.Schema({
|
|
4
|
+
facilityId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'Facility',
|
|
7
|
+
required: [true, 'Facility ID is required']
|
|
8
|
+
},
|
|
9
|
+
stockId: {
|
|
10
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
+
ref: 'Stocksandspare',
|
|
12
|
+
required: [true, 'stock ID is required']
|
|
13
|
+
},
|
|
14
|
+
workId: {
|
|
15
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
16
|
+
ref: 'WorkOrder'
|
|
17
|
+
},
|
|
18
|
+
description: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
quantity: {
|
|
23
|
+
type: Number,
|
|
24
|
+
required: true,
|
|
25
|
+
min: 1,
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
timestamps: true,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
module.exports = mongoose.model('StockRequisition', requisitionSchema);
|
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;
|