payservedb 5.4.7 → 5.4.9
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/index.js +2 -1
- package/package.json +1 -1
- package/src/models/budget.js +69 -12
- package/src/models/unitManagementTemplate.js +45 -0
package/index.js
CHANGED
|
@@ -168,7 +168,8 @@ const models = {
|
|
|
168
168
|
GLAccount: require('./src/models/gl_accounts'),
|
|
169
169
|
GLEntry: require('./src/models/gl_entries'),
|
|
170
170
|
GLAccountDoubleEntries: require('./src/models/gl_account_double_entries'),
|
|
171
|
-
PendingCredential: require('./src/models/pendingCredentials')
|
|
171
|
+
PendingCredential: require('./src/models/pendingCredentials'),
|
|
172
|
+
UnitManagementTemplate: require('./src/models/unitManagementTemplate')
|
|
172
173
|
};
|
|
173
174
|
|
|
174
175
|
// Function to get models dynamically from a specific database connection
|
package/package.json
CHANGED
package/src/models/budget.js
CHANGED
|
@@ -4,31 +4,88 @@ const budgetSchema = new mongoose.Schema({
|
|
|
4
4
|
facilityId: {
|
|
5
5
|
type: mongoose.Schema.Types.ObjectId,
|
|
6
6
|
ref: 'Facility',
|
|
7
|
+
required: true,
|
|
8
|
+
index: true
|
|
9
|
+
},
|
|
10
|
+
budgetName: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
trim: true
|
|
14
|
+
},
|
|
15
|
+
allocation: {
|
|
16
|
+
type: Number,
|
|
17
|
+
required: true
|
|
18
|
+
},
|
|
19
|
+
userName: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: true
|
|
22
|
+
},
|
|
23
|
+
startDate: {
|
|
24
|
+
type: Date,
|
|
7
25
|
required: true
|
|
8
26
|
},
|
|
9
|
-
|
|
27
|
+
endDate: {
|
|
28
|
+
type: Date,
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
department: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: true,
|
|
34
|
+
trim: true
|
|
35
|
+
},
|
|
36
|
+
overruns: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
approvalWorkflowId: {
|
|
10
41
|
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
-
ref: '
|
|
42
|
+
ref: 'ApprovalWorkflow',
|
|
12
43
|
required: true
|
|
13
44
|
},
|
|
14
|
-
|
|
45
|
+
approvalStatus: {
|
|
46
|
+
type: String,
|
|
47
|
+
enum: ['pending', 'in_progress', 'approved', 'rejected'],
|
|
48
|
+
default: 'pending',
|
|
49
|
+
index: true
|
|
50
|
+
},
|
|
51
|
+
currentStep: {
|
|
15
52
|
type: Number,
|
|
16
|
-
|
|
53
|
+
default: 1,
|
|
54
|
+
min: 1
|
|
17
55
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type:
|
|
56
|
+
approvals: [{
|
|
57
|
+
stepNumber: {
|
|
58
|
+
type: Number,
|
|
21
59
|
required: true
|
|
22
60
|
},
|
|
23
|
-
|
|
24
|
-
type:
|
|
61
|
+
stepName: {
|
|
62
|
+
type: String,
|
|
25
63
|
required: true
|
|
26
|
-
}
|
|
27
|
-
|
|
64
|
+
},
|
|
65
|
+
approvers: [{
|
|
66
|
+
userId: {
|
|
67
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
68
|
+
ref: 'User',
|
|
69
|
+
required: true
|
|
70
|
+
},
|
|
71
|
+
status: {
|
|
72
|
+
type: String,
|
|
73
|
+
enum: ['pending', 'approved', 'rejected'],
|
|
74
|
+
default: 'pending'
|
|
75
|
+
},
|
|
76
|
+
actionDate: {
|
|
77
|
+
type: Date
|
|
78
|
+
},
|
|
79
|
+
comments: {
|
|
80
|
+
type: String,
|
|
81
|
+
trim: true
|
|
82
|
+
}
|
|
83
|
+
}]
|
|
84
|
+
}]
|
|
28
85
|
}, {
|
|
29
86
|
timestamps: true
|
|
30
87
|
});
|
|
31
88
|
|
|
32
89
|
const Budget = mongoose.model('Budget', budgetSchema);
|
|
33
90
|
|
|
34
|
-
module.exports = Budget;
|
|
91
|
+
module.exports = Budget;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const unitManagementTemplateSchema = new mongoose.Schema({
|
|
4
|
+
name: {
|
|
5
|
+
type: String,
|
|
6
|
+
required: true,
|
|
7
|
+
trim: true
|
|
8
|
+
},
|
|
9
|
+
description: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
trim: true
|
|
13
|
+
},
|
|
14
|
+
templateContent: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
createdBy: {
|
|
19
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
20
|
+
ref: 'User',
|
|
21
|
+
required: true
|
|
22
|
+
},
|
|
23
|
+
facilityId: {
|
|
24
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
25
|
+
ref: 'Facility',
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
isDefault: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
createdAt: {
|
|
33
|
+
type: Date,
|
|
34
|
+
default: Date.now
|
|
35
|
+
},
|
|
36
|
+
updatedAt: {
|
|
37
|
+
type: Date,
|
|
38
|
+
default: Date.now
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
timestamps: true
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Add to payservedb
|
|
45
|
+
module.exports = mongoose.model('UnitManagementTemplate', unitManagementTemplateSchema);
|