payservedb 5.2.5 → 5.2.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.
Files changed (103) hide show
  1. package/.env +2 -2
  2. package/index.js +172 -172
  3. package/package.json +17 -17
  4. package/src/models/account.js +35 -35
  5. package/src/models/analog_water_billing.js +58 -58
  6. package/src/models/apilog.js +18 -18
  7. package/src/models/approvalsWorkflows.js +49 -49
  8. package/src/models/archivedapilog.js +18 -18
  9. package/src/models/archivedauditlog.js +83 -83
  10. package/src/models/asset.js +34 -34
  11. package/src/models/auditlog.js +83 -83
  12. package/src/models/bankdetails.js +40 -40
  13. package/src/models/bookinganalytics.js +63 -63
  14. package/src/models/bookingconfig.js +45 -45
  15. package/src/models/bookingproperty.js +112 -112
  16. package/src/models/bookingreservation.js +192 -192
  17. package/src/models/bookingrevenuerecord.js +84 -84
  18. package/src/models/budget.js +33 -33
  19. package/src/models/budgetCategory.js +19 -19
  20. package/src/models/campaigns.js +72 -72
  21. package/src/models/cashpayment.js +262 -262
  22. package/src/models/combinedUnits.js +62 -62
  23. package/src/models/common_area_electricity.js +38 -38
  24. package/src/models/common_area_generator.js +41 -41
  25. package/src/models/common_area_utility_alert.js +37 -37
  26. package/src/models/common_area_water.js +39 -39
  27. package/src/models/company.js +53 -53
  28. package/src/models/country_tax.js +42 -42
  29. package/src/models/currency_settings.js +39 -39
  30. package/src/models/customer.js +200 -200
  31. package/src/models/default_payment_details.js +17 -17
  32. package/src/models/dutyroster.js +107 -107
  33. package/src/models/email.js +24 -24
  34. package/src/models/entry_exit.js +53 -53
  35. package/src/models/expense.js +55 -55
  36. package/src/models/facility.js +61 -61
  37. package/src/models/facility_payment_details.js +20 -20
  38. package/src/models/facilityasset.js +25 -25
  39. package/src/models/faq.js +18 -18
  40. package/src/models/gl_account_double_entries.js +25 -25
  41. package/src/models/gl_accounts.js +56 -56
  42. package/src/models/gl_entries.js +49 -49
  43. package/src/models/guard.js +47 -47
  44. package/src/models/handover.js +241 -241
  45. package/src/models/invoice.js +336 -336
  46. package/src/models/item_inspection.js +67 -67
  47. package/src/models/leaseagreement.js +221 -221
  48. package/src/models/leasetemplate.js +17 -17
  49. package/src/models/levy.js +84 -84
  50. package/src/models/levy_invoice_settings.js +26 -26
  51. package/src/models/levycontract.js +158 -158
  52. package/src/models/levytype.js +23 -23
  53. package/src/models/maintenance_service_vendor.js +38 -38
  54. package/src/models/maintenance_services.js +17 -17
  55. package/src/models/maintenancerequisition.js +31 -31
  56. package/src/models/message.js +38 -38
  57. package/src/models/module.js +21 -21
  58. package/src/models/notification.js +24 -24
  59. package/src/models/penalty.js +76 -76
  60. package/src/models/purchase_order.js +190 -190
  61. package/src/models/purchase_request.js +65 -65
  62. package/src/models/refresh_token.js +23 -23
  63. package/src/models/reminder.js +197 -197
  64. package/src/models/report.js +13 -13
  65. package/src/models/resident.js +121 -121
  66. package/src/models/rfq_details.js +87 -87
  67. package/src/models/rfq_response.js +99 -109
  68. package/src/models/service_charge_invoice_upload.js +42 -42
  69. package/src/models/service_charge_payments.js +27 -27
  70. package/src/models/servicerequest.js +55 -55
  71. package/src/models/settings.js +62 -62
  72. package/src/models/smart_meter_daily_consumption.js +44 -44
  73. package/src/models/sms_africastalking.js +20 -20
  74. package/src/models/sms_meliora.js +16 -16
  75. package/src/models/staff.js +36 -36
  76. package/src/models/stocksandspare.js +34 -34
  77. package/src/models/suppliers.js +74 -74
  78. package/src/models/tickets.js +109 -109
  79. package/src/models/unitasset.js +25 -25
  80. package/src/models/units.js +94 -94
  81. package/src/models/user.js +187 -187
  82. package/src/models/valueaddedservices.js +36 -36
  83. package/src/models/vas_invoices_upload.js +50 -50
  84. package/src/models/vas_payments.js +24 -24
  85. package/src/models/vasinvoice.js +159 -159
  86. package/src/models/vasvendor.js +57 -57
  87. package/src/models/visitLog.js +86 -86
  88. package/src/models/visitor.js +67 -67
  89. package/src/models/waitlist.js +45 -45
  90. package/src/models/water_invoice.js +192 -192
  91. package/src/models/water_meter_account.js +73 -73
  92. package/src/models/water_meter_communication.js +17 -17
  93. package/src/models/water_meter_concentrator.js +59 -59
  94. package/src/models/water_meter_daily_history.js +31 -31
  95. package/src/models/water_meter_iot_cards.js +34 -34
  96. package/src/models/water_meter_manufacturer.js +35 -35
  97. package/src/models/water_meter_monthly_history.js +36 -36
  98. package/src/models/water_meter_settings.js +88 -88
  99. package/src/models/water_meter_single_day_history.js +29 -29
  100. package/src/models/water_meter_size.js +15 -15
  101. package/src/models/water_meters.js +106 -106
  102. package/src/models/water_meters_delivery.js +76 -76
  103. package/src/models/workorder.js +49 -49
@@ -1,85 +1,85 @@
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
- amount: {
18
- type: Number,
19
- required: true,
20
- min: [0, "Amount must be a positive number"],
21
- },
22
- dueDate: {
23
- type: String,
24
- required: true,
25
- },
26
- levyApplicant: {
27
- type: String,
28
- required: true,
29
- trim: true,
30
- },
31
- collectionFrequency: {
32
- type: String,
33
- required: true,
34
- trim: true,
35
- },
36
- invoiceDay: {
37
- type: String,
38
- required: true,
39
- },
40
- // New fields added from levy contract
41
- currency: {
42
- type: mongoose.Schema.Types.ObjectId,
43
- ref: "Currency",
44
- required: false,
45
- },
46
- mobilePayment: {
47
- type: Boolean,
48
- default: false,
49
- required: false,
50
- },
51
- paymentMethodId: {
52
- type: mongoose.Schema.Types.ObjectId,
53
- required: false,
54
- },
55
- disabled: {
56
- type: Boolean,
57
- required: false,
58
- },
59
- facilityId: {
60
- type: mongoose.Schema.Types.ObjectId,
61
- ref: "Facility",
62
- required: true,
63
- },
64
- // Added reminder reference
65
- reminderId: {
66
- type: mongoose.Schema.Types.ObjectId,
67
- ref: 'Reminder',
68
- required: false
69
- },
70
- // Added penalty reference
71
- penaltyId: {
72
- type: mongoose.Schema.Types.ObjectId,
73
- ref: 'Penalty',
74
- required: false
75
- }
76
- },
77
- {
78
- timestamps: true,
79
- }
80
- );
81
-
82
- // Compile the model from the schema
83
- const Levy = mongoose.model("Levy", levySchema);
84
-
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
+ amount: {
18
+ type: Number,
19
+ required: true,
20
+ min: [0, "Amount must be a positive number"],
21
+ },
22
+ dueDate: {
23
+ type: String,
24
+ required: true,
25
+ },
26
+ levyApplicant: {
27
+ type: String,
28
+ required: true,
29
+ trim: true,
30
+ },
31
+ collectionFrequency: {
32
+ type: String,
33
+ required: true,
34
+ trim: true,
35
+ },
36
+ invoiceDay: {
37
+ type: String,
38
+ required: true,
39
+ },
40
+ // New fields added from levy contract
41
+ currency: {
42
+ type: mongoose.Schema.Types.ObjectId,
43
+ ref: "Currency",
44
+ required: false,
45
+ },
46
+ mobilePayment: {
47
+ type: Boolean,
48
+ default: false,
49
+ required: false,
50
+ },
51
+ paymentMethodId: {
52
+ type: mongoose.Schema.Types.ObjectId,
53
+ required: false,
54
+ },
55
+ disabled: {
56
+ type: Boolean,
57
+ required: false,
58
+ },
59
+ facilityId: {
60
+ type: mongoose.Schema.Types.ObjectId,
61
+ ref: "Facility",
62
+ required: true,
63
+ },
64
+ // Added reminder reference
65
+ reminderId: {
66
+ type: mongoose.Schema.Types.ObjectId,
67
+ ref: 'Reminder',
68
+ required: false
69
+ },
70
+ // Added penalty reference
71
+ penaltyId: {
72
+ type: mongoose.Schema.Types.ObjectId,
73
+ ref: 'Penalty',
74
+ required: false
75
+ }
76
+ },
77
+ {
78
+ timestamps: true,
79
+ }
80
+ );
81
+
82
+ // Compile the model from the schema
83
+ const Levy = mongoose.model("Levy", levySchema);
84
+
85
85
  module.exports = Levy;
@@ -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,159 +1,159 @@
1
- const mongoose = require('mongoose');
2
- const Schema = mongoose.Schema;
3
-
4
- const LevyContractSchema = new Schema(
5
- {
6
- contractName: {
7
- type: String,
8
- required: [true, 'Contract name is required']
9
- },
10
- levyId: {
11
- type: mongoose.Schema.Types.ObjectId,
12
- ref: 'Levy',
13
- required: [true, 'Levy ID is required']
14
- },
15
- customerId: {
16
- type: mongoose.Schema.Types.ObjectId,
17
- ref: 'Customer',
18
- required: [true, 'Customer ID is required']
19
- },
20
- unitId: {
21
- type: mongoose.Schema.Types.ObjectId,
22
- ref: 'Unit',
23
- required: [true, 'Unit ID is required']
24
- },
25
- amount: {
26
- type: Number,
27
- required: [true, 'Amount is required'],
28
- min: [0, 'Amount cannot be negative']
29
- },
30
- startDate: {
31
- type: Date,
32
- required: [true, 'Start date is required']
33
- },
34
- endDate: {
35
- type: Date,
36
- required: [true, 'End date is required']
37
- },
38
- status: {
39
- type: String,
40
- enum: ['Active', 'Inactive', 'Completed', 'Suspended', 'Terminated'],
41
- default: 'Active',
42
- required: [true, 'Status is required']
43
- },
44
- // Replace single doubleEntryAccount with two separate accounts
45
- invoiceDoubleEntryAccount: {
46
- type: mongoose.Schema.Types.ObjectId,
47
- ref: 'GLAccountDoubleEntries',
48
- required: [true, 'Invoice double entry account is required']
49
- },
50
- paymentDoubleEntryAccount: {
51
- type: mongoose.Schema.Types.ObjectId,
52
- ref: 'GLAccountDoubleEntries',
53
- required: [true, 'Payment double entry account is required']
54
- },
55
- balanceBroughtForward: {
56
- type: Number,
57
- default: 0
58
- },
59
- paymentFrequency: {
60
- type: String,
61
- enum: ['Daily', 'Weekly', 'Bi-Weekly', 'Monthly', 'Quarterly', 'Semi-Annually', 'Annually'],
62
- default: 'Monthly'
63
- },
64
- facilityId: {
65
- type: mongoose.Schema.Types.ObjectId,
66
- ref: 'Facility',
67
- required: [true, 'Facility ID is required']
68
- },
69
- lastInvoiceDate: {
70
- type: Date
71
- },
72
- createdBy: {
73
- type: mongoose.Schema.Types.ObjectId,
74
- ref: 'User'
75
- },
76
- updatedBy: {
77
- type: mongoose.Schema.Types.ObjectId,
78
- ref: 'User'
79
- }
80
- },
81
- {
82
- timestamps: true,
83
- toJSON: { virtuals: true },
84
- toObject: { virtuals: true }
85
- }
86
- );
87
-
88
- // Virtual populate for Levy details
89
- LevyContractSchema.virtual('levy', {
90
- ref: 'Levy',
91
- localField: 'levyId',
92
- foreignField: '_id',
93
- justOne: true
94
- });
95
-
96
- // Virtual populate for Customer details
97
- LevyContractSchema.virtual('customer', {
98
- ref: 'Customer',
99
- localField: 'customerId',
100
- foreignField: '_id',
101
- justOne: true
102
- });
103
-
104
- // Virtual populate for Unit details
105
- LevyContractSchema.virtual('unit', {
106
- ref: 'Unit',
107
- localField: 'unitId',
108
- foreignField: '_id',
109
- justOne: true
110
- });
111
-
112
- // Virtual populate for invoice double entry account
113
- LevyContractSchema.virtual('invoiceDoubleEntry', {
114
- ref: 'GLAccountDoubleEntries',
115
- localField: 'invoiceDoubleEntryAccount',
116
- foreignField: '_id',
117
- justOne: true
118
- });
119
-
120
- // Virtual populate for payment double entry account
121
- LevyContractSchema.virtual('paymentDoubleEntry', {
122
- ref: 'GLAccountDoubleEntries',
123
- localField: 'paymentDoubleEntryAccount',
124
- foreignField: '_id',
125
- justOne: true
126
- });
127
-
128
- // Pre-save middleware to ensure endDate is after startDate
129
- LevyContractSchema.pre('save', function (next) {
130
- if (this.startDate && this.endDate && this.startDate >= this.endDate) {
131
- next(new Error('End date must be after start date'));
132
- } else {
133
- next();
134
- }
135
- });
136
-
137
- // Pre-save middleware to maintain backward compatibility during migration
138
- LevyContractSchema.pre('save', function (next) {
139
- // If we have the old doubleEntryAccount but not the new ones,
140
- // use the old one for both new fields during the transition
141
- if (this.doubleEntryAccount &&
142
- (!this.invoiceDoubleEntryAccount || !this.paymentDoubleEntryAccount)) {
143
- this.invoiceDoubleEntryAccount = this.doubleEntryAccount;
144
- this.paymentDoubleEntryAccount = this.doubleEntryAccount;
145
- }
146
- next();
147
- });
148
-
149
- // Index for efficient queries
150
- LevyContractSchema.index({ levyId: 1, unitId: 1, status: 1 });
151
- LevyContractSchema.index({ facilityId: 1 });
152
- LevyContractSchema.index({ customerId: 1 });
153
- LevyContractSchema.index({ invoiceDoubleEntryAccount: 1 });
154
- LevyContractSchema.index({ paymentDoubleEntryAccount: 1 });
155
-
156
- module.exports = {
157
- schema: LevyContractSchema,
158
- name: 'LevyContract'
1
+ const mongoose = require('mongoose');
2
+ const Schema = mongoose.Schema;
3
+
4
+ const LevyContractSchema = new Schema(
5
+ {
6
+ contractName: {
7
+ type: String,
8
+ required: [true, 'Contract name is required']
9
+ },
10
+ levyId: {
11
+ type: mongoose.Schema.Types.ObjectId,
12
+ ref: 'Levy',
13
+ required: [true, 'Levy ID is required']
14
+ },
15
+ customerId: {
16
+ type: mongoose.Schema.Types.ObjectId,
17
+ ref: 'Customer',
18
+ required: [true, 'Customer ID is required']
19
+ },
20
+ unitId: {
21
+ type: mongoose.Schema.Types.ObjectId,
22
+ ref: 'Unit',
23
+ required: [true, 'Unit ID is required']
24
+ },
25
+ amount: {
26
+ type: Number,
27
+ required: [true, 'Amount is required'],
28
+ min: [0, 'Amount cannot be negative']
29
+ },
30
+ startDate: {
31
+ type: Date,
32
+ required: [true, 'Start date is required']
33
+ },
34
+ endDate: {
35
+ type: Date,
36
+ required: [true, 'End date is required']
37
+ },
38
+ status: {
39
+ type: String,
40
+ enum: ['Active', 'Inactive', 'Completed', 'Suspended', 'Terminated'],
41
+ default: 'Active',
42
+ required: [true, 'Status is required']
43
+ },
44
+ // Replace single doubleEntryAccount with two separate accounts
45
+ invoiceDoubleEntryAccount: {
46
+ type: mongoose.Schema.Types.ObjectId,
47
+ ref: 'GLAccountDoubleEntries',
48
+ required: [true, 'Invoice double entry account is required']
49
+ },
50
+ paymentDoubleEntryAccount: {
51
+ type: mongoose.Schema.Types.ObjectId,
52
+ ref: 'GLAccountDoubleEntries',
53
+ required: [true, 'Payment double entry account is required']
54
+ },
55
+ balanceBroughtForward: {
56
+ type: Number,
57
+ default: 0
58
+ },
59
+ paymentFrequency: {
60
+ type: String,
61
+ enum: ['Daily', 'Weekly', 'Bi-Weekly', 'Monthly', 'Quarterly', 'Semi-Annually', 'Annually'],
62
+ default: 'Monthly'
63
+ },
64
+ facilityId: {
65
+ type: mongoose.Schema.Types.ObjectId,
66
+ ref: 'Facility',
67
+ required: [true, 'Facility ID is required']
68
+ },
69
+ lastInvoiceDate: {
70
+ type: Date
71
+ },
72
+ createdBy: {
73
+ type: mongoose.Schema.Types.ObjectId,
74
+ ref: 'User'
75
+ },
76
+ updatedBy: {
77
+ type: mongoose.Schema.Types.ObjectId,
78
+ ref: 'User'
79
+ }
80
+ },
81
+ {
82
+ timestamps: true,
83
+ toJSON: { virtuals: true },
84
+ toObject: { virtuals: true }
85
+ }
86
+ );
87
+
88
+ // Virtual populate for Levy details
89
+ LevyContractSchema.virtual('levy', {
90
+ ref: 'Levy',
91
+ localField: 'levyId',
92
+ foreignField: '_id',
93
+ justOne: true
94
+ });
95
+
96
+ // Virtual populate for Customer details
97
+ LevyContractSchema.virtual('customer', {
98
+ ref: 'Customer',
99
+ localField: 'customerId',
100
+ foreignField: '_id',
101
+ justOne: true
102
+ });
103
+
104
+ // Virtual populate for Unit details
105
+ LevyContractSchema.virtual('unit', {
106
+ ref: 'Unit',
107
+ localField: 'unitId',
108
+ foreignField: '_id',
109
+ justOne: true
110
+ });
111
+
112
+ // Virtual populate for invoice double entry account
113
+ LevyContractSchema.virtual('invoiceDoubleEntry', {
114
+ ref: 'GLAccountDoubleEntries',
115
+ localField: 'invoiceDoubleEntryAccount',
116
+ foreignField: '_id',
117
+ justOne: true
118
+ });
119
+
120
+ // Virtual populate for payment double entry account
121
+ LevyContractSchema.virtual('paymentDoubleEntry', {
122
+ ref: 'GLAccountDoubleEntries',
123
+ localField: 'paymentDoubleEntryAccount',
124
+ foreignField: '_id',
125
+ justOne: true
126
+ });
127
+
128
+ // Pre-save middleware to ensure endDate is after startDate
129
+ LevyContractSchema.pre('save', function (next) {
130
+ if (this.startDate && this.endDate && this.startDate >= this.endDate) {
131
+ next(new Error('End date must be after start date'));
132
+ } else {
133
+ next();
134
+ }
135
+ });
136
+
137
+ // Pre-save middleware to maintain backward compatibility during migration
138
+ LevyContractSchema.pre('save', function (next) {
139
+ // If we have the old doubleEntryAccount but not the new ones,
140
+ // use the old one for both new fields during the transition
141
+ if (this.doubleEntryAccount &&
142
+ (!this.invoiceDoubleEntryAccount || !this.paymentDoubleEntryAccount)) {
143
+ this.invoiceDoubleEntryAccount = this.doubleEntryAccount;
144
+ this.paymentDoubleEntryAccount = this.doubleEntryAccount;
145
+ }
146
+ next();
147
+ });
148
+
149
+ // Index for efficient queries
150
+ LevyContractSchema.index({ levyId: 1, unitId: 1, status: 1 });
151
+ LevyContractSchema.index({ facilityId: 1 });
152
+ LevyContractSchema.index({ customerId: 1 });
153
+ LevyContractSchema.index({ invoiceDoubleEntryAccount: 1 });
154
+ LevyContractSchema.index({ paymentDoubleEntryAccount: 1 });
155
+
156
+ module.exports = {
157
+ schema: LevyContractSchema,
158
+ name: 'LevyContract'
159
159
  };
@@ -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);