payservedb 3.2.4 → 3.2.6

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
@@ -113,7 +113,10 @@ const models = {
113
113
  MeterIotCard:require('./src/models/water_meter_iot_cards'),
114
114
  MetersDelivery:require('./src/models/water_meters_delivery'),
115
115
  Concentrator:require('./src/models/water_meter_concentrator'),
116
- Handover:require('./src/models/handover')
116
+ Handover:require('./src/models/handover'),
117
+ Budget:require('./src/models/budget'),
118
+ BudgetCategory:require('./src/models/budgetCategory'),
119
+ Expense:require('./src/models/expense')
117
120
 
118
121
 
119
122
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "3.2.4",
3
+ "version": "3.2.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -0,0 +1,34 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const budgetSchema = new mongoose.Schema({
4
+ facilityId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: 'Facility',
7
+ required: true
8
+ },
9
+ categoryId: {
10
+ type: mongoose.Schema.Types.ObjectId,
11
+ ref: 'BudgetCategory',
12
+ required: true
13
+ },
14
+ amount: {
15
+ type: Number,
16
+ required: true
17
+ },
18
+ period: {
19
+ startDate: {
20
+ type: Date,
21
+ required: true
22
+ },
23
+ endDate: {
24
+ type: Date,
25
+ required: true
26
+ }
27
+ }
28
+ }, {
29
+ timestamps: true
30
+ });
31
+
32
+ const Budget = mongoose.model('Budget', budgetSchema);
33
+
34
+ module.exports = Budget;
@@ -0,0 +1,20 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const budgetCategorySchema = new mongoose.Schema({
4
+ facilityId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: 'Facility',
7
+ required: true
8
+ },
9
+ title: {
10
+ type: String,
11
+ required: true,
12
+ trim: true
13
+ }
14
+ }, {
15
+ timestamps: true
16
+ });
17
+
18
+ const BudgetCategory = mongoose.model('BudgetCategory', budgetCategorySchema);
19
+
20
+ module.exports = BudgetCategory;
@@ -0,0 +1,52 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const expenseSchema = new mongoose.Schema({
4
+ facilityId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: 'Facility',
7
+ required: true
8
+ },
9
+ categoryId: {
10
+ type: mongoose.Schema.Types.ObjectId,
11
+ ref: 'BudgetCategory',
12
+ required: true
13
+ },
14
+ name: {
15
+ type: String,
16
+ required: true,
17
+ trim: true
18
+ },
19
+ amount: {
20
+ type: Number,
21
+ required: true
22
+ },
23
+ type: {
24
+ type: String,
25
+ enum: ['RECURRING', 'ONE_TIME'],
26
+ required: true
27
+ },
28
+ date: {
29
+ type: Date,
30
+ required: true,
31
+ default: Date.now
32
+ },
33
+ status: {
34
+ type: String,
35
+ enum: ['PAID', 'UNPAID'],
36
+ default: 'UNPAID'
37
+ },
38
+ description: {
39
+ type: String,
40
+ trim: true
41
+ },
42
+ receiptUrl: {
43
+ type: String,
44
+ trim: true
45
+ }
46
+ }, {
47
+ timestamps: true
48
+ });
49
+
50
+ const Expense = mongoose.model('Expense', expenseSchema);
51
+
52
+ module.exports = Expense;
@@ -27,8 +27,7 @@ const deliverySchema = new mongoose.Schema({
27
27
  },
28
28
  deliveryDate: {
29
29
  type: Date,
30
- required: true,
31
- default: Date.now
30
+ required: true
32
31
  },
33
32
  notes: {
34
33
  type: String,
@@ -40,7 +39,7 @@ const deliverySchema = new mongoose.Schema({
40
39
  },
41
40
  fileUrl: {
42
41
  type: String,
43
- trim: true
42
+ trim: true
44
43
  },
45
44
  concentrators: [{
46
45
  concentratorId: {