payservedb 5.4.9 → 5.5.0

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 CHANGED
@@ -130,6 +130,7 @@ const models = {
130
130
  Budget: require('./src/models/budget'),
131
131
  BudgetCategory: require('./src/models/budgetCategory'),
132
132
  Expense: require('./src/models/expense'),
133
+ ExpenseCategory: require('./src/models/expense_category'),
133
134
  InvoiceSettings: require('./src/models/levy_invoice_settings'),
134
135
  Account: require('./src/models/account'),
135
136
  FacilityPaymentDetails: require('./src/models/facility_payment_details'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "5.4.9",
3
+ "version": "5.5.0",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -6,16 +6,19 @@ const expenseSchema = new mongoose.Schema({
6
6
  ref: 'Facility',
7
7
  required: true
8
8
  },
9
- categoryId: {
9
+ budgetId: {
10
10
  type: mongoose.Schema.Types.ObjectId,
11
- ref: 'BudgetCategory',
12
- required: true
11
+ ref: 'Budget'
13
12
  },
14
13
  name: {
15
14
  type: String,
16
15
  required: true,
17
16
  trim: true
18
17
  },
18
+ categoryId: {
19
+ type: mongoose.Schema.Types.ObjectId,
20
+ ref: 'ExpenseCategory'
21
+ },
19
22
  amount: {
20
23
  type: Number,
21
24
  required: true
@@ -35,10 +38,6 @@ const expenseSchema = new mongoose.Schema({
35
38
  enum: ['PAID', 'UNPAID'],
36
39
  default: 'UNPAID'
37
40
  },
38
- approval: {
39
- type: Boolean,
40
- default: false
41
- },
42
41
  description: {
43
42
  type: String,
44
43
  trim: true
@@ -46,7 +45,52 @@ const expenseSchema = new mongoose.Schema({
46
45
  receiptUrl: {
47
46
  type: String,
48
47
  trim: true
49
- }
48
+ },
49
+ approvalWorkflowId: {
50
+ type: mongoose.Schema.Types.ObjectId,
51
+ ref: 'ApprovalWorkflow',
52
+ required: true
53
+ },
54
+ approvalStatus: {
55
+ type: String,
56
+ enum: ['pending', 'in_progress', 'approved', 'rejected'],
57
+ default: 'pending',
58
+ index: true
59
+ },
60
+ currentStep: {
61
+ type: Number,
62
+ default: 1,
63
+ min: 1
64
+ },
65
+ approvals: [{
66
+ stepNumber: {
67
+ type: Number,
68
+ required: true
69
+ },
70
+ stepName: {
71
+ type: String,
72
+ required: true
73
+ },
74
+ approvers: [{
75
+ userId: {
76
+ type: mongoose.Schema.Types.ObjectId,
77
+ ref: 'User',
78
+ required: true
79
+ },
80
+ status: {
81
+ type: String,
82
+ enum: ['pending', 'approved', 'rejected'],
83
+ default: 'pending'
84
+ },
85
+ actionDate: {
86
+ type: Date
87
+ },
88
+ comments: {
89
+ type: String,
90
+ trim: true
91
+ }
92
+ }]
93
+ }]
50
94
  }, {
51
95
  timestamps: true
52
96
  });
@@ -0,0 +1,20 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const expenseCategorySchema = new mongoose.Schema({
4
+ facilityId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: 'Facility',
7
+ required: true
8
+ },
9
+ name: {
10
+ type: String,
11
+ required: true,
12
+ trim: true
13
+ }
14
+ }, {
15
+ timestamps: true
16
+ });
17
+
18
+ const ExpenseCategory = mongoose.model('ExpenseCategory', expenseCategorySchema);
19
+
20
+ module.exports = ExpenseCategory;