payservedb 7.9.7 → 7.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "7.9.7",
3
+ "version": "7.9.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,22 +1,18 @@
1
1
  const mongoose = require('mongoose');
2
2
 
3
- /**
4
- * @description The schema for tracking invoicing schedules for each facility.
5
- * This document is stored in the central invoice service database.
6
- * It contains minimal data required for the service to function,
7
- * avoiding the complexity of facility-specific data.
8
- */
9
3
  const InvoicingScheduleSchema = new mongoose.Schema({
10
4
  facilityId: {
11
- type: String,
12
- required: true,
13
- unique: true,
14
- index: true
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: 'Facility',
15
7
  },
16
8
  nextInvoiceDate: {
17
9
  type: Date,
18
10
  required: true
19
11
  },
12
+ invoiceType: {
13
+ type: String,
14
+ required: true
15
+ },
20
16
  createdAt: {
21
17
  type: Date,
22
18
  default: Date.now
@@ -44,6 +44,26 @@ const inspectionItemSchema = new mongoose.Schema({
44
44
  default: 1,
45
45
  min: [1, 'Default quantity must be at least 1']
46
46
  },
47
+ serialNumber: {
48
+ type: String,
49
+ trim: true,
50
+ default: null
51
+ },
52
+ cost: {
53
+ type: Number,
54
+ default: 0,
55
+ min: [0, 'Cost cannot be negative']
56
+ },
57
+ currencyId: {
58
+ type: mongoose.Schema.Types.ObjectId,
59
+ ref: 'Currency',
60
+ required: false,
61
+ default: null
62
+ },
63
+ images: [{
64
+ type: String,
65
+ trim: true
66
+ }],
47
67
  active: {
48
68
  type: Boolean,
49
69
  default: true
@@ -52,6 +72,12 @@ const inspectionItemSchema = new mongoose.Schema({
52
72
  type: mongoose.Schema.Types.ObjectId,
53
73
  ref: 'Facility',
54
74
  required: true
75
+ },
76
+ unitId: {
77
+ type: mongoose.Schema.Types.ObjectId,
78
+ ref: 'Unit',
79
+ required: false,
80
+ default: null
55
81
  }
56
82
  }, {
57
83
  timestamps: true
@@ -61,6 +87,9 @@ const inspectionItemSchema = new mongoose.Schema({
61
87
  inspectionItemSchema.index({ facilityId: 1 });
62
88
  inspectionItemSchema.index({ facilityId: 1, category: 1 });
63
89
  inspectionItemSchema.index({ facilityId: 1, active: 1 });
90
+ inspectionItemSchema.index({ facilityId: 1, unitId: 1 });
91
+ inspectionItemSchema.index({ unitId: 1, active: 1 });
92
+ inspectionItemSchema.index({ currencyId: 1 });
64
93
 
65
94
  // Create InspectionItem model
66
95
  const InspectionItem = mongoose.model('InspectionItem', inspectionItemSchema);