payservedb 4.5.1 → 4.5.3
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/package.json
CHANGED
|
@@ -56,7 +56,19 @@ const levyContractSchema = new mongoose.Schema({
|
|
|
56
56
|
type: mongoose.Schema.Types.ObjectId,
|
|
57
57
|
ref: 'Facility',
|
|
58
58
|
required: true
|
|
59
|
-
}
|
|
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
|
+
]
|
|
60
72
|
}, {
|
|
61
73
|
timestamps: true
|
|
62
74
|
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const supplierSchema = new mongoose.Schema({
|
|
4
|
+
facilityId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'Facility',
|
|
7
|
+
required: true,
|
|
8
|
+
index: true
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
trim: true,
|
|
14
|
+
index: true
|
|
15
|
+
},
|
|
16
|
+
email: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: true,
|
|
19
|
+
trim: true,
|
|
20
|
+
lowercase: true
|
|
21
|
+
},
|
|
22
|
+
phone: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: true,
|
|
25
|
+
trim: true
|
|
26
|
+
},
|
|
27
|
+
address: {
|
|
28
|
+
street: String,
|
|
29
|
+
city: String,
|
|
30
|
+
state: String,
|
|
31
|
+
country: String,
|
|
32
|
+
postalCode: String
|
|
33
|
+
},
|
|
34
|
+
contactPerson: {
|
|
35
|
+
name: String,
|
|
36
|
+
email: String,
|
|
37
|
+
phone: String,
|
|
38
|
+
position: String
|
|
39
|
+
},
|
|
40
|
+
taxIdentificationNumber: {
|
|
41
|
+
type: String,
|
|
42
|
+
trim: true
|
|
43
|
+
},
|
|
44
|
+
supplierType: {
|
|
45
|
+
type: String,
|
|
46
|
+
enum: ['product', 'service', 'both'],
|
|
47
|
+
default: 'both'
|
|
48
|
+
},
|
|
49
|
+
preferredCurrency: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'KES'
|
|
52
|
+
},
|
|
53
|
+
paymentTerms: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: 'net30'
|
|
56
|
+
},
|
|
57
|
+
bankDetails: {
|
|
58
|
+
bankName: String,
|
|
59
|
+
accountName: String,
|
|
60
|
+
accountNumber: String,
|
|
61
|
+
branchCode: String,
|
|
62
|
+
swiftCode: String
|
|
63
|
+
},
|
|
64
|
+
documents: [{
|
|
65
|
+
name: String,
|
|
66
|
+
fileUrl: String,
|
|
67
|
+
fileType: String,
|
|
68
|
+
uploadDate: {
|
|
69
|
+
type: Date,
|
|
70
|
+
default: Date.now
|
|
71
|
+
}
|
|
72
|
+
}],
|
|
73
|
+
status: {
|
|
74
|
+
type: String,
|
|
75
|
+
enum: ['active', 'inactive', 'blacklisted'],
|
|
76
|
+
default: 'active',
|
|
77
|
+
index: true
|
|
78
|
+
},
|
|
79
|
+
rating: {
|
|
80
|
+
type: Number,
|
|
81
|
+
min: 0,
|
|
82
|
+
max: 5,
|
|
83
|
+
default: 0
|
|
84
|
+
},
|
|
85
|
+
categories: [{
|
|
86
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
87
|
+
ref: 'SupplierCategory'
|
|
88
|
+
}],
|
|
89
|
+
notes: String,
|
|
90
|
+
purchaseHistory: [{
|
|
91
|
+
poNumber: String,
|
|
92
|
+
poDate: Date,
|
|
93
|
+
amount: Number,
|
|
94
|
+
currency: String,
|
|
95
|
+
status: {
|
|
96
|
+
type: String,
|
|
97
|
+
enum: ['pending', 'completed', 'cancelled'],
|
|
98
|
+
default: 'pending'
|
|
99
|
+
}
|
|
100
|
+
}]
|
|
101
|
+
}, {
|
|
102
|
+
timestamps: true
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
supplierSchema.index({ name: 1, status: 1 });
|
|
106
|
+
supplierSchema.index({ supplierType: 1 });
|
|
107
|
+
|
|
108
|
+
const Supplier = mongoose.model('Supplier', supplierSchema);
|
|
109
|
+
|
|
110
|
+
module.exports = Supplier;
|
package/src/models/units.js
CHANGED
|
@@ -6,57 +6,73 @@ const unitSchema = new mongoose.Schema({
|
|
|
6
6
|
type: String,
|
|
7
7
|
required: true
|
|
8
8
|
},
|
|
9
|
-
unitType:{
|
|
10
|
-
type:String,
|
|
11
|
-
required:true
|
|
9
|
+
unitType: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true
|
|
12
12
|
},
|
|
13
|
-
division:{
|
|
14
|
-
type:String,
|
|
15
|
-
required:true
|
|
13
|
+
division: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true
|
|
16
16
|
},
|
|
17
|
-
floorUnitNo:{
|
|
18
|
-
type:String,
|
|
19
|
-
required:true
|
|
17
|
+
floorUnitNo: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true
|
|
20
20
|
},
|
|
21
|
-
lettableFloorArea:{
|
|
22
|
-
type:String,
|
|
23
|
-
required:false
|
|
21
|
+
lettableFloorArea: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: false
|
|
24
24
|
},
|
|
25
|
-
landRateNumber:{
|
|
26
|
-
type:String,
|
|
27
|
-
required:false
|
|
25
|
+
landRateNumber: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: false
|
|
28
28
|
},
|
|
29
|
-
grossArea:{
|
|
30
|
-
type:Number,
|
|
31
|
-
required:false
|
|
29
|
+
grossArea: {
|
|
30
|
+
type: Number,
|
|
31
|
+
required: false
|
|
32
32
|
},
|
|
33
|
-
netLettableArea:{
|
|
34
|
-
type:Number,
|
|
35
|
-
required:false
|
|
33
|
+
netLettableArea: {
|
|
34
|
+
type: Number,
|
|
35
|
+
required: false
|
|
36
36
|
},
|
|
37
|
-
status:{
|
|
38
|
-
type:String,
|
|
39
|
-
required:true
|
|
37
|
+
status: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: true
|
|
40
40
|
},
|
|
41
|
-
facilityId:{
|
|
41
|
+
facilityId: {
|
|
42
42
|
type: mongoose.Schema.Types.ObjectId,
|
|
43
43
|
ref: 'Facility',
|
|
44
44
|
},
|
|
45
|
-
|
|
46
|
-
homeOwnerId:{
|
|
45
|
+
|
|
46
|
+
homeOwnerId: {
|
|
47
47
|
type: mongoose.Schema.Types.ObjectId,
|
|
48
48
|
ref: 'Customer',
|
|
49
49
|
},
|
|
50
|
-
|
|
50
|
+
unitDocuments: [
|
|
51
|
+
{
|
|
52
|
+
documentName: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: true
|
|
55
|
+
},
|
|
56
|
+
documentType: {
|
|
57
|
+
type: String,
|
|
58
|
+
required: true
|
|
59
|
+
},
|
|
60
|
+
document: {
|
|
61
|
+
type: String,
|
|
62
|
+
required: true
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
tenantId: {
|
|
51
67
|
type: mongoose.Schema.Types.ObjectId,
|
|
52
68
|
ref: 'Customer',
|
|
53
69
|
},
|
|
54
|
-
residentId:{
|
|
70
|
+
residentId: {
|
|
55
71
|
type: mongoose.Schema.Types.ObjectId,
|
|
56
72
|
ref: 'Customer',
|
|
57
73
|
}
|
|
58
|
-
|
|
59
|
-
|
|
74
|
+
|
|
75
|
+
|
|
60
76
|
}, {
|
|
61
77
|
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
62
78
|
});
|